mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	qca-nss-drv: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -2,8 +2,17 @@ include $(TOPDIR)/rules.mk | |||||||
| include $(INCLUDE_DIR)/kernel.mk | include $(INCLUDE_DIR)/kernel.mk | ||||||
|  |  | ||||||
| PKG_NAME:=qca-nss-drv | PKG_NAME:=qca-nss-drv | ||||||
|  | PKG_SOURCE_PROTO:=git | ||||||
| PKG_BRANCH:=master | PKG_BRANCH:=master | ||||||
| PKG_RELEASE:=2 | PKG_RELEASE:=2 | ||||||
|  | PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv | ||||||
|  | PKG_MIRROR_HASH:=350af8f6b1f06ea0871314783a5362483963bbe327ba774ba49a2a775847363e | ||||||
|  | PKG_VERSION:=7563fe37340ec4a28b7821a0ac17608ff30e2a85 | ||||||
|  |  | ||||||
|  | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||||||
|  | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) | ||||||
|  | PKG_SOURCE_VERSION:=$(PKG_VERSION) | ||||||
|  |  | ||||||
|  |  | ||||||
| NSS_CLIENTS_DIR:=$(TOPDIR)/qca/src/qca-nss-clients | NSS_CLIENTS_DIR:=$(TOPDIR)/qca/src/qca-nss-clients | ||||||
|  |  | ||||||
| @@ -105,6 +114,7 @@ define Build/Compile | |||||||
| 		ARCH="$(LINUX_KARCH)" \ | 		ARCH="$(LINUX_KARCH)" \ | ||||||
| 		M="$(PKG_BUILD_DIR)" \ | 		M="$(PKG_BUILD_DIR)" \ | ||||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(subtarget)" \ | 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(subtarget)" \ | ||||||
|  | 		KBUILD_MODPOST_WARN=1 \ | ||||||
| 		modules | 		modules | ||||||
| endef | endef | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,537 +0,0 @@ | |||||||
| # ################################################### |  | ||||||
| # # Makefile for the NSS driver |  | ||||||
| # ################################################### |  | ||||||
|  |  | ||||||
| obj-m += qca-nss-drv.o |  | ||||||
|  |  | ||||||
| # |  | ||||||
| # List the files that belong to the driver in alphabetical order. |  | ||||||
| # |  | ||||||
| qca-nss-drv-objs := \ |  | ||||||
| 			nss_cmn.o \ |  | ||||||
| 			nss_core.o \ |  | ||||||
| 			nss_coredump.o \ |  | ||||||
| 			nss_drv_stats.o \ |  | ||||||
| 			nss_drv_strings.o \ |  | ||||||
| 			nss_dynamic_interface.o \ |  | ||||||
| 			nss_dynamic_interface_log.o \ |  | ||||||
| 			nss_dynamic_interface_stats.o \ |  | ||||||
| 			nss_eth_rx.o \ |  | ||||||
| 			nss_eth_rx_stats.o \ |  | ||||||
| 			nss_eth_rx_strings.o \ |  | ||||||
| 			nss_gmac_stats.o \ |  | ||||||
| 			nss_if.o \ |  | ||||||
| 			nss_if_log.o \ |  | ||||||
| 			nss_init.o \ |  | ||||||
| 			nss_ipv4.o \ |  | ||||||
| 			nss_ipv4_stats.o \ |  | ||||||
| 			nss_ipv4_strings.o \ |  | ||||||
| 			nss_ipv4_log.o \ |  | ||||||
| 			nss_log.o \ |  | ||||||
| 			nss_lso_rx.o \ |  | ||||||
| 			nss_lso_rx_stats.o \ |  | ||||||
| 			nss_lso_rx_strings.o \ |  | ||||||
| 			nss_meminfo.o \ |  | ||||||
| 			nss_n2h.o \ |  | ||||||
| 			nss_n2h_stats.o \ |  | ||||||
| 			nss_n2h_strings.o \ |  | ||||||
| 			nss_phys_if.o \ |  | ||||||
| 			nss_pm.o \ |  | ||||||
| 			nss_profiler.o \ |  | ||||||
| 			nss_project.o \ |  | ||||||
| 			nss_pppoe.o \ |  | ||||||
| 			nss_pppoe_log.o \ |  | ||||||
| 			nss_pppoe_stats.o \ |  | ||||||
| 			nss_pppoe_strings.o \ |  | ||||||
| 			nss_rps.o \ |  | ||||||
| 			nss_stats.o \ |  | ||||||
| 			nss_strings.o \ |  | ||||||
| 			nss_tx_msg_sync.o \ |  | ||||||
| 			nss_unaligned.o \ |  | ||||||
| 			nss_unaligned_log.o \ |  | ||||||
| 			nss_unaligned_stats.o \ |  | ||||||
| 			nss_virt_if.o \ |  | ||||||
| 			nss_virt_if_stats.o \ |  | ||||||
| 			nss_vlan.o \ |  | ||||||
| 			nss_vlan_log.o \ |  | ||||||
| 			nss_wifi.o \ |  | ||||||
| 			nss_wifi_log.o \ |  | ||||||
| 			nss_wifi_stats.o \ |  | ||||||
| 			nss_wifi_vdev.o \ |  | ||||||
| 			nss_wifili.o \ |  | ||||||
| 			nss_wifili_log.o \ |  | ||||||
| 			nss_wifili_stats.o \ |  | ||||||
| 			nss_wifili_strings.o \ |  | ||||||
| 			nss_wifi_mac_db.o |  | ||||||
|  |  | ||||||
| # Base NSS data plane/HAL support |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o |  | ||||||
| qca-nss-drv-objs += nss_hal/nss_hal.o |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_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" |  | ||||||
| ccflags-y += -DNSS_DRV_L2TP_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		   nss_l2tpv2.o \ |  | ||||||
| 		   nss_l2tpv2_log.o \ |  | ||||||
| 		   nss_l2tpv2_stats.o \ |  | ||||||
| 		   nss_l2tpv2_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_LAG_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_LAG_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		   nss_lag.o \ |  | ||||||
| 		   nss_lag_log.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_PVXLAN_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_PVXLAN_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_pvxlan.o \ |  | ||||||
| 			 nss_pvxlan_log.o \ |  | ||||||
| 			 nss_pvxlan_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_IPV6_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_IPV6_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			nss_ipv6.o \ |  | ||||||
| 			nss_ipv6_stats.o \ |  | ||||||
| 			nss_ipv6_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" |  | ||||||
| ccflags-y += -DNSS_DRV_TSTAMP_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_tstamp.o \ |  | ||||||
| 			 nss_tstamp_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_GRE_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_GRE_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_gre.o \ |  | ||||||
| 			 nss_gre_log.o \ |  | ||||||
| 			 nss_gre_stats.o \ |  | ||||||
| 			 nss_gre_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_GRE_REDIR_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_GRE_REDIR_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_gre_redir.o \ |  | ||||||
| 			 nss_gre_redir_log.o \ |  | ||||||
| 			 nss_gre_redir_lag_ds.o \ |  | ||||||
| 			 nss_gre_redir_lag_ds_log.o \ |  | ||||||
| 			 nss_gre_redir_lag_ds_stats.o \ |  | ||||||
| 			 nss_gre_redir_lag_ds_strings.o \ |  | ||||||
| 			 nss_gre_redir_lag_us.o \ |  | ||||||
| 			 nss_gre_redir_lag_us_log.o \ |  | ||||||
| 			 nss_gre_redir_lag_us_stats.o \ |  | ||||||
| 			 nss_gre_redir_lag_us_strings.o \ |  | ||||||
| 			 nss_gre_redir_stats.o \ |  | ||||||
| 			 nss_gre_redir_strings.o \ |  | ||||||
| 			 nss_gre_redir_mark.o \ |  | ||||||
| 			 nss_gre_redir_mark_log.o \ |  | ||||||
| 			 nss_gre_redir_mark_stats.o \ |  | ||||||
| 			 nss_gre_redir_mark_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_GRE_TUNNEL_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_GRE_TUNNEL_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_gre_tunnel.o \ |  | ||||||
| 			 nss_gre_tunnel_log.o \ |  | ||||||
| 			 nss_gre_tunnel_stats.o \ |  | ||||||
| 			 nss_gre_tunnel_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_CAPWAP_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_CAPWAP_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_capwap.o \ |  | ||||||
| 			 nss_capwap_log.o \ |  | ||||||
| 			 nss_capwap_stats.o \ |  | ||||||
| 			 nss_capwap_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_MAPT_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_MAPT_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_map_t.o \ |  | ||||||
| 			 nss_map_t_log.o \ |  | ||||||
| 			 nss_map_t_stats.o \ |  | ||||||
| 			 nss_map_t_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_PPTP_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_PPTP_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_pptp.o \ |  | ||||||
| 			 nss_pptp_log.o \ |  | ||||||
| 			 nss_pptp_stats.o \ |  | ||||||
| 			 nss_pptp_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_SHAPER_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_SHAPER_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_shaper.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_SJACK_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_SJACK_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_sjack.o \ |  | ||||||
| 			 nss_sjack_log.o \ |  | ||||||
| 			 nss_sjack_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_TUN6RD_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_TUN6RD_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_tun6rd.o \ |  | ||||||
| 			 nss_tun6rd_log.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_TRUSTSEC_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_TRUSTSEC_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_trustsec_tx.o \ |  | ||||||
| 			 nss_trustsec_tx_log.o \ |  | ||||||
| 			 nss_trustsec_tx_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_TUNIPIP6_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_TUNIPIP6_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_tunipip6.o \ |  | ||||||
| 			 nss_tunipip6_log.o \ |  | ||||||
| 			 nss_tunipip6_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_QRFS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_QRFS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_qrfs.o \ |  | ||||||
| 			 nss_qrfs_log.o \ |  | ||||||
| 			 nss_qrfs_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_RMNET_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_RMNET_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_rmnet_rx.o \ |  | ||||||
| 			 nss_rmnet_rx_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_PORTID_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_PORTID_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_portid.o \ |  | ||||||
| 			 nss_portid_log.o \ |  | ||||||
| 			 nss_portid_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_IGS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_IGS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_igs.o \ |  | ||||||
| 			 nss_igs_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_OAM_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_OAM_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_oam.o \ |  | ||||||
| 			 nss_oam_log.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_CLMAP_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_CLMAP_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_clmap.o \ |  | ||||||
| 			 nss_clmap_log.o \ |  | ||||||
| 			 nss_clmap_stats.o \ |  | ||||||
| 			 nss_clmap_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_VXLAN_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_VXLAN_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_vxlan.o \ |  | ||||||
| 			 nss_vxlan_log.o \ |  | ||||||
| 			 nss_vxlan_stats.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_MATCH_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			nss_match.o \ |  | ||||||
| 			nss_match_log.o \ |  | ||||||
| 			nss_match_stats.o \ |  | ||||||
| 			nss_match_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_MIRROR_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			nss_mirror.o \ |  | ||||||
| 			nss_mirror_log.o \ |  | ||||||
| 			nss_mirror_stats.o \ |  | ||||||
| 			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 |  | ||||||
|  |  | ||||||
| ifeq ($(SoC),$(filter $(SoC),ipq806x)) |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ |  | ||||||
| 		    nss_hal/ipq806x/nss_hal_pvt.o |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_C2C_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_C2C_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_c2c_tx.o \ |  | ||||||
| 			 nss_c2c_tx_log.o \ |  | ||||||
| 			 nss_c2c_tx_stats.o \ |  | ||||||
| 			 nss_c2c_tx_strings.o \ |  | ||||||
| 			 nss_c2c_rx.o \ |  | ||||||
| 			 nss_c2c_rx_stats.o \ |  | ||||||
| 			 nss_c2c_rx_strings.o |  | ||||||
| endif |  | ||||||
| ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_IPSEC_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_ipsec_log.o \ |  | ||||||
| 		    nss_ipsec.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_CRYPTO_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_crypto.o \ |  | ||||||
| 		    nss_crypto_log.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_DTLS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_dtls.o \ |  | ||||||
| 		    nss_dtls_log.o \ |  | ||||||
| 		    nss_dtls_stats.o |  | ||||||
| endif |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/ipq806x -DNSS_HAL_IPQ806X_SUPPORT |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ |  | ||||||
| 					nss_edma.o \ |  | ||||||
| 					nss_edma_stats.o \ |  | ||||||
| 					nss_edma_strings.o \ |  | ||||||
| 					nss_ppe.o \ |  | ||||||
| 					nss_ppe_log.o \ |  | ||||||
| 					nss_ppe_stats.o \ |  | ||||||
| 					nss_ppe_strings.o \ |  | ||||||
| 					nss_ppe_vp.o \ |  | ||||||
| 					nss_ppe_vp_log.o \ |  | ||||||
| 					nss_ppe_vp_stats.o |  | ||||||
|  |  | ||||||
| ccflags-y += -DNSS_DRV_PPE_ENABLE |  | ||||||
| ccflags-y += -DNSS_DRV_EDMA_ENABLE |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_IPSEC_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_ipsec_cmn_log.o \ |  | ||||||
| 		    nss_ipsec_cmn.o \ |  | ||||||
| 		    nss_ipsec_cmn_stats.o \ |  | ||||||
| 		    nss_ipsec_cmn_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_CRYPTO_ENABLE |  | ||||||
| ccflags-y += -DNSS_DRV_DMA_ENABLE |  | ||||||
|  |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_crypto_cmn.o \ |  | ||||||
| 		    nss_crypto_cmn_log.o \ |  | ||||||
| 		    nss_crypto_cmn_stats.o \ |  | ||||||
| 		    nss_crypto_cmn_strings.o \ |  | ||||||
| 		    nss_dma.o \ |  | ||||||
| 		    nss_dma_log.o \ |  | ||||||
| 		    nss_dma_stats.o \ |  | ||||||
| 		    nss_dma_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_DTLS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_dtls_cmn.o \ |  | ||||||
| 		    nss_dtls_cmn_log.o \ |  | ||||||
| 		    nss_dtls_cmn_stats.o \ |  | ||||||
| 		    nss_dtls_cmn_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_QVPN_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_QVPN_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 	     nss_qvpn.o \ |  | ||||||
| 	     nss_qvpn_log.o \ |  | ||||||
| 	     nss_qvpn_stats.o \ |  | ||||||
| 	     nss_qvpn_strings.o |  | ||||||
| endif |  | ||||||
| ifneq "$(NSS_DRV_TLS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_TLS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		     nss_tls.o \ |  | ||||||
| 		     nss_tls_log.o \ |  | ||||||
| 		     nss_tls_stats.o \ |  | ||||||
| 		     nss_tls_strings.o |  | ||||||
| endif |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) |  | ||||||
| qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \ |  | ||||||
| 		    nss_data_plane/hal/nss_ipq807x.o |  | ||||||
| ifneq "$(NSS_DRV_C2C_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_C2C_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			 nss_c2c_tx.o \ |  | ||||||
| 			 nss_c2c_tx_log.o \ |  | ||||||
| 			 nss_c2c_tx_stats.o \ |  | ||||||
| 			 nss_c2c_tx_strings.o \ |  | ||||||
| 			 nss_c2c_rx.o \ |  | ||||||
| 			 nss_c2c_rx_stats.o \ |  | ||||||
| 			 nss_c2c_rx_strings.o |  | ||||||
| endif |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64)) |  | ||||||
| qca-nss-drv-objs += nss_hal/ipq60xx/nss_hal_pvt.o \ |  | ||||||
| 		    nss_data_plane/hal/nss_ipq60xx.o |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/ipq60xx -DNSS_HAL_IPQ60XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64)) |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ |  | ||||||
| 		    nss_hal/ipq50xx/nss_hal_pvt.o \ |  | ||||||
| 		    nss_data_plane/hal/nss_ipq50xx.o |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_IPSEC_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_ipsec_cmn_log.o \ |  | ||||||
| 		    nss_ipsec_cmn.o \ |  | ||||||
| 		    nss_ipsec_cmn_stats.o \ |  | ||||||
| 		    nss_ipsec_cmn_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_CRYPTO_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_CRYPTO_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_crypto_cmn.o \ |  | ||||||
| 		    nss_crypto_cmn_log.o \ |  | ||||||
| 		    nss_crypto_cmn_stats.o \ |  | ||||||
| 		    nss_crypto_cmn_strings.o |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ifneq "$(NSS_DRV_DTLS_ENABLE)" "n" |  | ||||||
| ccflags-y += -DNSS_DRV_DTLS_ENABLE |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 		    nss_dtls_cmn.o \ |  | ||||||
| 		    nss_dtls_cmn_log.o \ |  | ||||||
| 		    nss_dtls_cmn_stats.o \ |  | ||||||
| 		    nss_dtls_cmn_strings.o |  | ||||||
| endif |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/ipq50xx -DNSS_HAL_IPQ50XX_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1 |  | ||||||
| ccflags-y += -I$(obj)/nss_data_plane/hal/include |  | ||||||
| ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1 |  | ||||||
| ccflags-y += -Wall -Werror |  | ||||||
|  |  | ||||||
| KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) |  | ||||||
|  |  | ||||||
| ifneq ($(findstring 3.4, $(KERNELVERSION)),) |  | ||||||
| NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 |  | ||||||
| else |  | ||||||
| NSS_CCFLAGS = -DNSS_DT_SUPPORT=1 -DNSS_FW_DBG_SUPPORT=0 -DNSS_PM_SUPPORT=0 |  | ||||||
|  |  | ||||||
| ccflags-y += -I$(obj) |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| # Fabric scaling is supported in 3.14 and 4.4 only |  | ||||||
| ifneq ($(findstring 3.14, $(KERNELVERSION)),) |  | ||||||
| NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 |  | ||||||
| else ifneq ($(findstring 4.4, $(KERNELVERSION)),) |  | ||||||
| NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=1 |  | ||||||
| else |  | ||||||
| NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0 |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| # Disable Frequency scaling |  | ||||||
| ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y" |  | ||||||
| ccflags-y += -DNSS_FREQ_SCALE_SUPPORT=0 |  | ||||||
| else |  | ||||||
| qca-nss-drv-objs += \ |  | ||||||
| 			nss_freq.o \ |  | ||||||
| 			nss_freq_log.o \ |  | ||||||
| 			nss_freq_stats.o |  | ||||||
| ccflags-y += -DNSS_FREQ_SCALE_SUPPORT=1 |  | ||||||
| endif |  | ||||||
|  |  | ||||||
| ccflags-y += $(NSS_CCFLAGS) |  | ||||||
|  |  | ||||||
| export NSS_CCFLAGS |  | ||||||
|  |  | ||||||
| obj ?= . |  | ||||||
| @@ -1,123 +0,0 @@ | |||||||
| # ################################################### |  | ||||||
| # # Makefile for the NSS driver |  | ||||||
| # ################################################### |  | ||||||
| obj-m += qca-nss-drv.o |  | ||||||
|  |  | ||||||
| # |  | ||||||
| # List the files that belong to the driver in alphabetical order. |  | ||||||
| # |  | ||||||
| qca-nss-drv-objs := \ |  | ||||||
| 			nss_bridge.o \ |  | ||||||
| 			nss_bridge_log.o \ |  | ||||||
| 			nss_capwap.o \ |  | ||||||
| 			nss_capwap_log.o \ |  | ||||||
| 			nss_capwap_stats.o \ |  | ||||||
| 			nss_cmn.o \ |  | ||||||
| 			nss_core.o \ |  | ||||||
| 			nss_coredump.o \ |  | ||||||
| 			nss_crypto.o \ |  | ||||||
| 			nss_crypto_log.o \ |  | ||||||
| 			nss_dtls.o \ |  | ||||||
| 			nss_dtls_log.o \ |  | ||||||
| 			nss_dtls_stats.o \ |  | ||||||
| 			nss_dynamic_interface.o \ |  | ||||||
| 			nss_dynamic_interface_log.o \ |  | ||||||
| 			nss_edma.o \ |  | ||||||
| 			nss_edma_stats.o \ |  | ||||||
| 			nss_eth_rx.o \ |  | ||||||
| 			nss_eth_rx_stats.o \ |  | ||||||
| 			nss_gre.o \ |  | ||||||
| 			nss_gre_log.o \ |  | ||||||
| 			nss_gre_stats.o \ |  | ||||||
| 			nss_gre_redir.o \ |  | ||||||
| 			nss_gre_redir_log.o \ |  | ||||||
| 			nss_gre_redir_stats.o \ |  | ||||||
| 			nss_gre_tunnel.o \ |  | ||||||
| 			nss_gre_tunnel_log.o \ |  | ||||||
| 			nss_gre_tunnel_stats.o \ |  | ||||||
| 			nss_if.o \ |  | ||||||
|                         nss_if_log.o \ |  | ||||||
| 			nss_init.o \ |  | ||||||
| 			nss_ipsec.o \ |  | ||||||
| 			nss_ipsec_log.o \ |  | ||||||
| 			nss_ipv4.o \ |  | ||||||
| 			nss_ipv4_stats.o \ |  | ||||||
| 			nss_ipv4_log.o \ |  | ||||||
| 			nss_ipv4_reasm.o \ |  | ||||||
| 			nss_ipv4_reasm_stats.o \ |  | ||||||
| 			nss_ipv6.o \ |  | ||||||
| 			nss_ipv6_stats.o \ |  | ||||||
| 			nss_ipv6_log.o \ |  | ||||||
| 			nss_ipv6_reasm.o \ |  | ||||||
| 			nss_ipv6_reasm_stats.o \ |  | ||||||
| 			nss_l2tpv2.o \ |  | ||||||
| 			nss_l2tpv2_log.o \ |  | ||||||
| 			nss_l2tpv2_stats.o \ |  | ||||||
| 			nss_lag.o \ |  | ||||||
| 			nss_lag_log.o \ |  | ||||||
| 			nss_log.o \ |  | ||||||
| 			nss_lso_rx.o \ |  | ||||||
| 			nss_lso_rx_stats.o \ |  | ||||||
| 			nss_map_t.o \ |  | ||||||
| 			nss_map_t_log.o \ |  | ||||||
| 			nss_map_t_stats.o \ |  | ||||||
| 			nss_n2h.o \ |  | ||||||
| 			nss_n2h_stats.o \ |  | ||||||
| 			nss_oam.o \ |  | ||||||
| 			nss_oam_log.o \ |  | ||||||
| 			nss_phys_if.o \ |  | ||||||
| 			nss_pm.o \ |  | ||||||
| 			nss_profiler.o \ |  | ||||||
| 			nss_portid.o \ |  | ||||||
| 			nss_portid_log.o \ |  | ||||||
| 			nss_portid_stats.o \ |  | ||||||
| 			nss_ppe.o \ |  | ||||||
| 			nss_ppe_log.o \ |  | ||||||
| 			nss_ppe_stats.o \ |  | ||||||
| 			nss_pppoe.o \ |  | ||||||
| 			nss_pppoe_log.o \ |  | ||||||
| 			nss_pppoe_stats.o \ |  | ||||||
| 			nss_pptp.o \ |  | ||||||
| 			nss_pptp_log.o \ |  | ||||||
| 			nss_pptp_stats.o \ |  | ||||||
| 			nss_rps.o \ |  | ||||||
| 			nss_shaper.o \ |  | ||||||
| 			nss_sjack.o \ |  | ||||||
| 			nss_sjack_log.o \ |  | ||||||
| 			nss_sjack_stats.o \ |  | ||||||
| 			nss_stats.o \ |  | ||||||
| 			nss_tstamp.o \ |  | ||||||
| 			nss_tstamp_stats.o \ |  | ||||||
| 			nss_tun6rd.o \ |  | ||||||
| 			nss_tun6rd_log.o \ |  | ||||||
| 			nss_trustsec_tx.o \ |  | ||||||
| 			nss_trustsec_tx_log.o \ |  | ||||||
| 			nss_trustsec_tx_stats.o \ |  | ||||||
| 			nss_tunipip6.o \ |  | ||||||
| 			nss_tunipip6_log.o \ |  | ||||||
| 			nss_unaligned.o \ |  | ||||||
| 			nss_unaligned_log.o \ |  | ||||||
| 			nss_unaligned_stats.o \ |  | ||||||
| 			nss_virt_if.o \ |  | ||||||
| 			nss_virt_if_stats.o \ |  | ||||||
| 			nss_vlan.o \ |  | ||||||
| 			nss_vlan_log.o \ |  | ||||||
| 			nss_wifi.o \ |  | ||||||
| 			nss_wifi_log.o \ |  | ||||||
| 			nss_wifi_stats.o \ |  | ||||||
| 			nss_wifi_if.o \ |  | ||||||
| 			nss_wifi_if_stats.o \ |  | ||||||
| 			nss_wifi_vdev.o |  | ||||||
|  |  | ||||||
| qca-nss-drv-objs += nss_hal/nss_hal.o |  | ||||||
| qca-nss-drv-objs += nss_hal/fsm9010/nss_hal_pvt.o |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o |  | ||||||
| qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o |  | ||||||
|  |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/include |  | ||||||
| ccflags-y += -I$(obj)/nss_data_plane/include |  | ||||||
| ccflags-y += -I$(obj)/exports |  | ||||||
| ccflags-y += -I$(obj)/nss_hal/fsm9010 -DNSS_HAL_FSM9010_SUPPORT |  | ||||||
| ccflags-y += -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1 |  | ||||||
| ccflags-y += -DNSS_DT_SUPPORT=1 -DNSS_PM_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=0 -DNSS_SKB_REUSE_SUPPORT=0 |  | ||||||
| ccflags-y += -DNSS_PPP_SUPPORT=0 -DNSS_FREQ_SCALE_SUPPORT=0 -DNSS_FABRIC_SCALING_SUPPORT=0 |  | ||||||
| @@ -1,43 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_fsm9010.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_FSM9010_H |  | ||||||
| #define __NSS_FSM9010_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_fsm9010 |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 1		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 3		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 4		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| #define NSS_IMEM_START 0xE4000000	/**< NSS IMEM start address. */ |  | ||||||
| #define NSS_IMEM_SIZE  0x10000		/**< NSS IMEM size. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_FSM9010_H */ |  | ||||||
| @@ -1,43 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2019, 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_ipq40xx.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ40XX_H |  | ||||||
| #define __NSS_IPQ40XX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq40xx |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 1		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 0		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 0		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| #define NSS_IMEM_START	0x39000000	/**< NSS IMEM start address. */ |  | ||||||
| #define NSS_IMEM_SIZE	0x10000		/**< NSS IMEM size per core. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ40XX_H */ |  | ||||||
| @@ -1,40 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 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_ipq50xx.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ50XX_H |  | ||||||
| #define __NSS_IPQ50XX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq50xx |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 2		/**< Number of host cores. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 3		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 7		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ50XX_H */ |  | ||||||
| @@ -1,40 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 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_ipq50xx_64.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ50XX_64_H |  | ||||||
| #define __NSS_IPQ50XX_64_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq50xx_64 |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 2		/**< Number of host cores. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 3		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 7		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ50XX_64_H */ |  | ||||||
| @@ -1,41 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 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_ipq60xx.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ60XX_H |  | ||||||
| #define __NSS_IPQ60XX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq60xx |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
| #define NSS_PPE_SUPPORTED		/**< PPE supported flag. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 5		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 11		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ60XX_H */ |  | ||||||
| @@ -1,41 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 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_ipq60xx_64.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ60XX_64_H |  | ||||||
| #define __NSS_IPQ60XX_64_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq60xx_64 |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
| #define NSS_PPE_SUPPORTED		/**< PPE supported flag. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 5		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 11		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ60XX_64_H */ |  | ||||||
| @@ -1,43 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_ipq806x.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ806X_H |  | ||||||
| #define __NSS_IPQ806X_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq806x |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 2		/**< Number of host cores. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 3		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 4		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| #define NSS_IMEM_START	0x39000000	/**< NSS IMEM start address. */ |  | ||||||
| #define NSS_IMEM_SIZE	0x10000		/**< NSS IMEM size per core. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ806X_H */ |  | ||||||
| @@ -1,44 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_ipq807x.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ807X_H |  | ||||||
| #define __NSS_IPQ807X_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq807x |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
| #define NSS_PPE_SUPPORTED		/**< PPE supported flag. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 5		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 11		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| #define NSS_IMEM_START	0x38000000	/**< NSS IMEM start address. */ |  | ||||||
| #define NSS_IMEM_SIZE	0x30000		/**< NSS IMEM size per core. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ807X_H */ |  | ||||||
| @@ -1,44 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_ipq807x_64.h |  | ||||||
|  *	Architecture dependent parameters. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_IPQ807x_64_H |  | ||||||
| #define __NSS_IPQ807x_64_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_arch_macros_ipq807x_64 |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NUM_PRI 4		/**< Maximum number of priority queues in NSS. */ |  | ||||||
| #define NSS_HOST_CORES 4		/**< Number of host cores. */ |  | ||||||
| #define NSS_PPE_SUPPORTED		/**< PPE supported flag. */ |  | ||||||
|  |  | ||||||
| #define NSS_N2H_RING_COUNT 5		/**< Number of N2H rings. */ |  | ||||||
| #define NSS_H2N_RING_COUNT 11		/**< Number of H2N rings. */ |  | ||||||
| #define NSS_RING_SIZE	128		/**< Ring size. */ |  | ||||||
|  |  | ||||||
| #define NSS_IMEM_START	0x38000000	/**< NSS IMEM start address. */ |  | ||||||
| #define NSS_IMEM_SIZE	0x30000		/**< NSS IMEM size per core. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_IPQ807x_64_H */ |  | ||||||
| @@ -1,319 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_api_if.h |  | ||||||
|  *	NSS driver APIs and Declarations. |  | ||||||
|  * |  | ||||||
|  * This file declares all the public interfaces for NSS driver. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_API_IF_H |  | ||||||
| #define __NSS_API_IF_H |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| #ifndef DOXYGEN_SHOULD_SKIP_THIS |  | ||||||
| #include <linux/if_ether.h> |  | ||||||
| #include <linux/skbuff.h> |  | ||||||
| #include <linux/netdevice.h> |  | ||||||
| #include "nss_arch.h" |  | ||||||
| #include "nss_def.h" |  | ||||||
| #include "nss_cmn.h" |  | ||||||
| #include "nss_tun6rd.h" |  | ||||||
| #include "nss_l2tpv2.h" |  | ||||||
| #include "nss_pptp.h" |  | ||||||
| #include "nss_map_t.h" |  | ||||||
| #include "nss_tunipip6.h" |  | ||||||
| #include "nss_lag.h" |  | ||||||
| #include "nss_stats_public.h" |  | ||||||
| #include "nss_ipv4.h" |  | ||||||
| #include "nss_ipv6.h" |  | ||||||
| #include "nss_shaper.h" |  | ||||||
| #include "nss_if.h" |  | ||||||
| #include "nss_phy_if.h" |  | ||||||
| #include "nss_virt_if.h" |  | ||||||
| #include "nss_pppoe.h" |  | ||||||
| #include "nss_crypto.h" |  | ||||||
| #include "nss_crypto_cmn.h" |  | ||||||
| #include "nss_dma.h" |  | ||||||
|  |  | ||||||
| #include "nss_profiler.h" |  | ||||||
| #include "nss_dynamic_interface.h" |  | ||||||
| #include "nss_ipsec.h" |  | ||||||
| #include "nss_ipsec_cmn.h" |  | ||||||
| #include "nss_gre.h" |  | ||||||
| #include "nss_gre_redir.h" |  | ||||||
| #include "nss_gre_redir_lag.h" |  | ||||||
| #include "nss_gre_tunnel.h" |  | ||||||
| #include "nss_sjack.h" |  | ||||||
| #include "nss_capwap.h" |  | ||||||
| #include "nss_wifi.h" |  | ||||||
| #include "nss_wifi_vdev.h" |  | ||||||
| #include "nss_n2h.h" |  | ||||||
| #include "nss_rps.h" |  | ||||||
| #include "nss_portid.h" |  | ||||||
| #include "nss_oam.h" |  | ||||||
| #include "nss_dtls.h" |  | ||||||
| #include "nss_dtls_cmn.h" |  | ||||||
| #include "nss_tls.h" |  | ||||||
| #include "nss_edma.h" |  | ||||||
| #include "nss_bridge.h" |  | ||||||
| #include "nss_ppe.h" |  | ||||||
| #include "nss_trustsec_tx.h" |  | ||||||
| #include "nss_vlan.h" |  | ||||||
| #include "nss_igs.h" |  | ||||||
| #include "nss_mirror.h" |  | ||||||
| #include "nss_wifili_if.h" |  | ||||||
| #include "nss_project.h" |  | ||||||
| #include "nss_qrfs.h" |  | ||||||
| #include "nss_c2c_tx.h" |  | ||||||
| #include "nss_qvpn.h" |  | ||||||
| #include "nss_unaligned.h" |  | ||||||
| #include "nss_pvxlan.h" |  | ||||||
| #include "nss_vxlan.h" |  | ||||||
| #include "nss_pm.h" |  | ||||||
| #include "nss_freq.h" |  | ||||||
| #include "nss_tstamp.h" |  | ||||||
| #include "nss_gre_redir_mark.h" |  | ||||||
| #include "nss_clmap.h" |  | ||||||
| #include "nss_rmnet_rx.h" |  | ||||||
| #include "nss_match.h" |  | ||||||
| #include "nss_eth_rx.h" |  | ||||||
| #include "nss_c2c_rx.h" |  | ||||||
| #include "nss_ipv6_reasm.h" |  | ||||||
| #include "nss_ipv4_reasm.h" |  | ||||||
| #include "nss_lso_rx.h" |  | ||||||
| #include "nss_wifi_mac_db_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 /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_driver_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_CORES 2		/**< Maximum number of core interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_DEVICE_INTERFACES (NSS_MAX_PHYSICAL_INTERFACES + NSS_MAX_VIRTUAL_INTERFACES + NSS_MAX_TUNNEL_INTERFACES + NSS_MAX_DYNAMIC_INTERFACES) |  | ||||||
| 		/**< Maximum number of device interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_NET_INTERFACES (NSS_MAX_DEVICE_INTERFACES + NSS_MAX_SPECIAL_INTERFACES) |  | ||||||
| 		/**< Maximum number of network 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_TUNNEL_INTERFACES 4	/**< Maximum number of tunnel interfaces. */ |  | ||||||
| #define NSS_MAX_SPECIAL_INTERFACES 69	/**< Maximum number of special interfaces. */ |  | ||||||
| #define NSS_MAX_WIFI_RADIO_INTERFACES 3	/**< Maximum number of radio interfaces. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Start of individual interface groups |  | ||||||
|  */ |  | ||||||
| #define NSS_PHYSICAL_IF_START 0 |  | ||||||
| 		/**< Beginning of the physical interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_VIRTUAL_IF_START (NSS_PHYSICAL_IF_START + NSS_MAX_PHYSICAL_INTERFACES) |  | ||||||
| 		/**< Beginning of the virtual interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_TUNNEL_IF_START (NSS_VIRTUAL_IF_START + NSS_MAX_VIRTUAL_INTERFACES) |  | ||||||
| 		/**< Beginning of the tunnel interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_DYNAMIC_IF_START (NSS_TUNNEL_IF_START + NSS_MAX_TUNNEL_INTERFACES) |  | ||||||
| 		/**< Beginning of the dynamic interfaces. */ |  | ||||||
|  |  | ||||||
| #define NSS_SPECIAL_IF_START (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES) |  | ||||||
| 		/**< Beginning of the special interfaces. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Tunnel interface numbers |  | ||||||
|  */ |  | ||||||
| #define NSS_IPSEC_ENCAP_IF_NUMBER (NSS_TUNNEL_IF_START + 0) |  | ||||||
| 		/**< Tunnel interface number for IPsec encapsulation interfaces. */ |  | ||||||
| #define NSS_IPSEC_DECAP_IF_NUMBER (NSS_TUNNEL_IF_START + 1) |  | ||||||
| 		/**< Tunnel interface number for IPsec decapsulation interfaces. */ |  | ||||||
| #define NSS_TUN6RD_INTERFACE (NSS_TUNNEL_IF_START + 2) |  | ||||||
| 		/**< Tunnel interface number for TUN6RD interfaces. */ |  | ||||||
| #define NSS_TUNIPIP6_INTERFACE (NSS_TUNNEL_IF_START + 3) |  | ||||||
| 		/**< Tunnel interface number for TUNIPIP6 interfaces. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Special interface numbers |  | ||||||
|  */ |  | ||||||
| #define NSS_N2H_INTERFACE (NSS_SPECIAL_IF_START + 0) |  | ||||||
| 		/**< Special interface number for N2H. */ |  | ||||||
| #define NSS_ETH_RX_INTERFACE (NSS_SPECIAL_IF_START + 2) |  | ||||||
| 		/**< Special interface number for Ethernet Rx. */ |  | ||||||
| #define NSS_PPPOE_INTERFACE (NSS_SPECIAL_IF_START + 3) |  | ||||||
| 		/**< Special interface number for PPPoE. */ |  | ||||||
| #define NSS_IPV4_RX_INTERFACE (NSS_SPECIAL_IF_START + 5) |  | ||||||
| 		/**< Special interface number for IPv4. */ |  | ||||||
| #define NSS_IPV6_RX_INTERFACE (NSS_SPECIAL_IF_START + 7) |  | ||||||
| 		/**< Special interface number for IPv6. */ |  | ||||||
| #define NSS_PROFILER_INTERFACE (NSS_SPECIAL_IF_START + 8) |  | ||||||
| 		/**< Special interface number for profile. */ |  | ||||||
| #define NSS_CRYPTO_INTERFACE (NSS_SPECIAL_IF_START + 9) |  | ||||||
| 		/**< Special interface number for crypto CE5. */ |  | ||||||
| #define NSS_DTLS_INTERFACE (NSS_SPECIAL_IF_START + 10) |  | ||||||
| 		/**< Special interface number for DTLS. */ |  | ||||||
| #define NSS_CRYPTO_CMN_INTERFACE (NSS_SPECIAL_IF_START + 11) |  | ||||||
| 		/**< Special interface number for crypto common. */ |  | ||||||
| #define NSS_C2C_TX_INTERFACE (NSS_SPECIAL_IF_START + 12) |  | ||||||
| 		/**< Virtual interface number for core-to-core transmissions. */ |  | ||||||
| #define NSS_C2C_RX_INTERFACE (NSS_SPECIAL_IF_START + 13) |  | ||||||
| 		/**< Virtual interface number for core-to-core reception. */ |  | ||||||
| #define NSS_IPSEC_CMN_INTERFACE (NSS_SPECIAL_IF_START + 18) |  | ||||||
| 		/**< Virtual interface number for IPSec rule. */ |  | ||||||
| #define NSS_COREFREQ_INTERFACE (NSS_SPECIAL_IF_START + 19) |  | ||||||
| 		/**< Virtual interface number for core frequency. */ |  | ||||||
| #define NSS_DYNAMIC_INTERFACE (NSS_SPECIAL_IF_START + 20) |  | ||||||
| 		/**< Special interface number for dynamic interfaces. */ |  | ||||||
| #define NSS_GRE_REDIR_INTERFACE (NSS_SPECIAL_IF_START + 21) |  | ||||||
| 		/**< Special interface number for GRE redirect base interfaces. */ |  | ||||||
| #define NSS_LSO_RX_INTERFACE (NSS_SPECIAL_IF_START + 22) |  | ||||||
| 		/**< Special interface number for LSO. */ |  | ||||||
| #define NSS_SJACK_INTERFACE (NSS_SPECIAL_IF_START + 23) |  | ||||||
| 		/**< Special interface number for GRE REDIR base interfaces. */ |  | ||||||
| #define NSS_IPV4_REASM_INTERFACE (NSS_SPECIAL_IF_START + 24) |  | ||||||
| 		/**< Special interface number for IPv4 reassembly interfaces. */ |  | ||||||
| #define NSS_DEBUG_INTERFACE (NSS_SPECIAL_IF_START + 25) |  | ||||||
| 		/**< Special interface number for debug. */ |  | ||||||
| #define NSS_WIFI_INTERFACE0 (NSS_SPECIAL_IF_START + 26) |  | ||||||
| 		/**< Special interface number for Wi-Fi radio 0. */ |  | ||||||
| #define NSS_WIFI_INTERFACE1 (NSS_SPECIAL_IF_START + 27) |  | ||||||
| 		/**< Special interface number for Wi-Fi radio 1. */ |  | ||||||
| #define NSS_WIFI_INTERFACE2 (NSS_SPECIAL_IF_START + 28) |  | ||||||
| 		/**< Special interface number for Wi-Fi radio 2. */ |  | ||||||
| #define NSS_IPV6_REASM_INTERFACE (NSS_SPECIAL_IF_START + 29) |  | ||||||
| 		/**< Special interface number for IPv6 reassembly. */ |  | ||||||
| #define NSS_LAG0_INTERFACE_NUM (NSS_SPECIAL_IF_START + 30) |  | ||||||
| 		/**< Special interface number for LAG0. */ |  | ||||||
| #define NSS_LAG1_INTERFACE_NUM (NSS_SPECIAL_IF_START + 31) |  | ||||||
| 		/**< Special interface number for LAG1. */ |  | ||||||
| #define NSS_LAG2_INTERFACE_NUM (NSS_SPECIAL_IF_START + 32) |  | ||||||
| 		/**< Special interface number for LAG2. */ |  | ||||||
| #define NSS_LAG3_INTERFACE_NUM (NSS_SPECIAL_IF_START + 33) |  | ||||||
| 		/**< Special interface number for LAG3. */ |  | ||||||
| #define NSS_L2TPV2_INTERFACE (NSS_SPECIAL_IF_START + 34) |  | ||||||
| 		/**< Special interface number for L2TPv2 UDP encapsulation. */ |  | ||||||
| #define NSS_PPTP_INTERFACE (NSS_SPECIAL_IF_START + 36) |  | ||||||
| 		/**< Special interface number for PPTP-to-decapsulation. */ |  | ||||||
| #define NSS_PORTID_INTERFACE (NSS_SPECIAL_IF_START + 37) |  | ||||||
| 		/**< Special interface number for port ID. */ |  | ||||||
| #define NSS_OAM_INTERFACE (NSS_SPECIAL_IF_START + 38) |  | ||||||
| 		/**< Special interface number for OAM. */ |  | ||||||
| #define NSS_MAP_T_INTERFACE (NSS_SPECIAL_IF_START + 39) |  | ||||||
| 		/**< Special interface number for MAP-T. */ |  | ||||||
| #define NSS_PPE_INTERFACE (NSS_SPECIAL_IF_START + 40) |  | ||||||
| 		/**< Special interface number for PPE. */ |  | ||||||
| #define NSS_EDMA_INTERFACE (NSS_SPECIAL_IF_START + 41) |  | ||||||
| 		/**< Special interface number for EDMA. */ |  | ||||||
| #define NSS_GRE_TUNNEL_INTERFACE (NSS_SPECIAL_IF_START + 42) |  | ||||||
| 		/**< Special interface number for NSS GRE tunnel. */ |  | ||||||
| #define NSS_TRUSTSEC_TX_INTERFACE (NSS_SPECIAL_IF_START + 43) |  | ||||||
| 		/**< Special interface number for TrustSec Tx. */ |  | ||||||
| #define NSS_VAP_INTERFACE (NSS_SPECIAL_IF_START + 44) |  | ||||||
| 		/**< Special interface number for NSS Wi-Fi VAPs base interfaces. */ |  | ||||||
| #define NSS_VLAN_INTERFACE (NSS_SPECIAL_IF_START + 45) |  | ||||||
| 		/**< Special interface number for VLAN. */ |  | ||||||
| #define NSS_GRE_INTERFACE (NSS_SPECIAL_IF_START + 46) |  | ||||||
| 		/**< Special interface number for GRE. */ |  | ||||||
| #define NSS_WIFILI_INTERNAL_INTERFACE (NSS_SPECIAL_IF_START + 47) |  | ||||||
| 		/**< Special interface number for wifili internal instance. */ |  | ||||||
| #define NSS_PROJECT_INTERFACE (NSS_SPECIAL_IF_START + 48) |  | ||||||
| 		/**< Special interface number for project node. */ |  | ||||||
| #define NSS_PBUF_MGR_FREE_INTERFACE (NSS_SPECIAL_IF_START + 49) |  | ||||||
| 		/**< Special interface number for PBUF_MGR_FREE node. */ |  | ||||||
| #define NSS_REDIR_RX_INTERFACE (NSS_SPECIAL_IF_START + 50) |  | ||||||
| 		/**< Special interface number for 802.3 redirect node. */ |  | ||||||
| #define NSS_QRFS_INTERFACE (NSS_SPECIAL_IF_START + 51) |  | ||||||
| 		/**< Special interface number for QRFS. */ |  | ||||||
| #define NSS_GRE_REDIR_LAG_INTERFACE (NSS_SPECIAL_IF_START + 52) |  | ||||||
| 		/**< Special interface number for GRE redirect link aggregation interface. */ |  | ||||||
| #define NSS_UNALIGNED_INTERFACE (NSS_SPECIAL_IF_START + 53) |  | ||||||
| 		/**< Special interface number for unaligned handler. */ |  | ||||||
| #define NSS_TSTAMP_TX_INTERFACE (NSS_SPECIAL_IF_START + 54) |  | ||||||
| 		/**< Special interface number for timestamp transmit. */ |  | ||||||
| #define NSS_TSTAMP_RX_INTERFACE (NSS_SPECIAL_IF_START + 55) |  | ||||||
| 		/**< Special interface number for timestamp receive. */ |  | ||||||
| #define NSS_GRE_REDIR_MARK_INTERFACE (NSS_SPECIAL_IF_START + 56) |  | ||||||
| 		/**< Special interface number for GRE redirect mark. */ |  | ||||||
| #define NSS_VXLAN_INTERFACE (NSS_SPECIAL_IF_START + 57) |  | ||||||
| 		/**< Special interface number for VxLAN handler. */ |  | ||||||
| #define NSS_RMNET_RX_INTERFACE (NSS_SPECIAL_IF_START + 58) |  | ||||||
| 		/**< Special interface number for remote wireless wide area network receive handler. */ |  | ||||||
| #define NSS_WIFILI_EXTERNAL_INTERFACE0 (NSS_SPECIAL_IF_START + 59) |  | ||||||
| 		/**< Special interface number for first external radio instance. */ |  | ||||||
| #define NSS_WIFILI_EXTERNAL_INTERFACE1 (NSS_SPECIAL_IF_START + 60) |  | ||||||
| 		/**< Special interface number for second external radio instance. */ |  | ||||||
| #define NSS_TLS_INTERFACE (NSS_SPECIAL_IF_START + 61) |  | ||||||
| 		/**< Special interface number for TLS. */ |  | ||||||
| #define NSS_PPE_VP_INTERFACE (NSS_SPECIAL_IF_START + 62) |  | ||||||
| 		/**< Special interface number for the virtual port (62, 63, 64) interface. */ |  | ||||||
| #define NSS_WIFI_MAC_DB_INTERFACE (NSS_SPECIAL_IF_START + 65) |  | ||||||
| 		/**< Special interface number for the Wi-Fi MAC database. */ |  | ||||||
| #define NSS_DMA_INTERFACE (NSS_SPECIAL_IF_START + 66) |  | ||||||
| 		/**< Special interface number for the DMA interface. */ |  | ||||||
| #define NSS_WIFI_EXT_VDEV_INTERFACE (NSS_SPECIAL_IF_START + 67) |  | ||||||
| 		/**< 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. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * General utilities |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * General callback function for all interface 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_if_rx_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_get_state |  | ||||||
|  *	Gets the NSS state. |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS state. |  | ||||||
|  */ |  | ||||||
| extern nss_state_t nss_get_state(void *nss_ctx); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Once Everything is arranged correctly, will be placed at top |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *@} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_API_IF_H */ |  | ||||||
| @@ -1,362 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2018,2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_bridge.h |  | ||||||
|  *	NSS Bridge interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_BRIDGE_H |  | ||||||
| #define __NSS_BRIDGE_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_bridge_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_msg_types |  | ||||||
|  *	Message types for the NSS bridge. |  | ||||||
|  */ |  | ||||||
| enum nss_bridge_msg_types { |  | ||||||
| 	NSS_BRIDGE_MSG_JOIN = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_BRIDGE_MSG_LEAVE, |  | ||||||
| 	NSS_BRIDGE_MSG_SET_FDB_LEARN, |  | ||||||
| 	NSS_BRIDGE_MSG_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_error_types |  | ||||||
|  *	Error types for the NSS bridge. |  | ||||||
|  */ |  | ||||||
| enum nss_bridge_error_types { |  | ||||||
| 	NSS_BRIDGE_ERROR_UNKNOWN_MSG = NSS_IF_ERROR_TYPE_MAX + 1, |  | ||||||
| 	NSS_BRIDGE_ERROR_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_fdb_learn_mode |  | ||||||
|  *	FDB learning mode for the NSS bridge. |  | ||||||
|  */ |  | ||||||
| enum nss_bridge_fdb_learn_mode { |  | ||||||
| 	NSS_BRIDGE_FDB_LEARN_ENABLE, |  | ||||||
| 	NSS_BRIDGE_FDB_LEARN_DISABLE, |  | ||||||
| 	NSS_BRIDGE_FDB_LEARN_MODE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_join_msg |  | ||||||
|  *	Information for joining the bridge. |  | ||||||
|  */ |  | ||||||
| struct nss_bridge_join_msg { |  | ||||||
| 	uint32_t if_num;	/**< NSS interface to add to a bridge. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_leave_msg |  | ||||||
|  *	Information for leaving the bridge. |  | ||||||
|  */ |  | ||||||
| struct nss_bridge_leave_msg { |  | ||||||
| 	uint32_t if_num;	/**< NSS interface to remove from a bridge. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_set_fdb_learn_msg |  | ||||||
|  *	Information for FDB learning status on bridge interface. |  | ||||||
|  */ |  | ||||||
| struct nss_bridge_set_fdb_learn_msg { |  | ||||||
| 	uint32_t mode;		/**< FDB learning mode of bridge interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_msg |  | ||||||
|  *	Data for sending and receiving bridge interface messages. |  | ||||||
|  */ |  | ||||||
| struct nss_bridge_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a bridge interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		union nss_if_msgs if_msg; |  | ||||||
| 				/**< NSS interface base message. */ |  | ||||||
| 		struct nss_bridge_join_msg br_join; |  | ||||||
| 				/**< Join the bridge. */ |  | ||||||
| 		struct nss_bridge_leave_msg br_leave; |  | ||||||
| 				/**< Leave the bridge. */ |  | ||||||
| 		struct nss_bridge_set_fdb_learn_msg fdb_learn; |  | ||||||
| 				/**< FDB learning status of bridge. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_verify_if_num |  | ||||||
|  *	Verifies if the interface is type bridge. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Interface number to be verified. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if if_num is of type bridge. |  | ||||||
|  */ |  | ||||||
| bool nss_bridge_verify_if_num(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_msg |  | ||||||
|  *	Sends bridge messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_bridge_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_bridge_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_msg_sync |  | ||||||
|  *	Sends bridge messages synchronously to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_bridge_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_bridge_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_msg_init |  | ||||||
|  *	Initializes a bridge message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_bridge_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    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. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_msg_init(struct nss_bridge_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_get_context |  | ||||||
|  *	Gets the bridge context used in nss_bridge_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving bridge 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_bridge_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving bridge messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_bridge_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_bridge_msg_callback_t)(void *app_data, struct nss_bridge_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_register |  | ||||||
|  *	Registers the bridge interface with the NSS for sending and receiving |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num          NSS interface number. |  | ||||||
|  * @param[in] netdev          Pointer to the associated network device. |  | ||||||
|  * @param[in] bridge_data_cb  Callback for the bridge data. |  | ||||||
|  * @param[in] bridge_msg_cb   Callback for the bridge message. |  | ||||||
|  * @param[in] features        Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_data        Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_register(uint32_t if_num, struct net_device *netdev, nss_bridge_callback_t bridge_data_cb, nss_bridge_msg_callback_t bridge_msg_cb, uint32_t features, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_unregister |  | ||||||
|  *	Deregisters the bridge interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_unregister(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_notify_register |  | ||||||
|  *	Registers a notifier callback for bridge messages with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_bridge_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_notify_register(nss_bridge_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_notify_unregister |  | ||||||
|  *	Deregisters a bridge message notifier callback from the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_notify_unregister(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_set_mtu_msg |  | ||||||
|  *	Sends a message to the bridge to set the MTU. |  | ||||||
|  * |  | ||||||
|  * @param[in] bridge_if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] mtu            MTU value to set. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_mtu_msg(uint32_t bridge_if_num, uint32_t mtu); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_set_mac_addr_msg |  | ||||||
|  *	Sends a message to the bridge to set the MAC address. |  | ||||||
|  * |  | ||||||
|  * @param[in] bridge_if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] addr           Pointer to the MAC address. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, uint8_t *addr); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_join_msg |  | ||||||
|  *	Sends the bridge a message to join with a slave interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] bridge_if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] netdev         Pointer to the associated network device (the |  | ||||||
|  *                           slave interface). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_join_msg(uint32_t bridge_if_num, struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_leave_msg |  | ||||||
|  *	Sends the bridge a message that the slave interface is leaving the bridge. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] bridge_if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] netdev         Pointer to the associated network device (the |  | ||||||
|  *                           slave interface). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_leave_msg(uint32_t bridge_if_num, struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_vsi_assign_msg |  | ||||||
|  *	Sends the bridge a message to assign a VSI. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] vsi     VSI to assign. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_vsi_assign_msg(uint32_t if_num, uint32_t vsi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_vsi_unassign_msg |  | ||||||
|  *	Sends the bridge a message to unassign a VSI. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] vsi     VSI to unassign. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_vsi_unassign_msg(uint32_t if_num, uint32_t vsi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_tx_set_fdb_learn_msg |  | ||||||
|  *	Sends a message to notify NSS about FDB learning enable/disable event. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_bridge_fdb_learn_mode |  | ||||||
|  * |  | ||||||
|  * @param[in] bridge_if_num  Interface number of the bridge. |  | ||||||
|  * @param[in] fdb_learn      FDB learning disable/enable. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_fdb_learn_msg(uint32_t bridge_if_num, enum nss_bridge_fdb_learn_mode fdb_learn); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_bridge_init |  | ||||||
|  *	Initializes the bridge. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_BRIDGE_H */ |  | ||||||
| @@ -1,86 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_c2c_rx.h |  | ||||||
|  *	NSS core-to-core reception interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_C2C_RX_H |  | ||||||
| #define __NSS_C2C_RX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_c2c_rx_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_rx_stats_types |  | ||||||
|  *	Core-to-core reception node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_c2c_rx_stats_types { |  | ||||||
| 	NSS_C2C_RX_STATS_PBUF_SIMPLE = NSS_STATS_NODE_MAX, |  | ||||||
| 						/**< Number of received simple pbufs. */ |  | ||||||
| 	NSS_C2C_RX_STATS_PBUF_SG,		/**< Number of scatter-gather pbufs received. */ |  | ||||||
| 	NSS_C2C_RX_STATS_PBUF_RETURNING,	/**< Number of returning scatter-gather pbufs. */ |  | ||||||
| 	NSS_C2C_RX_STATS_INVAL_DEST,		/**< Number of pbuf enqueue failures because of destination is invalid. */ |  | ||||||
| 	NSS_C2C_RX_STATS_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_rx_stats_notification |  | ||||||
|  *	Core-to-core reception statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_rx_stats_notification { |  | ||||||
| 	uint32_t core_id;			/**< Core ID. */ |  | ||||||
| 	uint64_t stats[NSS_C2C_RX_STATS_MAX];	/**< Core-to-core reception statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_c2c_rx_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_c2c_rx_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_rx_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_c2c_rx_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_RX_H */ |  | ||||||
| @@ -1,308 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_c2c_tx.h |  | ||||||
|  *	NSS core-to-core transmission interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_C2C_TX_H |  | ||||||
| #define __NSS_C2C_TX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_c2c_tx_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_msg_type |  | ||||||
|  *	Supported message types. |  | ||||||
|  */ |  | ||||||
| enum nss_c2c_tx_msg_type { |  | ||||||
| 	NSS_C2C_TX_MSG_TYPE_STATS,		/**< Statistics synchronization. */ |  | ||||||
| 	NSS_C2C_TX_MSG_TYPE_TX_MAP,		/**< Open engine synchronization. */ |  | ||||||
| 	NSS_C2C_TX_MSG_TYPE_PERFORMANCE_TEST,	/**< Performance test. */ |  | ||||||
| 	NSS_C2C_TX_MSG_TYPE_MAX			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_msg_error |  | ||||||
|  *	Message error types. |  | ||||||
|  */ |  | ||||||
| enum nss_c2c_tx_msg_error { |  | ||||||
| 	NSS_C2C_TX_MSG_ERROR_NONE,		/**< No error. */ |  | ||||||
| 	NSS_C2C_TX_MSG_ERROR_INVAL_OP,		/**< Invalid operation. */ |  | ||||||
| 	NSS_C2C_TX_MSG_ERROR_INVALID_TEST_ID,	/**< Invalid test ID. */ |  | ||||||
| 	NSS_C2C_TX_MSG_ERROR_MAX		/**< Maximum error type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_test_type |  | ||||||
|  *	Supported core-to core transmission tests. |  | ||||||
|  */ |  | ||||||
| enum nss_c2c_tx_test_type { |  | ||||||
| 	NSS_C2C_TX_TEST_TYPE_SIMPLE = 1, |  | ||||||
| 			/**< Tests the performance of simple pbufs. */ |  | ||||||
| 	NSS_C2C_TX_TEST_TYPE_SG_CHAIN, |  | ||||||
| 			/**< Tests the performance of scatter-gather chain pbufs. */ |  | ||||||
| 	NSS_C2C_TX_TEST_TYPE_SG_REF, |  | ||||||
| 			/**< Tests the performance of scatter-gather pbuf that has references. */ |  | ||||||
| 	NSS_C2C_TX_TEST_TYPE_SG_REFED, |  | ||||||
| 			/**< Tests the performance of referenced pbuf. */ |  | ||||||
| 	NSS_C2C_TX_TEST_TYPE_MAX |  | ||||||
| 			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_stats_types |  | ||||||
|  *	Core-to-core transmission node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_c2c_tx_stats_types { |  | ||||||
| 	NSS_C2C_TX_STATS_PBUF_SIMPLE = NSS_STATS_NODE_MAX, |  | ||||||
| 						/**< Number of received simple pbuf. */ |  | ||||||
| 	NSS_C2C_TX_STATS_PBUF_SG,		/**< Number of scatter-gather pbuf received. */ |  | ||||||
| 	NSS_C2C_TX_STATS_PBUF_RETURNING,	/**< Number of returning scatter-gather pbuf. */ |  | ||||||
| 	NSS_C2C_TX_STATS_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_stats_notification |  | ||||||
|  *	Core-to-core transmission statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_stats_notification { |  | ||||||
| 	uint32_t core_id;			/**< Core ID. */ |  | ||||||
| 	uint64_t stats[NSS_C2C_TX_STATS_MAX];	/**< Core-to-core transmission statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_map |  | ||||||
|  *	Core-to-core transmission queue address and interrupt address. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_map { |  | ||||||
| 	uint32_t tx_map;		/**< Peer core core-to-core receiver queue start address. */ |  | ||||||
| 	uint32_t c2c_intr_addr;		/**< Peer core core-to-core interrupt register address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_stats |  | ||||||
|  *	The NSS core-to-core transmission node statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats; |  | ||||||
| 					/**< Common node statistics for core-to-core transmissions. */ |  | ||||||
| 	uint32_t pbuf_simple;		/**< Number of received simple pbuf. */ |  | ||||||
| 	uint32_t pbuf_sg;		/**< Number of scattered/gathered pbuf received. */ |  | ||||||
| 	uint32_t pbuf_returning;	/**< Number of returning scattered/gathered pbuf. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_test |  | ||||||
|  *	Start performance test for the given test ID. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_test { |  | ||||||
| 	uint32_t test_id;		/**< ID of the core-to-core communication test. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_msg |  | ||||||
|  *	Message structure to send/receive core-to-core transmission commands. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_msg { |  | ||||||
| 	struct nss_cmn_msg cm;			/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a NSS core-to-core transmission rule or statistics message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_c2c_tx_map map;	/**< Core-to-core transmissions memory map. */ |  | ||||||
| 		struct nss_c2c_tx_stats stats;	/**< Core-to-core transmissions statistics. */ |  | ||||||
| 		struct nss_c2c_tx_test test;	/**< Core-to-core performance test. */ |  | ||||||
| 	} msg;					/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_register_handler |  | ||||||
|  *	Registers the core-to-core transmissions message handler. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_register_handler(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving core-to-core transmissions messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_c2c_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_c2c_tx_msg_callback_t)(void *app_data, struct nss_c2c_tx_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_tx_msg |  | ||||||
|  *	Transmits a core-to-core transmissions message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_c2c_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] nctm      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_c2c_tx_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_c2c_tx_msg *nctm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_msg_init |  | ||||||
|  *	Initializes core-to-core transmissions messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_c2c_tx_msg \n |  | ||||||
|  * nss_c2c_tx_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in]     nct       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_c2c_tx_msg_init(struct nss_c2c_tx_msg *nct, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 			nss_c2c_tx_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_notify_register |  | ||||||
|  *	Registers a notifier callback for core-to-core transmission messages with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_c2c_tx_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] core      NSS core number index to the notifier callback table. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_c2c_tx_notify_register(int core, nss_c2c_tx_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_notify_unregister |  | ||||||
|  *	Deregisters a core-to-core transmission message notifier callback from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] core NSS core number index to the notifier callback table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The notifier callback must have been previously registered. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_notify_unregister(int core); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_msg_cfg_map |  | ||||||
|  *	Sends core-to-core transmissions map to NSS |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] tx_map    Peer core core-to-core receiver queue start address. |  | ||||||
|  * @param[in] c2c_addr  Peer core core-to-core interrupt register address. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_c2c_tx_msg_cfg_map(struct nss_ctx_instance *nss_ctx, uint32_t tx_map, uint32_t c2c_addr); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_register_sysctl |  | ||||||
|  *     Registers the core-to-core transmission sysctl entries to the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_c2c_tx_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_unregister_sysctl |  | ||||||
|  *     Deregisters the core-to-core transmission sysctl entries from the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_c2c_tx_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_init |  | ||||||
|  *	Initializes the core-to-core transmission. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_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_c2c_tx_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_c2c_tx_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_c2c_tx_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_TX_H */ |  | ||||||
| @@ -1,659 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_capwap.h |  | ||||||
|  *	NSS CAPWAP interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_CAPWAP_H |  | ||||||
| #define __NSS_CAPWAP_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_capwap_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Size of the headroom required for CAPWAP packets. |  | ||||||
|  */ |  | ||||||
| #define NSS_CAPWAP_HEADROOM 256 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_stats_encap_types |  | ||||||
|  *	CAPWAP encapsulation statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_capwap_stats_encap_types { |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_PKTS, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_BYTES, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_SEGMENTS, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_SG_REF, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_VER_MISMATCH, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_UNALIGN, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_HEADER_ROOM, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_DTLS, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_NWIRELESS, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_QUEUE_FULL, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_TX_DROP_MEM_FAIL, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_FAST_MEM, |  | ||||||
| 	NSS_CAPWAP_STATS_ENCAP_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_stats_decap_types |  | ||||||
|  *	CAPWAP decapsulation statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_capwap_stats_decap_types { |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_PKTS, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_BYTES, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DTLS_PKTS, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_SEGMENTS, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_OVERSIZE, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_FRAG_TIMEOUT, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_DUP_FRAG, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_FRAG_GAP, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_QUEUE_FULL, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_N2H_QUEUE_FULL, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_MEM_FAIL, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_DROP_CHECKSUM, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_RX_MALFORMED, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_FAST_MEM, |  | ||||||
| 	NSS_CAPWAP_STATS_DECAP_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_msg_type |  | ||||||
|  *	CAPWAP message types. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_capwap_msg_type { |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_NONE, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_CFG_RULE, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_UNCFG_RULE, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_DISABLE_TUNNEL, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_UPDATE_PATH_MTU, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_SYNC_STATS, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_VERSION,		/**< Default is version 1. */ |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_DTLS, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_FLOW_RULE_ADD, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_FLOW_RULE_DEL, |  | ||||||
| 	NSS_CAPWAP_MSG_TYPE_MAX, |  | ||||||
| } nss_capwap_msg_type_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_msg_response |  | ||||||
|  *	Error types for CAPWAP responses to messages from the host. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_capwap_msg_response { |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_REASSEMBLY_TIMEOUT, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_PATH_MTU, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_MAX_FRAGMENT, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_BUFFER_SIZE, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_L3_PROTO, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_UDP_PROTO, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_VERSION, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_TUNNEL_DISABLED, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_TUNNEL_ENABLED, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_TUNNEL_NOT_CFG, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_IP_NODE, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_TYPE_FLAG, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_INVALID_DTLS_CFG, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_FLOW_TABLE_FULL, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_FLOW_EXIST, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_FLOW_NOT_EXIST, |  | ||||||
| 	NSS_CAPWAP_ERROR_MSG_MAX, |  | ||||||
| } nss_capwap_msg_response_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_stats_msg |  | ||||||
|  *	Per-tunnel statistics messages from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats pnode_stats;	/**< Common firmware statistics. */ |  | ||||||
| 	uint32_t dtls_pkts;		/**< Number of DTLS packets flowing through. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Rx/decap stats |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t rx_dup_frag;		/**< Number of duplicate fragments. */ |  | ||||||
| 	uint32_t rx_segments;		/**< Number of segments or fragments. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Packets dropped because they are larger than the payload size. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t rx_oversize_drops; |  | ||||||
|  |  | ||||||
| 	uint32_t rx_frag_timeout_drops; |  | ||||||
| 			/**< Packets dropped because of a reassembly timeout. */ |  | ||||||
| 	uint32_t rx_n2h_drops; |  | ||||||
| 			/**< Packets dropped because of error in packet processing. */ |  | ||||||
| 	uint32_t rx_n2h_queue_full_drops; |  | ||||||
| 			/**< Packets dropped because the NSS-to-host queue is full. */ |  | ||||||
| 	uint32_t rx_csum_drops; |  | ||||||
| 			/**< Packets dropped because of a checksum mismatch. */ |  | ||||||
| 	uint32_t rx_malformed; |  | ||||||
| 			/**< Packets dropped because of a malformed packet. */ |  | ||||||
| 	uint32_t rx_mem_failure_drops; |  | ||||||
| 			/**< Packets dropped because of a memory failure. */ |  | ||||||
| 	uint32_t rx_frag_gap_drops; |  | ||||||
| 			/**< Packets dropped because of a non-sequential fragment offset. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Tx/encap stats |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t tx_segments;		/**< Number of segments or fragments. */ |  | ||||||
| 	uint32_t tx_queue_full_drops;	/**< Packets dropped because of a full queue. */ |  | ||||||
| 	uint32_t tx_mem_failure_drops; |  | ||||||
| 			/**< Packets dropped because of a memory failure. */ |  | ||||||
| 	uint32_t tx_dropped_sg_ref; |  | ||||||
| 			/**< Packets dropped because of a scatter-gather reference. */ |  | ||||||
| 	uint32_t tx_dropped_ver_mis; |  | ||||||
| 			/**< Packets dropped because of a version mismatch. */ |  | ||||||
| 	uint32_t Reserved; |  | ||||||
| 			/**< Reserved. */ |  | ||||||
| 	uint32_t tx_dropped_hroom; |  | ||||||
| 			/**< Packets dropped because of insufficent headroom. */ |  | ||||||
| 	uint32_t tx_dropped_dtls; |  | ||||||
| 			/**< Packets dropped because of a DTLS packet. */ |  | ||||||
| 	uint32_t tx_dropped_nwireless; |  | ||||||
| 			/**< Packets dropped because the nwireless field information is wrong. */ |  | ||||||
|  |  | ||||||
| 	uint32_t fast_mem; |  | ||||||
| 			/**< Set to 1 when tunnel is operating in fast memory. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_ip |  | ||||||
|  *	IP versions. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_ip { |  | ||||||
| 	/** |  | ||||||
| 	 * Union of IPv4 and IPv6 IP addresses. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		uint32_t ipv4;		/**< IPv4 address. */ |  | ||||||
| 		uint32_t ipv6[4];	/**< IPv6 address. */ |  | ||||||
| 	} ip;		/**< Union of IPv4 and IPv6 IP addresses. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_encap_rule |  | ||||||
|  *	Encapsulation information for a CAPWAP tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_encap_rule { |  | ||||||
| 	struct  nss_capwap_ip src_ip;	/**< Source IP. */ |  | ||||||
| 	uint32_t src_port;		/**< Source port. */ |  | ||||||
| 	struct nss_capwap_ip dest_ip;	/**< Destination IP. */ |  | ||||||
| 	uint32_t dest_port;		/**< Destination port. */ |  | ||||||
| 	uint32_t path_mtu;		/**< MTU on the path. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_decap_rule |  | ||||||
|  *	Decapsulation information for a CAPWAP tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_decap_rule { |  | ||||||
| 	uint32_t reassembly_timeout;	/**< Timeout in milliseconds. */ |  | ||||||
| 	uint32_t max_fragments;		/**< Maximum number of fragments expected. */ |  | ||||||
| 	uint32_t max_buffer_size;	/**< Maximum size of the payload buffer. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_rule_msg |  | ||||||
|  *	CAPWAP rule message. |  | ||||||
|  * |  | ||||||
|  * The same rule structure applies for both encapsulation and decapsulation |  | ||||||
|  * in a tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_rule_msg { |  | ||||||
| 	struct nss_capwap_encap_rule encap;	/**< Encapsulation portion of the rule. */ |  | ||||||
| 	struct nss_capwap_decap_rule decap;	/**< Decapsulation portion of the rule. */ |  | ||||||
| 	uint32_t stats_timer;	/**< Statistics interval timer in milliseconds. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Core to choose for receiving packets. |  | ||||||
| 	 * |  | ||||||
| 	 * Set to -1 for the NSS firmware to decide. |  | ||||||
| 	 */ |  | ||||||
| 	int8_t rps; |  | ||||||
|  |  | ||||||
| 	uint8_t type_flags;		/**< VLAN or PPPOE is configured. */ |  | ||||||
| 	uint8_t l3_proto; |  | ||||||
| 			/**< Prototype is NSS_CAPWAP_TUNNEL_IPV4 or NSS_CAPWAP_TUNNEL_IPV6. */ |  | ||||||
| 	uint8_t which_udp;		/**< Tunnel uses the UDP or UDPLite protocol. */ |  | ||||||
| 	uint32_t mtu_adjust;	/**< MTU is reserved for a DTLS process. */ |  | ||||||
| 	uint32_t gmac_ifnum;	/**< Outgoing physical interface. */ |  | ||||||
| 	uint32_t enabled_features; |  | ||||||
| 			/**< Tunnel enabled features bit flag. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Parameters for each features |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t dtls_inner_if_num;	/**< Interface number of the associated DTLS node. */ |  | ||||||
| 	uint8_t bssid[ETH_ALEN];	/**< BSSID value. */ |  | ||||||
| 	uint16_t outer_sgt_value; |  | ||||||
| 			/**< Security Group Tag value configured for this tunnel. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_version_msg |  | ||||||
|  *	Message to set the CAPWAP version. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_version_msg { |  | ||||||
| 	uint32_t version;	/**< CAPWAP protocol version. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_path_mtu_msg |  | ||||||
|  *	Message information for the path MTU. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_path_mtu_msg { |  | ||||||
| 	uint32_t path_mtu;	/**< Path MTU value between the controller and access point. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_dtls_msg |  | ||||||
|  *	DTLS message information. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_dtls_msg { |  | ||||||
| 	uint32_t enable;			/**< Enable or disable DTLS. */ |  | ||||||
| 	uint32_t dtls_inner_if_num;	/**< Interface number of the associated DTLS. */ |  | ||||||
| 	uint32_t mtu_adjust;		/**< MTU adjustment reported by the DTLS node. */ |  | ||||||
| 	uint32_t reserved;			/**< Reserved field for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_flow_rule_msg |  | ||||||
|  *	CAPWAP flow rule message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_flow_rule_msg { |  | ||||||
| 	/* |  | ||||||
| 	 * 5-tuple info. |  | ||||||
| 	 */ |  | ||||||
| 	uint16_t ip_version;            /**< IP version. */ |  | ||||||
| 	uint16_t protocol;              /**< Layer 4 protocol. */ |  | ||||||
| 	uint16_t src_port;		/**< Source port. */ |  | ||||||
| 	uint16_t dst_port;		/**< Destination port. */ |  | ||||||
| 	uint32_t src_ip[4];		/**< Source IP address. */ |  | ||||||
| 	uint32_t dst_ip[4];		/**< Destination IP address. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Flow attributes. |  | ||||||
| 	 */ |  | ||||||
| 	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 |  | ||||||
|  *	Data for sending and receiving CAPWAP messages. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a CAPWAP common message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_capwap_rule_msg rule; |  | ||||||
| 				/**< Rule information. */ |  | ||||||
| 		struct nss_capwap_path_mtu_msg mtu; |  | ||||||
| 				/**< New MTU information. */ |  | ||||||
| 		struct nss_capwap_stats_msg stats; |  | ||||||
| 				/**< CAPWAP statistics. */ |  | ||||||
| 		struct nss_capwap_version_msg version; |  | ||||||
| 				/**< CAPWAP version to use. */ |  | ||||||
| 		struct nss_capwap_dtls_msg dtls; |  | ||||||
| 				/**< DTLS configuration. */ |  | ||||||
| 		struct nss_capwap_flow_rule_msg flow_rule_add; |  | ||||||
| 				/**< Flow rule add message. */ |  | ||||||
| 		struct nss_capwap_flow_rule_msg flow_rule_del; |  | ||||||
| 				/**< Flow rule delete message. */ |  | ||||||
| 		struct nss_capwap_enable_tunnel_msg enable_tunnel; |  | ||||||
| 				/**< Enable tunnel message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_pn_stats |  | ||||||
|  *	Pnode statistics (64-bit version). |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_pn_stats { |  | ||||||
| 	uint64_t rx_packets;		/**< Number of packets received. */ |  | ||||||
| 	uint64_t rx_bytes;		/**< Number of bytes received. */ |  | ||||||
| 	uint64_t rx_dropped;		/**< Number of dropped Rx packets. */ |  | ||||||
| 	uint64_t tx_packets;		/**< Number of packets transmitted. */ |  | ||||||
| 	uint64_t tx_bytes;		/**< Number of bytes transmitted. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_tunnel_stats |  | ||||||
|  *	Per-tunnel statistics seen by the HLOS. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_tunnel_stats { |  | ||||||
| 	struct nss_capwap_pn_stats pnode_stats;	/**< Common firmware statistics. */ |  | ||||||
| 	uint64_t dtls_pkts;		/**< Number of DTLS packets flowing through. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Rx/decap stats |  | ||||||
| 	 */ |  | ||||||
| 	uint64_t rx_dup_frag;		/**< Number of duplicate fragments. */ |  | ||||||
| 	uint64_t rx_segments;		/**< Number of segments or fragments. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Packets dropped because they are larger than the payload size. |  | ||||||
| 	 */ |  | ||||||
| 	uint64_t rx_oversize_drops; |  | ||||||
|  |  | ||||||
| 	uint64_t rx_frag_timeout_drops; |  | ||||||
| 			/**< Packets dropped because of a reassembly timeout. */ |  | ||||||
| 	uint64_t rx_n2h_drops; |  | ||||||
| 			/**< Packets dropped because of error in processing the packet. */ |  | ||||||
| 	uint64_t rx_n2h_queue_full_drops; |  | ||||||
| 			/**< Packets dropped because the NSS-to-host queue is full. */ |  | ||||||
| 	uint64_t rx_csum_drops; |  | ||||||
| 			/**< Packets dropped because of a checksum mismatch. */ |  | ||||||
| 	uint64_t rx_malformed; |  | ||||||
| 			/**< Packets dropped because of a malformed packet. */ |  | ||||||
| 	uint64_t rx_mem_failure_drops; |  | ||||||
| 			/**< Packets dropped because of a memory failure. */ |  | ||||||
| 	uint64_t rx_frag_gap_drops; |  | ||||||
| 			/**< Packets dropped because of a non-sequential fragment offset. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * 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_queue_full_drops; |  | ||||||
| 			/**< Packets dropped because the queue is full. */ |  | ||||||
| 	uint64_t tx_mem_failure_drops; |  | ||||||
| 			/**< Packets dropped because of a memory failure. */ |  | ||||||
|  |  | ||||||
| 	uint64_t tx_dropped_sg_ref; |  | ||||||
| 			/**< Packets dropped because of a scatter-gather reference. */ |  | ||||||
| 	uint64_t tx_dropped_ver_mis; |  | ||||||
| 			/**< Packets dropped because of a version mismatch. */ |  | ||||||
| 	uint64_t Reserved; |  | ||||||
| 			/**< Reserved. */ |  | ||||||
| 	uint64_t tx_dropped_hroom; |  | ||||||
| 			/**< Packets dropped because of insufficent headroom. */ |  | ||||||
| 	uint64_t tx_dropped_dtls; |  | ||||||
| 			/**< Packets dropped because of a DTLS packet. */ |  | ||||||
| 	uint64_t tx_dropped_nwireless; |  | ||||||
| 			/**< Packets dropped because the nwireless field information is wrong. */ |  | ||||||
|  |  | ||||||
| 	uint32_t fast_mem; |  | ||||||
| 			/**< Set to 1 when tunnel is operating in fast memory. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_stats_notification |  | ||||||
|  *	CAPWAP statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_capwap_stats_notification { |  | ||||||
| 	uint32_t core_id;			/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;			/**< Interface number. */ |  | ||||||
| 	struct nss_capwap_tunnel_stats stats;	/**< Per-tunnel statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving CAPWAP tunnel 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_capwap_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving CAPWAP tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_capwap_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_capwap_msg_callback_t)(void *app_data, struct nss_capwap_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_data_register |  | ||||||
|  *	Registers the CAPWAP tunnel interface with the NSS for sending and |  | ||||||
|  *	receiving tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_capwap_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num           NSS interface number. |  | ||||||
|  * @param[in] capwap_callback  Callback for the CAPWAP tunnel data. |  | ||||||
|  * @param[in] netdev           Pointer to the associated network device. |  | ||||||
|  * @param[in] features         Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_capwap_data_register(uint32_t if_num, nss_capwap_buf_callback_t capwap_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_tx_msg |  | ||||||
|  *	Sends CAPWAP tunnel messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_capwap_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_capwap_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_capwap_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_tx_buf |  | ||||||
|  *	Sends a CAPWAP tunnel data buffer to the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS data buffer. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_capwap_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_data_unregister |  | ||||||
|  *	Deregisters the CAPWAP tunnel interface from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern bool nss_capwap_data_unregister(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_notify_register |  | ||||||
|  *	Registers an event callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_capwap_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_capwap_notify_register(uint32_t if_num, nss_capwap_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_notify_unregister |  | ||||||
|  *	Deregisters a message notifier from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The message notifier must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_capwap_notify_unregister(struct nss_ctx_instance *ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_get_ctx |  | ||||||
|  *	Gets the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_capwap_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_ifnum_with_core_id |  | ||||||
|  *	Gets the CAPWAP interface number with the core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int nss_capwap_ifnum_with_core_id(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_get_max_buf_size |  | ||||||
|  *	Gets the NSS maximum buffer size. |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Maximum buffer size of this NSS core. |  | ||||||
|  */ |  | ||||||
| extern uint32_t nss_capwap_get_max_buf_size(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_get_stats |  | ||||||
|  *	Gets per-tunnel statistics. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_capwap_tunnel_stats |  | ||||||
|  * |  | ||||||
|  * @param[in]  if_num  NSS interface number. |  | ||||||
|  * @param[out] stats   Pointer to the CAPWAP tunnel statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  */ |  | ||||||
| extern bool nss_capwap_get_stats(uint32_t if_num, struct nss_capwap_tunnel_stats *stats); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_init |  | ||||||
|  *	Initializes the CAPWAP interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_capwap_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_msg_init |  | ||||||
|  *	Initializes a CAPWAP message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_capwap_msg \n |  | ||||||
|  * nss_capwap_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the 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_capwap_msg_init(struct nss_capwap_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 								nss_capwap_msg_callback_t cb, void *app_data); |  | ||||||
| /** |  | ||||||
|  * nss_capwap_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_capwap_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_capwap_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_capwap_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __KERNEL__ */ |  | ||||||
| #endif /* __NSS_CAPWAP_H */ |  | ||||||
| @@ -1,390 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_clmap.h |  | ||||||
|  *	NSS client map interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_CLMAP_H |  | ||||||
| #define __NSS_CLMAP_H |  | ||||||
|  |  | ||||||
|  /** |  | ||||||
|   * @addtogroup nss_clmap_subsystem |  | ||||||
|   * @{ |  | ||||||
|   */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported client map interface. |  | ||||||
|  */ |  | ||||||
| #define NSS_CLMAP_MAX_INTERFACES 1 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_msg_type |  | ||||||
|  *	Client map message types. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_clmap_msg_type { |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_SYNC_STATS,		/**< Statistics synchronization message. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_INTERFACE_ENABLE,	/**< Enable the interface. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_INTERFACE_DISABLE,	/**< Disable the interface. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_MAC_ADD,		/**< Add MAC rule to the database. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_MAC_DEL,		/**< Remove MAC rule from the database. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_MAC_FLUSH,		/**< Flush all the MAC rules for a tunnel. */ |  | ||||||
| 	NSS_CLMAP_MSG_TYPE_MAX,			/**< Maximum message type. */ |  | ||||||
| } nss_clmap_msg_type_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_error_types |  | ||||||
|  *	Error types for client map responses to messages from the host. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_clmap_error_types { |  | ||||||
| 	NSS_CLMAP_ERROR_UNKNOWN_TYPE = 1,	/**< Unknown type error. */ |  | ||||||
| 	NSS_CLMAP_ERROR_INTERFACE_DISABLED,	/**< Interface is already disabled. */ |  | ||||||
| 	NSS_CLMAP_ERROR_INTERFACE_ENABLED,	/**< Interface is already enabled. */ |  | ||||||
| 	NSS_CLMAP_ERROR_INVALID_VLAN,		/**< Invalid VLAN. */ |  | ||||||
| 	NSS_CLMAP_ERROR_INVALID_TUNNEL,		/**< Invalid tunnel. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_TABLE_FULL,		/**< MAC table is full. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_EXIST,		/**< MAC does already exist in the table. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_NOT_EXIST,		/**< MAC does not exist in the table. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_ENTRY_UNHASHED,	/**< MAC entry is not hashed in table. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_ENTRY_INSERT_FAILED, |  | ||||||
| 						/**< Insertion into MAC table failed. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_ENTRY_ALLOC_FAILED,	/**< MAC entry allocation failed. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAC_ENTRY_DELETE_FAILED,/**< MAC entry deletion failed. */ |  | ||||||
| 	NSS_CLMAP_ERROR_MAX,			/**< Maximum error type. */ |  | ||||||
| } 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 |  | ||||||
|  *	Per-interface statistics messages from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_clmap_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;		/**< Common firmware statistics. */ |  | ||||||
| 	uint32_t dropped_macdb_lookup_failed;		/**< Dropped due to MAC database look up failed. */ |  | ||||||
| 	uint32_t dropped_invalid_packet_size;		/**< Dropped due to invalid size packets. */ |  | ||||||
| 	uint32_t dropped_low_hroom;			/**< Dropped due to insufficent headroom. */ |  | ||||||
| 	uint32_t dropped_next_node_queue_full;		/**< Dropped due to next node queue full. */ |  | ||||||
| 	uint32_t dropped_pbuf_alloc_failed;		/**< Dropped due to buffer allocation failure. */ |  | ||||||
| 	uint32_t dropped_linear_failed;			/**< Dropped due to linear copy failure. */ |  | ||||||
| 	uint32_t shared_packet_count;			/**< Shared packet count. */ |  | ||||||
| 	uint32_t ethernet_frame_error;			/**< Ethernet frame error count. */ |  | ||||||
| 	uint32_t macdb_create_requests;			/**< MAC database create requests count. */ |  | ||||||
| 	uint32_t macdb_create_mac_exists;		/**< MAC database create failures, MAC exist count. */ |  | ||||||
| 	uint32_t macdb_create_table_full;		/**< MAC database create failures, MAC database full count. */ |  | ||||||
| 	uint32_t macdb_destroy_requests;		/**< MAC database destroy requests count. */ |  | ||||||
| 	uint32_t macdb_destroy_mac_notfound;		/**< MAC database destroy failures, MAC not found count. */ |  | ||||||
| 	uint32_t macdb_destroy_mac_unhashed;		/**< MAC database destroy failures, MAC unhashed count. */ |  | ||||||
| 	uint32_t macdb_flush_requests;			/**< MAC database flush requests count. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_mac_msg |  | ||||||
|  *	Client map MAC message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_clmap_mac_msg { |  | ||||||
| 	uint32_t vlan_id;			/**< VLAN ID. */ |  | ||||||
| 	uint32_t nexthop_ifnum;			/**< Next hop interface number. */ |  | ||||||
| 	uint32_t needed_headroom;			/**< Headroom to be added. */ |  | ||||||
| 	uint16_t mac_addr[3];			/**< MAC address. */ |  | ||||||
| 	uint8_t flags;				/**< Flags that carry metadata information. */ |  | ||||||
| 	uint8_t reserved;			/**< Reserved. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_flush_mac_msg |  | ||||||
|  *	CLient flush map MAC message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_clmap_flush_mac_msg { |  | ||||||
| 	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 |  | ||||||
|  *	Data for sending and receiving client map messages. |  | ||||||
|  */ |  | ||||||
| struct nss_clmap_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a client map common message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_clmap_stats_msg stats; |  | ||||||
| 				/**< Client map statistics. */ |  | ||||||
| 		struct nss_clmap_mac_msg mac_add; |  | ||||||
| 				/**< MAC rule add message. */ |  | ||||||
| 		struct nss_clmap_mac_msg mac_del; |  | ||||||
| 				/**< MAC rule delete message. */ |  | ||||||
| 		struct nss_clmap_flush_mac_msg mac_flush; |  | ||||||
| 				/**< MAC rule flush message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving client map 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_clmap_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving client map 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_clmap_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_tx_msg |  | ||||||
|  *	Sends client map messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_clmap_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_clmap_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_clmap_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_tx_msg_sync |  | ||||||
|  *	Sends client map messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_clmap_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_clmap_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_clmap_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_tx_buf |  | ||||||
|  *	Sends a client map data buffer to the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] buf   Pointer to the data buffer. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_clmap_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *buf, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_unregister |  | ||||||
|  *	Deregisters the client map interface from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern bool nss_clmap_unregister(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_register |  | ||||||
|  *	Registers the client map interface with the NSS for sending and |  | ||||||
|  *	receiving interface messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_clmap_msg_callback_t \n |  | ||||||
|  * nss_clmap_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num                    NSS interface number. |  | ||||||
|  * @param[in] dynamic_interface_type    NSS interface type. |  | ||||||
|  * @param[in] data_cb                   Data callback for the client map data. |  | ||||||
|  * @param[in] notify_cb                 Notify callback for the client map data. |  | ||||||
|  * @param[in] netdev                    Pointer to the associated network device. |  | ||||||
|  * @param[in] features                  Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_clmap_register(uint32_t if_num, uint32_t dynamic_interface_type, |  | ||||||
| 			nss_clmap_buf_callback_t data_cb, nss_clmap_msg_callback_t notify_cb, |  | ||||||
| 			struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_get_ctx |  | ||||||
|  *	Get the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_clmap_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_ifnum_with_core_id |  | ||||||
|  *	Gets the client map interface number with the core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int nss_clmap_ifnum_with_core_id(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_init |  | ||||||
|  *	Initializes the client map interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_clmap_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_clmap_msg_init |  | ||||||
|  *	Initializes a client map message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_clmap_msg \n |  | ||||||
|  * nss_clmap_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the 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_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_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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_CLMAP_H */ |  | ||||||
| @@ -1,478 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014, 2016-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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_cmn.h |  | ||||||
|  *	NSS Common Message Structure and APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_CMN_H |  | ||||||
| #define __NSS_CMN_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_common_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * 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 |  | ||||||
|  *	Forward declaration for structure that contains instance data for each |  | ||||||
|  *	NSS core. Contents of structure are private to the NSS driver. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * The first 8 bits of an interfaces number is representing the core_id, |  | ||||||
|  * 0 means local core. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_CORE_ID_SHIFT 24		/**< Number of bits to shift a core local interface number. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Macro that appends the core identifier to an interface number. |  | ||||||
|  */ |  | ||||||
| #define NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, interface) ((interface) | ((nss_ctx->id + 1) << NSS_CORE_ID_SHIFT)) |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Macro to obtain a core local interface number. |  | ||||||
|  */ |  | ||||||
| #define NSS_INTERFACE_NUM_GET(interface) ((interface) & 0xffffff) |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Macro to obtain an interface core number. |  | ||||||
|  */ |  | ||||||
| #define NSS_INTERFACE_NUM_GET_COREID(interface) ((interface >> NSS_CORE_ID_SHIFT) & 0xff) |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Common enumerations. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tx_status_t |  | ||||||
|  *	Tx command failure results. |  | ||||||
|  * |  | ||||||
|  * Types starting with NSS_TX_FAILURE_SYNC_ are only used by synchronous messages. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_TX_SUCCESS = 0, |  | ||||||
| 	NSS_TX_FAILURE, |  | ||||||
| 	NSS_TX_FAILURE_QUEUE, |  | ||||||
| 	NSS_TX_FAILURE_NOT_READY, |  | ||||||
| 	NSS_TX_FAILURE_TOO_LARGE, |  | ||||||
| 	NSS_TX_FAILURE_TOO_SHORT, |  | ||||||
| 	NSS_TX_FAILURE_NOT_SUPPORTED, |  | ||||||
| 	NSS_TX_FAILURE_BAD_PARAM, |  | ||||||
| 	NSS_TX_FAILURE_NOT_ENABLED, |  | ||||||
| 	NSS_TX_FAILURE_SYNC_BAD_PARAM, |  | ||||||
| 	NSS_TX_FAILURE_SYNC_TIMEOUT, |  | ||||||
| 	NSS_TX_FAILURE_SYNC_FW_ERR, |  | ||||||
| 	NSS_TX_FAILURE_MAX, |  | ||||||
| } nss_tx_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_state_t |  | ||||||
|  *	Initialization states. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_STATE_UNINITIALIZED = 0, |  | ||||||
| 	NSS_STATE_INITIALIZED |  | ||||||
| } nss_state_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_core_id_t |  | ||||||
|  *	NSS core IDs. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_CORE_0 = 0, |  | ||||||
| 	NSS_CORE_1, |  | ||||||
| 	NSS_CORE_MAX |  | ||||||
| } nss_core_id_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cb_register_status_t |  | ||||||
|  *	Callback registration states. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_CB_REGISTER_SUCCESS = 0, |  | ||||||
| 	NSS_CB_REGISTER_FAILED, |  | ||||||
| } nss_cb_register_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cb_unregister_status_t |  | ||||||
|  *	Callback deregistration states. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_CB_UNREGISTER_SUCCESS = 0, |  | ||||||
| 	NSS_CB_UNREGISTER_FAILED, |  | ||||||
| } nss_cb_unregister_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_response |  | ||||||
|  *	Responses for a common message. |  | ||||||
|  */ |  | ||||||
| enum nss_cmn_response { |  | ||||||
| 	NSS_CMN_RESPONSE_ACK, |  | ||||||
| 	NSS_CMN_RESPONSE_EVERSION, |  | ||||||
| 	NSS_CMN_RESPONSE_EINTERFACE, |  | ||||||
| 	NSS_CMN_RESPONSE_ELENGTH, |  | ||||||
| 	NSS_CMN_RESPONSE_EMSG, |  | ||||||
| 	NSS_CMN_RESPONSE_NOTIFY, |  | ||||||
| 	NSS_CMN_RESPONSE_LAST |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Array of log messages for common NSS responses. |  | ||||||
|  */ |  | ||||||
| extern int8_t *nss_cmn_response_str[NSS_CMN_RESPONSE_LAST]; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_msg |  | ||||||
|  *	Common message information. |  | ||||||
|  */ |  | ||||||
| struct nss_cmn_msg { |  | ||||||
| 	uint16_t version;	/**< Version ID for the main message format. */ |  | ||||||
| 	uint16_t len;		/**< Length of the message, excluding the header. */ |  | ||||||
| 	uint32_t interface;	/**< Primary key for all messages. */ |  | ||||||
| 	enum nss_cmn_response response; |  | ||||||
| 			/**< Primary response. All messages must specify one of these responses. */ |  | ||||||
|  |  | ||||||
| 	uint32_t type;	/**< Decentralized request number used to match response numbers. */ |  | ||||||
| 	uint32_t error;	/**< Decentralized specific error message (response == EMSG). */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Padding used to start the callback from a 64-bit boundary. This field can be reused. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t reserved; |  | ||||||
|  |  | ||||||
| 	nss_ptr_t cb;		/**< Contains the callback pointer. */ |  | ||||||
| #ifndef __LP64__ |  | ||||||
| 	uint32_t padding1;	/**< Padding used to fit 64 bits. Do not reuse. */ |  | ||||||
| #endif |  | ||||||
| 	nss_ptr_t app_data;	/**< Contains the application data. */ |  | ||||||
| #ifndef __LP64__ |  | ||||||
| 	uint32_t padding2;	/**< Padding used to fit 64 bits. Do not reuse. */ |  | ||||||
| #endif |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_node_stats |  | ||||||
|  *	Common per-node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_cmn_node_stats { |  | ||||||
| 	uint32_t rx_packets;			/**< Number of packets received. */ |  | ||||||
| 	uint32_t rx_bytes;			/**< Number of bytes received. */ |  | ||||||
| 	uint32_t tx_packets;			/**< Number of packets transmitted. */ |  | ||||||
| 	uint32_t tx_bytes;			/**< Number of bytes transmitted. */ |  | ||||||
| 	uint32_t rx_dropped[NSS_MAX_NUM_PRI];	/**< Packets dropped on receive due to queue full. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_msg_len |  | ||||||
|  *	Gets the message length of a host-to-NSS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_cmn_get_msg_len |  | ||||||
|  * |  | ||||||
|  * @param[in] ncm  Pointer to the common message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Length of the message specified in the argument to this function. |  | ||||||
|  */ |  | ||||||
| static inline uint32_t nss_cmn_get_msg_len(struct nss_cmn_msg *ncm) |  | ||||||
| { |  | ||||||
| 	return ncm->len + sizeof(struct nss_cmn_msg); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only for kernel to use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_msg_init |  | ||||||
|  *	Initializes the common area of an asynchronous host-to-NSS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the common message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the callback function. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context for this message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_cmn_msg_init(struct nss_cmn_msg *ncm, uint32_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 	void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_msg_sync_init |  | ||||||
|  *	Initializes the common message of a synchronous host-to-NSS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm     Pointer to the common message. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * @param[in]     type    Type of message. |  | ||||||
|  * @param[in]     len     Size of the payload. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_cmn_msg_sync_init(struct nss_cmn_msg *ncm, uint32_t if_num, uint32_t type,  uint32_t len); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_interface_number |  | ||||||
|  *	Gets the interface number. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] dev      Pointer to the OS network device pointer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_cmn_get_interface_number(struct nss_ctx_instance *nss_ctx, struct net_device *dev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_interface_number_by_dev |  | ||||||
|  *	Gets the interface number of a device. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] dev  Pointer to the OS network device pointer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number, or -1 on failure. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_cmn_get_interface_number_by_dev(struct net_device *dev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_interface_number_by_dev_and_type |  | ||||||
|  *	Gets the interface number by a device and its type. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] dev   Pointer to the OS network device pointer. |  | ||||||
|  * @param[in] type  Type of this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number, or -1 on failure. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_cmn_get_interface_number_by_dev_and_type(struct net_device *dev, uint32_t type); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_interface_is_redirect |  | ||||||
|  *	Determines if the interface number is a redirect interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx        Pointer to the NSS context. |  | ||||||
|  * @param[in] interface_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE if the number is a redirect interface. Otherwise FALSE. |  | ||||||
|  */ |  | ||||||
| extern bool nss_cmn_interface_is_redirect(struct nss_ctx_instance *nss_ctx, int32_t interface_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_append_core_id |  | ||||||
|  * 	Append core ID on NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with core ID. |  | ||||||
|  */ |  | ||||||
| extern int nss_cmn_append_core_id(struct nss_ctx_instance *nss_ctx, int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_interface_dev |  | ||||||
|  *	Gets an interface device pointer. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface device pointer. |  | ||||||
|  */ |  | ||||||
| extern struct net_device *nss_cmn_get_interface_dev(struct nss_ctx_instance *nss_ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_state |  | ||||||
|  *	Obtains the NSS state. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS state that indicates whether the NSS core is initialized. For possible values, see nss_state_t. |  | ||||||
|  */ |  | ||||||
| extern nss_state_t nss_cmn_get_state(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for queue decongestion messages. |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context for this message. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_cmn_queue_decongestion_callback_t)(void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_register_queue_decongestion |  | ||||||
|  *	Registers a queue for a decongestion event. |  | ||||||
|  * |  | ||||||
|  * The callback function is called with the spinlock held. The function should avoid deadlocks |  | ||||||
|  * caused by attempting to acquire multiple spinlocks. |  | ||||||
|  |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_cmn_queue_decongestion_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx         Pointer to the NSS context. |  | ||||||
|  * @param[in]     event_callback  Callback for the message. |  | ||||||
|  * @param[in]     app_data        Pointer to the application context to be returned in the |  | ||||||
|  *                                callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * #NSS_CB_REGISTER_SUCCESS if registration is successful. |  | ||||||
|  * @par |  | ||||||
|  * Otherwise, #NSS_CB_REGISTER_FAILED. |  | ||||||
|  */ |  | ||||||
| extern nss_cb_register_status_t nss_cmn_register_queue_decongestion(struct nss_ctx_instance *nss_ctx, nss_cmn_queue_decongestion_callback_t event_callback, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_unregister_queue_decongestion |  | ||||||
|  *	Deregisters a queue from receiving a decongestion event. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_cmn_queue_decongestion_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx         Pointer to the NSS context. |  | ||||||
|  * @param[in]     event_callback  Callback for the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * #NSS_CB_REGISTER_SUCCESS if registration is successful. |  | ||||||
|  * @par |  | ||||||
|  * Otherwise, #NSS_CB_REGISTER_FAILED. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The callback function must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern nss_cb_unregister_status_t nss_cmn_unregister_queue_decongestion(struct nss_ctx_instance *nss_ctx, nss_cmn_queue_decongestion_callback_t event_callback); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for packets with service code. |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context for this message. |  | ||||||
|  * @param[in] nbuf      Pointer to the socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_cmn_service_code_callback_t)(void *app_data, struct sk_buff *nbuf); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_register_service_code |  | ||||||
|  *	Registers a callback for a service code. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_cmn_service_code_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx         Pointer to the NSS context. |  | ||||||
|  * @param[in]     cb              Callback for the message. |  | ||||||
|  * @param[in]     service_code    Service code found attached to the packet. |  | ||||||
|  * @param[in]     app_data        Pointer to the application context to be returned in the |  | ||||||
|  *                                callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * #NSS_CB_REGISTER_SUCCESS if registration is successful. |  | ||||||
|  * @par |  | ||||||
|  * Otherwise, #NSS_CB_REGISTER_FAILED. |  | ||||||
|  */ |  | ||||||
| extern nss_cb_register_status_t nss_cmn_register_service_code(struct nss_ctx_instance *nss_ctx, nss_cmn_service_code_callback_t cb, uint8_t service_code, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_unregister_service_code |  | ||||||
|  *	Deregisters a callback for the given service code. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_cmn_service_code_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx         Pointer to the NSS context. |  | ||||||
|  * @param[in]     cb              Callback for the message. |  | ||||||
|  * @param[in]     service_code    Service code found attached to the packet. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * #NSS_CB_REGISTER_SUCCESS if registration is successful. |  | ||||||
|  * @par |  | ||||||
|  * Otherwise, #NSS_CB_REGISTER_FAILED. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The callback function must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern nss_cb_unregister_status_t nss_cmn_unregister_service_code(struct nss_ctx_instance *nss_ctx, nss_cmn_service_code_callback_t cb, uint8_t service_code); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_get_nss_enabled |  | ||||||
|  *	Checks whether the NSS mode is supported on the platform. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE if NSS is supported. \n |  | ||||||
|  * Otherwise, FALSE. |  | ||||||
|  */ |  | ||||||
| extern bool nss_cmn_get_nss_enabled(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_cmn_rx_dropped_sum |  | ||||||
|  *	Sums dropped packet count of all NSS pnode queues. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_cmn_node_stats \n |  | ||||||
|  * |  | ||||||
|  * @param[in] node_stats  Pointer to node statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Total dropped packets count. |  | ||||||
|  */ |  | ||||||
| extern uint32_t nss_cmn_rx_dropped_sum(struct nss_cmn_node_stats *node_stats); |  | ||||||
|  |  | ||||||
| #endif /* __KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_CMN_MSG_H */ |  | ||||||
| @@ -1,392 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-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_crypto.h |  | ||||||
|  *	NSS Crypto interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_CRYPTO_H |  | ||||||
| #define __NSS_CRYPTO_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_crypto_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_CRYPTO_MAX_IDXS 64		/**< Maximum number of supported sessions. */ |  | ||||||
| #define NSS_CRYPTO_MAX_ENGINES 4	/**< Maximum number of engines available. */ |  | ||||||
| #define NSS_CRYPTO_BAM_PP 2		/**< Bus Access Manager pipe pairs. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_hash |  | ||||||
|  *	Hash sizes supported by the hardware. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_hash { |  | ||||||
| 	NSS_CRYPTO_HASH_SHA96 = 12, |  | ||||||
| 	NSS_CRYPTO_HASH_SHA128 = 16, |  | ||||||
| 	NSS_CRYPTO_HASH_SHA160 = 20, |  | ||||||
| 	NSS_CRYPTO_HASH_SHA256 = 32 |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cipher |  | ||||||
|  *	Cipher algorithms. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cipher { |  | ||||||
| 	NSS_CRYPTO_CIPHER_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_CIPHER_AES_CBC,	/**< AES, and CBC for 128-bit and 256-bit key sizes. */ |  | ||||||
| 	NSS_CRYPTO_CIPHER_DES,		/**< DES, and CBC for 64-bit key size. */ |  | ||||||
| 	NSS_CRYPTO_CIPHER_NULL,		/**< NULL and CBC. */ |  | ||||||
| 	NSS_CRYPTO_CIPHER_AES_CTR,	/**< AES, and CTR for 128-bit and 256-bit key sizes. */ |  | ||||||
| 	NSS_CRYPTO_CIPHER_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_auth |  | ||||||
|  *	Authentication algorithms. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_auth { |  | ||||||
| 	NSS_CRYPTO_AUTH_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_AUTH_SHA1_HMAC, |  | ||||||
| 	NSS_CRYPTO_AUTH_SHA256_HMAC, |  | ||||||
| 	NSS_CRYPTO_AUTH_NULL, |  | ||||||
| 	NSS_CRYPTO_AUTH_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_msg_type |  | ||||||
|  *	Synchronization types. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_msg_type { |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_OPEN_ENG = 1, |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_CLOSE_ENG = 2, |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_UPDATE_SESSION = 3, |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_STATS = 4, |  | ||||||
| 	NSS_CRYPTO_MSG_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_msg_error |  | ||||||
|  *	Response types. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_msg_error { |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_INVAL_ENG = 1, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_UNSUPP_OP = 2, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_INVAL_OP = 3, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_INVAL_IDX_RANGE = 4, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_IDX_ALLOC_FAIL = 5, |  | ||||||
| 	NSS_CRYPTO_MSG_ERROR_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_session_state |  | ||||||
|  *	Session states. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_session_state { |  | ||||||
| 	NSS_CRYPTO_SESSION_STATE_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_SESSION_STATE_ACTIVE = 1, |  | ||||||
| 	NSS_CRYPTO_SESSION_STATE_FREE = 2 |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_buf_origin |  | ||||||
|  *	Origins of the crypto session. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_buf_origin { |  | ||||||
| 	NSS_CRYPTO_BUF_ORIGIN_HOST = 0x001, |  | ||||||
| 	NSS_CRYPTO_BUF_ORIGIN_NSS = 0x0002, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_idx |  | ||||||
|  *	Crypto session index information. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_idx { |  | ||||||
| 	uint16_t pp_num;		/**< Pipe pair index. */ |  | ||||||
| 	uint16_t cmd_len;		/**< Command block length to program. */ |  | ||||||
| 	uint32_t cblk_paddr;		/**< Physical address of the command block. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_config_eng |  | ||||||
|  *	Engine configuration information for opening the engine from the host. |  | ||||||
|  * |  | ||||||
|  * This structure is called to initialize the crypto NSS engine-specific data |  | ||||||
|  * structures. Ideally, the host can send a single probe for all engines, but |  | ||||||
|  * the current implementation relies on probes per engine. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_config_eng { |  | ||||||
| 	uint32_t eng_id;		/**< Engine number to open. */ |  | ||||||
| 	uint32_t bam_pbase;		/**< BAM base address (physical). */ |  | ||||||
| 	uint32_t crypto_pbase;		/**< Crypto base address (physical). */ |  | ||||||
| 	uint32_t desc_paddr[NSS_CRYPTO_BAM_PP]; |  | ||||||
| 					/**< Pipe description address (physical). */ |  | ||||||
| 	struct nss_crypto_idx idx[NSS_CRYPTO_MAX_IDXS]; |  | ||||||
| 					/**< Allocated session indices. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_config_session |  | ||||||
|  *	Session-related state configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_config_session { |  | ||||||
| 	uint32_t idx;		/**< Session index on which the state is reset. */ |  | ||||||
| 	uint32_t state;		/**< Index state of the session. */ |  | ||||||
| 	uint32_t iv_len;	/**< Length of the initialization vector. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_stats |  | ||||||
|  *	Crypto statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_stats { |  | ||||||
| 	uint32_t queued;	/**< Number of frames waiting to be processed. */ |  | ||||||
| 	uint32_t completed;	/**< Number of frames processed. */ |  | ||||||
| 	uint32_t dropped;	/**< Number of frames dropped or not processed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_sync_stats |  | ||||||
|  *	Statistics synchronized to the host. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_sync_stats { |  | ||||||
| 	struct nss_crypto_stats eng_stats[NSS_CRYPTO_MAX_ENGINES]; |  | ||||||
| 			/**< Tx or Rx statistics captured per crypto engine. */ |  | ||||||
| 	struct nss_crypto_stats idx_stats[NSS_CRYPTO_MAX_IDXS]; |  | ||||||
| 			/**< Tx or Rx statistics captured per session. */ |  | ||||||
| 	struct nss_crypto_stats total; |  | ||||||
| 			/**< Total statistics captured in and out of the engine. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_msg |  | ||||||
|  *	Data for sending and receiving crypto messages. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a crypto message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_crypto_config_eng eng; |  | ||||||
| 				/**< Opens an engine. */ |  | ||||||
| 		struct nss_crypto_config_session session; |  | ||||||
| 				/**< Resets the statistics. */ |  | ||||||
| 		struct nss_crypto_sync_stats stats; |  | ||||||
| 				/**< Synchronized statistics for crypto. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__  /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Message notification callback. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_crypto_msg_callback_t)(void *app_data, struct nss_crypto_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Data callback. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff \n |  | ||||||
|  * napi_struct |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the network device. |  | ||||||
|  * @param[in] skb     Pointer to the data socket buffer. |  | ||||||
|  * @param[in] napi    Pointer to the NAPI structure. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_crypto_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Power management event callback. |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data    Pointer to the application context of the message. |  | ||||||
|  * @param[in] turbo       Turbo mode event. |  | ||||||
|  * @param[in] auto_scale  Specifies the auto scaling of the NSS clock frequency. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE if crypto is scaled to turbo. |  | ||||||
|  */ |  | ||||||
| typedef bool (*nss_crypto_pm_event_callback_t)(void *app_data, bool turbo, bool auto_scale); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_tx_msg |  | ||||||
|  *	Sends a crypto message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_crypto_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context of the HLOS driver. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_crypto_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_crypto_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_tx_buf |  | ||||||
|  *	Sends a crypto data packet. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context of the HLOS driver |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * @param[in] skb      Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_crypto_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_notify_register |  | ||||||
|  *	Registers an event callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_crypto_notify_register(nss_crypto_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_data_register |  | ||||||
|  *	Registers a data callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the data. |  | ||||||
|  * @param[in] netdev    Pointer to the network device. |  | ||||||
|  * @param[in] features  Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_crypto_data_register(uint32_t if_num, nss_crypto_buf_callback_t cb, |  | ||||||
| 		struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_pm_notify_register |  | ||||||
|  *	Registers a power management event callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_pm_event_callback_t |  | ||||||
|  * |  | ||||||
|  * @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_crypto_pm_notify_register(nss_crypto_pm_event_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_notify_unregister |  | ||||||
|  *	Deregisters an event callback handler notifier from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ctx  Pointer to the context of the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The event callback handler must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_notify_unregister(struct nss_ctx_instance *ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_data_unregister |  | ||||||
|  *	Deregisters a data callback handler from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The callback handler must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_data_unregister(struct nss_ctx_instance *ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_pm_notify_unregister |  | ||||||
|  *	Deregisters a power management event callback handler from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The callback handler must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_pm_notify_unregister(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_msg_init |  | ||||||
|  *	Initializes a crypto-specific message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_msg \n |  | ||||||
|  * nss_crypto_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the 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_crypto_msg_init(struct nss_crypto_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 								nss_crypto_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_CRYPTO_H */ |  | ||||||
| @@ -1,460 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2019, 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_crypto_cmn.h |  | ||||||
|  *	NSS Crypto common interface definitions. |  | ||||||
|  */ |  | ||||||
| #ifndef __NSS_CRYPTO_CMN_H |  | ||||||
| #define __NSS_CRYPTO_CMN_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_crypto_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Context message related array sizes |  | ||||||
|  */ |  | ||||||
| #define NSS_CRYPTO_CMN_CTX_SPARE 4 /**< Context spare words size. */ |  | ||||||
| #define NSS_CRYPTO_CMN_VER_WORDS 4 /**< Firmware version words size.*/ |  | ||||||
| #define NSS_CRYPTO_CIPHER_KEYLEN_MAX 32 /**< Maximum cipher keysize. */ |  | ||||||
| #define NSS_CRYPTO_AUTH_KEYLEN_MAX 128 /**< Maximum authorization keysize. */ |  | ||||||
| #define NSS_CRYPTO_NONCE_SIZE_MAX 4 /**< Maximum authorization keysize. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_algo |  | ||||||
|  *	List of crypto algorithms supported. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cmn_algo { |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_NULL,			/**< NULL transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_ECB,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_ECB,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_ECB,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_GCM,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_GCM,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_GCM,			/**< Asynchronous block cipher. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_MD5_HASH,			/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA160_HASH,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA224_HASH,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA256_HASH,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA384_HASH,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA512_HASH,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_MD5_HMAC,			/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA160_HMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA224_HMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA256_HMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA384_HMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_SHA512_HMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_GMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_GMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_GMAC,		/**< Asynchronous digest. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_GCM_GMAC,		/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CBC_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_GCM_GMAC,		/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CBC_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_GCM_GMAC,		/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CBC_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES128_CTR_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES192_CTR_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR_MD5_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_AES256_CTR_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC_MD5_HMAC,		/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC_SHA160_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC_SHA256_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC_SHA384_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_3DES_CBC_SHA512_HMAC,	/**< AEAD transform. */ |  | ||||||
| 	NSS_CRYPTO_CMN_ALGO_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_resp_error |  | ||||||
|  *	Response errors from crypto hardware |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cmn_resp_error { |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_NONE = 0,			/**< No error. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_HDR_VERSION,		/**< Header version mismatch. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_CTX_RANGE,		/**< Crypto index out-of-range. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_CTX_NOUSE,		/**< Crypto index is freed. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_DATA_EMPTY,		/**< Crypto data is empty. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_DATA_LEN,			/**< Crypto data length. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_DATA_TIMEOUT,		/**< Data timeout from hardware. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_CIPHER_ALGO,		/**< Cipher algorithm is not supported. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_CIPHER_MODE,		/**< Cipher mode is not supported. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_CIPHER_BLK_LEN,	/**< Cipher block length is not aligned. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_HASH_CHECK,		/**< Hash check failed. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_HASH_NOSPACE,		/**< No space to write hash. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_HW_STATUS,		/**< More errors in hardware status. */ |  | ||||||
| 	NSS_CRYPTO_CMN_RESP_ERROR_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_msg_type |  | ||||||
|  *	Message types supported. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cmn_msg_type { |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_NONE = 0,		/**< Invalid message. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SETUP_NODE,		/**< Initialize node. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SETUP_ENG,		/**< Initialize engine. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SETUP_DMA,		/**< Initialize DMA pair. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SETUP_CTX,		/**< Update context information. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_CLEAR_CTX,		/**< Clear context information. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_VERIFY_CTX,		/**< Verify if context is active. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SYNC_NODE_STATS,	/**< Synchronous node statistics. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SYNC_ENG_STATS,		/**< Synchronous engine statistics. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_SYNC_CTX_STATS,		/**< Synchronous context statistics. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_msg_error |  | ||||||
|  *	Message error types supported. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cmn_msg_error { |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_NONE = 0, |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_HDR_VERSION_NOSUPP,	/**< Common header version not supported. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_NODE_CTX_RANGE,	/**< Context index out-of-range for node. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_DMA_MASK,		/**< DMA mask is out-of-range. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_DMA_POW2,		/**< DMA count is not a power-of-two. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_DMA_MAX_TOKEN,		/**< DMA count exceeds token count. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_DMA_TOKEN_ALLOC,	/**< Failed to allocate token. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_RANGE,		/**< Context index out-of-range. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_INUSE,		/**< Context has references. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_WORDS,		/**< Context size is bad. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_ALGO,		/**< Context algorithm is bad. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_ALLOC,		/**< Context alloc failed. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_NOUSE,		/**< Context has no references. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_CTX_FLAGS,		/**< Invalid context flags. */ |  | ||||||
| 	NSS_CRYPTO_CMN_MSG_ERROR_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_ctx_flags |  | ||||||
|  *	Context message specific flags. |  | ||||||
|  */ |  | ||||||
| enum nss_crypto_cmn_ctx_flags { |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_NONE = 0,		/**< Invalid flags. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_SEC_OFFSET = 0x01,	/**< Secure offset is valid. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_SPARE0 = 0x02,		/**< Spare word-0 valid. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_SPARE1 = 0x04,		/**< Spare word-1 valid. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_SPARE2 = 0x08,		/**< Spare word-2 valid. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_SPARE3 = 0x10,		/**< Spare word-3 valid. */ |  | ||||||
| 	NSS_CRYPTO_CMN_CTX_FLAGS_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_node |  | ||||||
|  *	Node message for setting up the crypto node. |  | ||||||
|  * |  | ||||||
|  * Note: Upon boot this is the first message sent by Host to NSS crypto. |  | ||||||
|  *	- It notifies the maximum number of crypto context. |  | ||||||
|  *	- It notifies the maximum number of DMA rings. |  | ||||||
|  *	- It returns the maximum size of crypto context record. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_node { |  | ||||||
| 	uint32_t max_dma_rings;		/**< Maximum DMA rings supported. */ |  | ||||||
| 	uint32_t max_ctx;		/**< Maximum contexts. */ |  | ||||||
| 	uint32_t max_ctx_size;		/**< Maximum context size. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_engine |  | ||||||
|  *	Engine message for setting up the instance of crypto engine. |  | ||||||
|  * |  | ||||||
|  * Note: This is sent after 'node' message for each engine to |  | ||||||
|  *	- Get valid DMA pairs supported by firmware. |  | ||||||
|  *	- Get maximum request/token count available in firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_engine { |  | ||||||
| 	uint32_t fw_ver[NSS_CRYPTO_CMN_VER_WORDS];	/**< Firmware version. */ |  | ||||||
| 	uint32_t dma_mask;				/**< Max DMA rings. */ |  | ||||||
| 	uint32_t req_count;				/**< Token count. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_dma |  | ||||||
|  *	DMA message for setting up each DMA pair per engine. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_dma { |  | ||||||
| 	uint16_t pair_id;		/**< DMA pair ID. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_ctx |  | ||||||
|  *	Context message for setting up a crypto context in firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_ctx { |  | ||||||
| 	uint32_t spare[NSS_CRYPTO_CMN_CTX_SPARE];	/**< Context spare words. */ |  | ||||||
| 	uint16_t index;					/**< Crypto index. */ |  | ||||||
| 	uint16_t sec_offset;				/**< Secure offset for copying keys. */ |  | ||||||
|  |  | ||||||
| 	uint8_t cipher_key[NSS_CRYPTO_CIPHER_KEYLEN_MAX];	/**< Array containing cipher keys. */ |  | ||||||
| 	uint8_t auth_key[NSS_CRYPTO_AUTH_KEYLEN_MAX];	/**< Array containing authorization keys. */ |  | ||||||
| 	uint8_t nonce[NSS_CRYPTO_NONCE_SIZE_MAX];		/**< Nonce value. */ |  | ||||||
|  |  | ||||||
| 	uint16_t auth_keylen;				/**< Authorization key length. */ |  | ||||||
| 	uint8_t res[2];					/**< Reserved. */ |  | ||||||
|  |  | ||||||
| 	enum nss_crypto_cmn_algo algo;			/**< Crypto algorithm. */ |  | ||||||
| 	enum nss_crypto_cmn_ctx_flags flags;		/**< Context specific flags. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_stats |  | ||||||
|  *	Statistics message applicable for node/engine/context. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_stats { |  | ||||||
| 	struct nss_cmn_node_stats nstats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t fail_version;			/**< Version mismatch failures. */ |  | ||||||
| 	uint32_t fail_ctx;			/**< Context related failures. */ |  | ||||||
| 	uint32_t fail_dma;			/**< DMA descriptor full. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_msg |  | ||||||
|  *	Crypto common configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_crypto_cmn_msg { |  | ||||||
| 	struct nss_cmn_msg cm;				/**< Common header. */ |  | ||||||
| 	uint32_t seq_num;				/**< Sequence number for messages. */ |  | ||||||
| 	uint32_t uid;					/**< Unique ID to identify engine and context. */ |  | ||||||
|  |  | ||||||
| 	union { |  | ||||||
| 		struct nss_crypto_cmn_node node;	/**< Node message. */ |  | ||||||
| 		struct nss_crypto_cmn_engine eng;	/**< Engine message. */ |  | ||||||
| 		struct nss_crypto_cmn_dma dma;		/**< DMA message. */ |  | ||||||
| 		struct nss_crypto_cmn_ctx ctx;		/**< Context message. */ |  | ||||||
| 		struct nss_crypto_cmn_stats stats;	/**< Statistics message. */ |  | ||||||
| 	} msg; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__  /* only kernel will use */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving crypto transformation upon completion. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff \n |  | ||||||
|  * napi_struct |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Networking device registered for callback. |  | ||||||
|  * @param[in] skb     Packet buffer. |  | ||||||
|  * @param[in] napi    NAPI pointer for Linux NAPI handling. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_crypto_cmn_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, |  | ||||||
| 						struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving crypto_cmn messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Context of the callback user. |  | ||||||
|  * @param[in] msg       Crypto common message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_crypto_cmn_msg_callback_t)(void *app_data, struct nss_crypto_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_tx_buf |  | ||||||
|  *	Send crypto payload to firmware for transformation. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  NSS context per NSS core. |  | ||||||
|  * @param[in] if_num   Crypto interface to send the buffer. |  | ||||||
|  * @param[in] skb      Crypto payload. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the TX operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_crypto_cmn_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_tx_msg |  | ||||||
|  *	Send crypto message to firmware for configuration. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_crypto_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx]  NSS context per NSS core. |  | ||||||
|  * @param[in] msg       Control message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the TX operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_crypto_cmn_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_crypto_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_tx_msg |  | ||||||
|  *	Send crypto message to firmware for configuration synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_crypto_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  NSS context per NSS core. |  | ||||||
|  * @param[in,out] msg      Crypto message, response data is copied. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the TX operation. |  | ||||||
|  * |  | ||||||
|  * @note |  | ||||||
|  * Response data for the  message is copied into the 'msg'. |  | ||||||
|  * The caller should read the content of the 'msg' to find out errors. |  | ||||||
|  * The caller needs to invoke this from a non-atomic context. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_crypto_cmn_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_crypto_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_notify_register |  | ||||||
|  *	Register a event callback handler with NSS driver |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_cmn_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Event callback function. |  | ||||||
|  * @param[in] app_data  Context of the callback user. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_crypto_cmn_notify_register(nss_crypto_cmn_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_notify_unregister |  | ||||||
|  *	De-register the event callback handler with NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the NSS context per NSS core. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_cmn_notify_unregister(struct nss_ctx_instance *ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_data_register |  | ||||||
|  *	Crypto data register. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_cmn_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    Interface number. |  | ||||||
|  * @param[in] cb        Callback function. |  | ||||||
|  * @param[in] netdev    Net device. |  | ||||||
|  * @param[in] features  Features supported. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_crypto_cmn_data_register(uint32_t if_num, |  | ||||||
| 						nss_crypto_cmn_buf_callback_t cb, |  | ||||||
| 						struct net_device *netdev, |  | ||||||
| 						uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_data_unregister |  | ||||||
|  *	Crypto data de-register. |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     NSS context per NSS core. |  | ||||||
|  * @param[in] if_num  Interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_cmn_data_unregister(struct nss_ctx_instance *ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_get_context |  | ||||||
|  *	Get the per NSS core context enabled for crypto. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_crypto_cmn_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_crypto_cmn_msg_init |  | ||||||
|  *	Crypto common message initialization. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_crypto_cmn_msg \n |  | ||||||
|  * nss_crypto_cmn_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] ncm       Crypto common message. |  | ||||||
|  * @param[in] if_num    Interface number. |  | ||||||
|  * @param[in] type      Message type. |  | ||||||
|  * @param[in] len       Common message length. |  | ||||||
|  * @param[in] cb        Callback function. |  | ||||||
|  * @param[in] app_data  Appllication data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_crypto_cmn_msg_init(struct nss_crypto_cmn_msg *ncm, uint16_t if_num, |  | ||||||
| 				uint32_t type, uint32_t len, nss_crypto_cmn_msg_callback_t cb, |  | ||||||
| 				void *app_data); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
| #endif |  | ||||||
| @@ -1,57 +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_def.h |  | ||||||
|  *	NSS definitions |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_DEF_H |  | ||||||
| #define __NSS_DEF_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_common_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_ETH_NORMAL_FRAME_MTU 1500		/**< MTU of a normal frame.*/ |  | ||||||
| #define NSS_ETH_MINI_JUMBO_FRAME_MTU 1978	/**< MTU of a mini-jumbo frame. */ |  | ||||||
| #define NSS_ETH_FULL_JUMBO_FRAME_MTU 9600	/**< MTU of a full jumbo frame. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Number of ingress or egress VLANS supported in a connection entry. |  | ||||||
|  */ |  | ||||||
| #define MAX_VLAN_DEPTH 2 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Number of egress interfaces supported in a multicast connection entry. |  | ||||||
|  */ |  | ||||||
| #define NSS_MC_IF_MAX 16 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Real pointer size of the system. |  | ||||||
|  */ |  | ||||||
| #ifdef __LP64__ |  | ||||||
| typedef uint64_t nss_ptr_t; |  | ||||||
| #else |  | ||||||
| typedef uint32_t nss_ptr_t; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /** __NSS_DEF_H */ |  | ||||||
| @@ -1,333 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
| /** |  | ||||||
|  * @file nss_dma.h |  | ||||||
|  *	NSS DMA for linearization and split interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_DMA_H |  | ||||||
| #define __NSS_DMA_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_dma_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_msg_type |  | ||||||
|  *	Supported message types. |  | ||||||
|  */ |  | ||||||
| enum nss_dma_msg_type { |  | ||||||
| 	NSS_DMA_MSG_TYPE_NONE,			/**< Invalid message type. */ |  | ||||||
| 	NSS_DMA_MSG_TYPE_CONFIGURE,		/**< Configure DMA. */ |  | ||||||
| 	NSS_DMA_MSG_TYPE_SYNC_STATS,		/**< Statistics synchronization. */ |  | ||||||
| 	NSS_DMA_MSG_TYPE_TEST_PERF,		/**< Performance test. */ |  | ||||||
| 	NSS_DMA_MSG_TYPE_MAX			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_msg_error |  | ||||||
|  *	Message error types. |  | ||||||
|  */ |  | ||||||
| enum nss_dma_msg_error { |  | ||||||
| 	NSS_DMA_MSG_ERROR_NONE,			/**< No error. */ |  | ||||||
| 	NSS_DMA_MSG_ERROR_HW_INIT,		/**< Invalid operation. */ |  | ||||||
| 	NSS_DMA_MSG_ERROR_UNHANDLED,		/**< Invalid test ID. */ |  | ||||||
| 	NSS_DMA_MSG_ERROR_TEST,			/**< Performance test failed. */ |  | ||||||
| 	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 |  | ||||||
|  *	DMA Test types. |  | ||||||
|  */ |  | ||||||
| enum nss_dma_test_type { |  | ||||||
| 	NSS_DMA_TEST_TYPE_DEFAULT = 0,		/**< Test default segment size. */ |  | ||||||
| 	NSS_DMA_TEST_TYPE_SWEEP,		/**< Test sweep segment size. */ |  | ||||||
| 	NSS_DMA_TEST_TYPE_LARGE,		/**< Test large segment size. */ |  | ||||||
| 	NSS_DMA_TEST_TYPE_VERIFY,		/**< Verify contents at receive processing. */ |  | ||||||
| 	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. */ |  | ||||||
| /* |  | ||||||
|  * Maximum number of HW specific statistics |  | ||||||
|  */ |  | ||||||
| #define NSS_DMA_HW_ERROR_MAX 16 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Test configuration flags |  | ||||||
|  */ |  | ||||||
| #define NSS_DMA_TEST_FLAGS_LINEARIZE 0x01	/**< Linearize test. */ |  | ||||||
| #define NSS_DMA_TEST_FLAGS_SPLIT 0x02		/**< Split test. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_test_cfg |  | ||||||
|  *	Test configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_dma_test_cfg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics for DMA interface. */ |  | ||||||
| 	uint32_t flags;				/**< Test configuration flags. */ |  | ||||||
| 	uint32_t time_delta;			/**< Difference between start and end. */ |  | ||||||
| 	uint16_t packet_count;			/**< Number of packets to send. */ |  | ||||||
| 	uint16_t type;				/**< Type of test to run. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_stats |  | ||||||
|  *	DMA statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_dma_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics for DMA interface. */ |  | ||||||
| 	uint32_t no_req;			/**< Request descriptor not available. */ |  | ||||||
| 	uint32_t no_desc;			/**< DMA descriptors not available. */ |  | ||||||
| 	uint32_t fail_nexthop;			/**< Failed to retrive next hop. */ |  | ||||||
| 	uint32_t fail_nexthop_queue;		/**< Failed to queue next hop. */ |  | ||||||
| 	uint32_t fail_linear_sz;		/**< Failed to get memory for linearization. */ |  | ||||||
| 	uint32_t fail_linear_alloc;		/**< Failed to allocate buffer for linearization. */ |  | ||||||
| 	uint32_t fail_linear_no_sg;		/**< Skip linearization due to non-SG packet. */ |  | ||||||
| 	uint32_t fail_split_sz;			/**< Failed to spliting buffer into multiple buffers. */ |  | ||||||
| 	uint32_t fail_split_alloc;		/**< Failed to allocate buffer for split. */ |  | ||||||
| 	uint32_t fail_sync_alloc;		/**< Failed to allocate buffer for sending statistics. */ |  | ||||||
| 	uint32_t fail_ctx_active;		/**< Failed to queue as the node is not active. */ |  | ||||||
| 	uint32_t fail_hw[NSS_DMA_HW_ERROR_MAX]; /**< Hardware failures. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_msg |  | ||||||
|  *	Message structure for configuring the DMA interface. |  | ||||||
|  */ |  | ||||||
| struct nss_dma_msg { |  | ||||||
| 	struct nss_cmn_msg cm;			/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a NSS core-to-core transmission rule or statistics message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_dma_test_cfg test_cfg; |  | ||||||
| 						/**< DMA test configuration. */ |  | ||||||
| 		struct nss_dma_stats stats;	/**< DMA interface statistics. */ |  | ||||||
| 	} msg;					/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_register_handler |  | ||||||
|  *	Registers the DMA message handler. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_dma_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving DMA messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_c2c_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_dma_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_tx_msg |  | ||||||
|  *	Transmits a DMA message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_dma_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] ndm      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dma_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_dma_msg *ndm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_msg_init |  | ||||||
|  *	Initializes DMA messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dma_msg \n |  | ||||||
|  * nss_dma_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in]     ndm       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_dma_msg_init(struct nss_dma_msg *ndm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 			nss_dma_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_notify_register |  | ||||||
|  *	Registers a notifier callback for DMA messages with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dma_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] core      NSS core number index to the notifier callback table. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_dma_notify_register(int core, nss_dma_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_notify_unregister |  | ||||||
|  *	Deregisters a DMA message notifier callback from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] core  NSS core number index to the notifier callback table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The notifier callback must have been previously registered. |  | ||||||
|  */ |  | ||||||
| void nss_dma_notify_unregister(int core); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_register_sysctl |  | ||||||
|  *     Registers the DMA interface to Linux system control tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_dma_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_unregister_sysctl |  | ||||||
|  *     Deregisters the DMA interface from Linux system control tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_dma_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_init |  | ||||||
|  *	Initializes the DMA interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_dma_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dma_get_context |  | ||||||
|  *	Get the per NSS core context enabled for DMA. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| 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 /* __NSS_C2C_TX_H */ |  | ||||||
| @@ -1,335 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-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_dtls.h |  | ||||||
|  *	NSS DTLS interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_DTLS_H_ |  | ||||||
| #define _NSS_DTLS_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_dtls_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_DTLS_SESSIONS 8		/**< Maximum number of supported DTLS sessions. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_metadata_types |  | ||||||
|  *	Message types for DTLS requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_dtls_metadata_types { |  | ||||||
| 	NSS_DTLS_MSG_SESSION_CONFIGURE, |  | ||||||
| 	NSS_DTLS_MSG_SESSION_DESTROY, |  | ||||||
| 	NSS_DTLS_MSG_SESSION_STATS, |  | ||||||
| 	NSS_DTLS_MSG_REKEY_ENCAP_CIPHER_UPDATE, |  | ||||||
| 	NSS_DTLS_MSG_REKEY_ENCAP_CIPHER_SWITCH, |  | ||||||
| 	NSS_DTLS_MSG_REKEY_DECAP_CIPHER_UPDATE, |  | ||||||
| 	NSS_DTLS_MSG_REKEY_DECAP_CIPHER_SWITCH, |  | ||||||
| 	NSS_DTLS_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_error_response_types |  | ||||||
|  *	Error types for DTLS responses. |  | ||||||
|  */ |  | ||||||
| enum nss_dtls_error_response_types { |  | ||||||
| 	NSS_DTLS_ERR_UNKNOWN_MSG = 1, |  | ||||||
| 	NSS_DTLS_ERR_INVALID_APP_IF = 2, |  | ||||||
| 	NSS_DTLS_ERR_INVALID_CPARAM = 3, |  | ||||||
| 	NSS_DTLS_ERR_INVALID_VER = 4, |  | ||||||
| 	NSS_DTLS_ERR_NOMEM = 5, |  | ||||||
| 	NSS_DTLS_ERR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_session_stats |  | ||||||
|  *	DTLS session statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_session_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t tx_auth_done;		/**< Tx authentication is done. */ |  | ||||||
| 	uint32_t rx_auth_done;		/**< Rx authentication is successful. */ |  | ||||||
| 	uint32_t tx_cipher_done;	/**< Tx cipher is complete. */ |  | ||||||
| 	uint32_t rx_cipher_done;	/**< Rx cipher is complete. */ |  | ||||||
| 	uint32_t tx_cbuf_alloc_fail;	/**< Tx crypto buffer allocation failure. */ |  | ||||||
| 	uint32_t rx_cbuf_alloc_fail;	/**< Rx crypto buffer allocation failure. */ |  | ||||||
| 	uint32_t tx_cenqueue_fail;	/**< Tx enqueue-to-crypto failure. */ |  | ||||||
| 	uint32_t rx_cenqueue_fail;	/**< Rx enqueue-to-crypto failure. */ |  | ||||||
| 	uint32_t tx_dropped_hroom; |  | ||||||
| 			/**< Tx packets dropped because of insufficent headroom. */ |  | ||||||
| 	uint32_t tx_dropped_troom; |  | ||||||
| 			/**< Tx packets dropped because of insufficent tailroom. */ |  | ||||||
| 	uint32_t tx_forward_enqueue_fail; |  | ||||||
| 			/**< Tx enqueue failed to forward a node after encapsulation. */ |  | ||||||
| 	uint32_t rx_forward_enqueue_fail; |  | ||||||
| 			/**< Rx enqueue failed to receive a node after decapsulation. */ |  | ||||||
| 	uint32_t rx_invalid_version;	/**< Rx invalid DTLS version. */ |  | ||||||
| 	uint32_t rx_invalid_epoch;	/**< Rx invalid DTLS epoch. */ |  | ||||||
| 	uint32_t rx_malformed;		/**< Rx malformed DTLS record. */ |  | ||||||
| 	uint32_t rx_cipher_fail;	/**< Rx cipher failure. */ |  | ||||||
| 	uint32_t rx_auth_fail;		/**< Rx authentication failure. */ |  | ||||||
| 	uint32_t rx_capwap_classify_fail;	/**< Rx CAPWAP classification failure. */ |  | ||||||
| 	uint32_t rx_single_rec_dgram;	/**< Rx single record datagrams processed. */ |  | ||||||
| 	uint32_t rx_multi_rec_dgram;	/**< Rx multi-record datagrams processed. */ |  | ||||||
| 	uint32_t rx_replay_fail;	/**< Rx anti-replay failures. */ |  | ||||||
| 	uint32_t rx_replay_duplicate; |  | ||||||
| 			/**< Rx anti-replay failed because of a duplicate record. */ |  | ||||||
| 	uint32_t rx_replay_out_of_window; |  | ||||||
| 			/**< Rx anti-replay failed because of an out-of-window record. */ |  | ||||||
| 	uint32_t outflow_queue_full; |  | ||||||
| 			/**< Tx packets dropped because the encapsulation queue is full. */ |  | ||||||
| 	uint32_t decap_queue_full; |  | ||||||
| 			/**< Rx packets dropped because the decapsulation queue is full. */ |  | ||||||
| 	uint32_t pbuf_alloc_fail; |  | ||||||
| 			/**< Packets dropped because of a buffer allocation failure. */ |  | ||||||
| 	uint32_t pbuf_copy_fail; |  | ||||||
| 			/**< Packets dropped because of a buffer copy failure. */ |  | ||||||
| 	uint16_t epoch;		/**< Current epoch. */ |  | ||||||
| 	uint16_t tx_seq_high;	/**< Upper 16 bits of the current sequence number. */ |  | ||||||
| 	uint32_t tx_seq_low;	/**< Lower 32 bits of the current sequence number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_session_cipher_update |  | ||||||
|  *	Information for a cipher update message in a DTLS session. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_session_cipher_update { |  | ||||||
| 	uint32_t crypto_idx;	/**< Crypto index for encapsulation. */ |  | ||||||
| 	uint32_t hash_len;	/**< Authentication hash length for encapsulation. */ |  | ||||||
| 	uint32_t iv_len;	/**< Crypto IV length for encapsulation. */ |  | ||||||
| 	uint32_t cipher_algo;	/**< Encapsulation cipher. */ |  | ||||||
| 	uint32_t auth_algo;	/**< Encapsulation authentication algorithm. */ |  | ||||||
| 	uint16_t epoch;		/**< Epoch indicator. */ |  | ||||||
| 	uint16_t reserved;	/**< Reserved for message alignment.*/ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_session_configure |  | ||||||
|  *	Configuration message for a DTLS session. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_session_configure { |  | ||||||
| 	uint32_t ver;			/**< DTLS version. */ |  | ||||||
| 	uint32_t flags;			/**< DTLS flags. */ |  | ||||||
| 	uint32_t crypto_idx_encap;	/**< Crypto index for encapsulation. */ |  | ||||||
| 	uint32_t crypto_idx_decap;	/**< Crypto index for decapsulation. */ |  | ||||||
| 	uint32_t iv_len_encap;		/**< Crypto IV length for encapsulation. */ |  | ||||||
| 	uint32_t iv_len_decap;		/**< Crypto IV length for decapsulation. */ |  | ||||||
| 	uint32_t hash_len_encap; |  | ||||||
| 			/**< Authentication hash length for encapsulation. */ |  | ||||||
| 	uint32_t hash_len_decap; |  | ||||||
| 			/**< Authentication hash length for decapsulation. */ |  | ||||||
| 	uint32_t cipher_algo_encap;	/**< Cipher algorithm for encapsulation. */ |  | ||||||
| 	uint32_t auth_algo_encap;	/**< Authentication algorithm encapsulation. */ |  | ||||||
| 	uint32_t cipher_algo_decap;	/**< Cipher algorithm for decapsulation. */ |  | ||||||
| 	uint32_t auth_algo_decap;	/**< Authentication algorithm decapsulation. */ |  | ||||||
| 	uint32_t nss_app_if; |  | ||||||
| 			/**< Interface of the node that receives decapsulated packets. */ |  | ||||||
| 	uint16_t sport;			/**< Source UDP/UDPLite port. */ |  | ||||||
| 	uint16_t dport;			/**< Destination UDP/UDPLite port. */ |  | ||||||
| 	uint32_t sip[4];		/**< Source IPv4/IPv6 address. */ |  | ||||||
| 	uint32_t dip[4];		/**< Destination IPv4/IPv6 address. */ |  | ||||||
| 	uint16_t window_size;		/**< Anti-replay window size. */ |  | ||||||
| 	uint16_t epoch;			/**< Epoch indicator. */ |  | ||||||
| 	uint8_t oip_ttl;		/**< Maximum outer IP time-to-live value. */ |  | ||||||
| 	uint8_t reserved1;		/**< Reserved for message alignment. */ |  | ||||||
| 	uint16_t reserved2;		/**< Reserved for message alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_msg |  | ||||||
|  *	Data for sending and receiving DTLS messages. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a DTLS message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_dtls_session_configure cfg; |  | ||||||
| 				/**< Session configuration. */ |  | ||||||
| 		struct nss_dtls_session_cipher_update cipher_update; |  | ||||||
| 				/**< Cipher update information. */ |  | ||||||
| 		struct nss_dtls_session_stats stats; |  | ||||||
| 				/**< Session statistics. */ |  | ||||||
| 	} msg;			/**< Message payload for DTLS session messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_tx_buf |  | ||||||
|  *	Sends a DTLS data packet to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff \n |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in]     os_buf   Pointer to the OS data buffer. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS core context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx buffer forwarded to NSS for DTLS operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_dtls_tx_buf(struct sk_buff *os_buf, uint32_t if_num, |  | ||||||
| 				struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_tx_msg |  | ||||||
|  *	Sends DTLS messages. |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS core context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dtls_tx_msg(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 				       struct nss_dtls_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_tx_msg_sync |  | ||||||
|  *	Sends DTLS messages synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_dtls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dtls_tx_msg_sync(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 					    struct nss_dtls_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving DTLS messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_dtls_msg_callback_t)(void *app_data, |  | ||||||
| 					struct nss_dtls_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving DTLS session 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_dtls_data_callback_t)(struct net_device *netdev, |  | ||||||
| 					struct sk_buff *skb, |  | ||||||
| 					struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_register_if |  | ||||||
|  *	Registers a DTLS session interface with the NSS for sending and receiving |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_data_callback_t \n |  | ||||||
|  * nss_dtls_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num        NSS interface number. |  | ||||||
|  * @param[in] cb            Callback function for the message. |  | ||||||
|  * @param[in] msg_callback  Callback for DTLS tunnel message. |  | ||||||
|  * @param[in] netdev        Pointer to the associated network device. |  | ||||||
|  * @param[in] features      Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx       Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dtls_register_if(uint32_t if_num, |  | ||||||
| 							nss_dtls_data_callback_t cb, |  | ||||||
| 							nss_dtls_msg_callback_t msg_callback, |  | ||||||
| 							struct net_device *netdev, |  | ||||||
| 							uint32_t features, |  | ||||||
| 							void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_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_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_msg_init |  | ||||||
|  *	Initializes a DTLS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_dtls_msg_init(struct nss_dtls_msg *ncm, uint16_t if_num, |  | ||||||
| 				uint32_t type, uint32_t len, void *cb, |  | ||||||
| 				void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_get_context |  | ||||||
|  *	Gets the NSS core context for the DTLS session. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dtls_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_get_ifnum_with_coreid |  | ||||||
|  *	Gets the DTLS interface number with a core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_dtls_get_ifnum_with_coreid(int32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_DTLS_H_. */ |  | ||||||
| @@ -1,512 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-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_dtls_cmn.h |  | ||||||
|  *	NSS DTLS common interface definitions, supports inner/outer interface split. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_DTLS_CMN_H_ |  | ||||||
| #define _NSS_DTLS_CMN_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_dtls_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_DTLS_CMN_CTX_HDR_IPV6 0x0001		/**< DTLS with IPv6. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_HDR_UDPLITE 0x0002		/**< DTLS with UDPLite. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_HDR_CAPWAP 0x0004		/**< DTLS with CAPWAP. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_CIPHER_MODE_GCM 0x0008		/**< DTLS with GCM cipher mode. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_ENCAP_UDPLITE_CSUM 0x10000	/**< Checksum only UDPLite header. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_ENCAP_METADATA 0x20000		/**< Valid metadata in encapsulation direction. */ |  | ||||||
| #define NSS_DTLS_CMN_CTX_DECAP_ACCEPT_ALL 0x40000	/**< Exception all error packets to host. */ |  | ||||||
|  |  | ||||||
| #define NSS_DTLS_CMN_CLE_MAX 32				/**< Max classification error. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_metadata_types |  | ||||||
|  *	Message types for DTLS requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_dtls_cmn_msg_type { |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_CONFIGURE_NODE,	/**< Configure DTLS firmware node. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_CONFIGURE_HDR,	/**< Configure the base context parameter. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_CONFIGURE_DTLS,	/**< Configure DTLS parameters. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_SWITCH_DTLS,	/**< Switch to new DTLS transform. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_DECONFIGURE,	/**< Deconfigure context. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_SYNC_STATS,	/**< Synchronize statistics. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_TYPE_NODE_STATS,	/**< Node statistics. */ |  | ||||||
| 	NSS_DTLS_CMN_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_error_response_types |  | ||||||
|  *	Error types for DTLS responses. |  | ||||||
|  */ |  | ||||||
| enum nss_dtls_cmn_error { |  | ||||||
| 	NSS_DTLS_CMN_ERROR_NONE = 0, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_UNKNOWN_MSG, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_DESTIF, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_SRCIF, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_CRYPTO, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_VER, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_CTX_TYPE, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_INVALID_CTX_WORDS, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_FAIL_ALLOC_HWCTX, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_FAIL_COPY_CTX, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_FAIL_SWITCH_HWCTX, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_ALREADY_CONFIGURED, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_FAIL_NOMEM, |  | ||||||
| 	NSS_DTLS_CMN_ERROR_FAIL_COPY_NONCE, |  | ||||||
| 	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 |  | ||||||
|  * 	DTLS node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_node_stats { |  | ||||||
| 	uint32_t fail_ctx_alloc;	/**< Failure in allocating a context. */ |  | ||||||
| 	uint32_t fail_ctx_free;		/**< Failure in freeing up the context. */ |  | ||||||
| 	uint32_t fail_pbuf_stats;	/**< Failure in pbuf allocation for statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_hw_stats |  | ||||||
|  * 	DTLS hardware statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_hw_stats { |  | ||||||
| 	uint32_t len_error;             /**< Length error. */ |  | ||||||
| 	uint32_t token_error;           /**< Token error, unknown token command/instruction. */ |  | ||||||
| 	uint32_t bypass_error;          /**< Token contains too much bypass data. */ |  | ||||||
| 	uint32_t config_error;          /**< Invalid command/algorithm/mode/combination. */ |  | ||||||
| 	uint32_t algo_error;            /**< Unsupported algorithm. */ |  | ||||||
| 	uint32_t hash_ovf_error;        /**< Hash input overflow. */ |  | ||||||
| 	uint32_t ttl_error;             /**< TTL or HOP-Limit underflow. */ |  | ||||||
| 	uint32_t csum_error;            /**< Checksum error. */ |  | ||||||
| 	uint32_t timeout_error;         /**< Data timed-out. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_ctx_stats |  | ||||||
|  *	DTLS session statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_ctx_stats { |  | ||||||
| 	struct nss_cmn_node_stats pkt;		/**< Common node statistics. */ |  | ||||||
| 	uint32_t rx_single_rec;			/**< Received single DTLS record datagrams. */ |  | ||||||
| 	uint32_t rx_multi_rec;			/**< Received multiple DTLS record datagrams. */ |  | ||||||
| 	uint32_t fail_crypto_resource;		/**< Failure in allocation of crypto resource. */ |  | ||||||
| 	uint32_t fail_crypto_enqueue;		/**< Failure due to queue full in crypto or hardware. */ |  | ||||||
| 	uint32_t fail_headroom;			/**< Failure in headroom check. */ |  | ||||||
| 	uint32_t fail_tailroom;			/**< Failure in tailroom check. */ |  | ||||||
| 	uint32_t fail_ver;			/**< Failure in DTLS version check. */ |  | ||||||
| 	uint32_t fail_epoch;			/**< Failure in DTLS epoch check. */ |  | ||||||
| 	uint32_t fail_dtls_record;		/**< Failure in reading DTLS record. */ |  | ||||||
| 	uint32_t fail_capwap;			/**< Failure in CAPWAP classification. */ |  | ||||||
| 	uint32_t fail_replay;			/**< Failure in anti-replay check. */ |  | ||||||
| 	uint32_t fail_replay_dup;		/**< Failure in anti-replay; duplicate records. */ |  | ||||||
| 	uint32_t fail_replay_win;		/**< Failure in anti-replay; packet outside the window. */ |  | ||||||
| 	uint32_t fail_queue;			/**< Failure due to queue full in DTLS. */ |  | ||||||
| 	uint32_t fail_queue_nexthop;		/**< Failure due to queue full in next_hop. */ |  | ||||||
| 	uint32_t fail_pbuf_alloc;		/**< Failure in pbuf allocation. */ |  | ||||||
| 	uint32_t fail_pbuf_linear;		/**< Failure in pbuf linearization. */ |  | ||||||
| 	uint32_t fail_pbuf_stats;		/**< Failure in pbuf allocation for statistics. */ |  | ||||||
| 	uint32_t fail_pbuf_align;		/**< Failure in pbuf alignment. */ |  | ||||||
| 	uint32_t fail_ctx_active;		/**< Failure in enqueue due to inactive context. */ |  | ||||||
| 	uint32_t fail_hwctx_active;		/**< Failure in enqueue due to inactive hardware context. */ |  | ||||||
| 	uint32_t fail_cipher;			/**< Failure in decrypting the data. */ |  | ||||||
| 	uint32_t fail_auth;			/**< Failure in authenticating the data. */ |  | ||||||
| 	uint32_t fail_seq_ovf;			/**< Failure due to sequence number overflow. */ |  | ||||||
| 	uint32_t fail_blk_len;			/**< Failure in decapsulation due to bad cipher block length. */ |  | ||||||
| 	uint32_t fail_hash_len;			/**< Failure in decapsulation due to bad hash block length. */ |  | ||||||
|  |  | ||||||
| 	struct nss_dtls_cmn_hw_stats fail_hw;	/**< Hardware failure statistics. */ |  | ||||||
|  |  | ||||||
| 	uint32_t fail_cle[NSS_DTLS_CMN_CLE_MAX];/**< Classification errors. */ |  | ||||||
|  |  | ||||||
| 	uint32_t seq_low;			/**< Lower 32 bits of current Tx sequence number. */ |  | ||||||
| 	uint32_t seq_high;			/**< Upper 16 bits of current Tx sequence number. */ |  | ||||||
|  |  | ||||||
| 	uint16_t epoch;				/**< Current epoch value. */ |  | ||||||
| 	uint8_t res1[2];			/**< Reserved for future use. */ |  | ||||||
|  |  | ||||||
| 	uint8_t res2[16];			/**< Reserved for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_ctx_config_hdr |  | ||||||
|  *	Parameters for outer header transform. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_ctx_config_hdr { |  | ||||||
| 	uint32_t flags;		/**< Context flags. */ |  | ||||||
| 	uint32_t dest_ifnum;	/**< Destination interface for packets. */ |  | ||||||
| 	uint32_t src_ifnum;	/**< Source interface of packets. */ |  | ||||||
| 	uint32_t sip[4];	/**< Source IPv4/v6 address. */ |  | ||||||
| 	uint32_t dip[4];	/**< Destination IPv4/v6 address. */ |  | ||||||
|  |  | ||||||
| 	uint16_t sport;		/**< Source UDP/UDPLite port. */ |  | ||||||
| 	uint16_t dport;		/**< Destination UDP/UDPLite port. */ |  | ||||||
|  |  | ||||||
| 	uint8_t hop_limit_ttl;	/**< IP header TTL field. */ |  | ||||||
| 	uint8_t dscp;		/**< DSCP value. */ |  | ||||||
| 	uint8_t dscp_copy; 	/**< Copy DSCP value. */ |  | ||||||
| 	uint8_t df;		/**< Do not fragment DTLS over IPv4. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_ctx_config_dtls |  | ||||||
|  *	Parameters for DTLS transform. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_ctx_config_dtls { |  | ||||||
| 	uint32_t ver;		/**< Version (enum dtls_cmn_ver). */ |  | ||||||
| 	uint32_t crypto_idx;	/**< Crypto index for cipher context. */ |  | ||||||
|  |  | ||||||
| 	uint16_t window_size;	/**< Anti-replay window size. */ |  | ||||||
| 	uint16_t epoch;		/**< Initial epoch value. */ |  | ||||||
|  |  | ||||||
| 	uint8_t iv_len;		/**< Crypto IV length for encapsulation. */ |  | ||||||
| 	uint8_t hash_len;	/**< Auth hash length for encapsulation. */ |  | ||||||
| 	uint8_t blk_len;	/**< Cipher block length. */ |  | ||||||
| 	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 |  | ||||||
|  *	Data for sending and receiving DTLS messages. |  | ||||||
|  */ |  | ||||||
| struct nss_dtls_cmn_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a DTLS message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_dtls_cmn_ctx_config_hdr hdr_cfg;	/**< Session configuration. */ |  | ||||||
| 		struct nss_dtls_cmn_ctx_config_dtls dtls_cfg;	/**< Cipher update information. */ |  | ||||||
| 		struct nss_dtls_cmn_ctx_stats stats;		/**< Session statistics. */ |  | ||||||
| 		struct nss_dtls_cmn_node_stats node_stats;	/**< Node statistics. */ |  | ||||||
| 	} msg;			/**< Message payload for DTLS session messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only for kernel use. */ |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving DTLS messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_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_dtls_cmn_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving DTLS session 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_dtls_cmn_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_tx_buf |  | ||||||
|  *	Sends a DTLS data packet to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff \n |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in]     os_buf   Pointer to the OS data buffer. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS core context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx buffer forwarded to NSS for DTLS operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_dtls_cmn_tx_buf(struct sk_buff *os_buf, uint32_t if_num, struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_tx_msg |  | ||||||
|  *	Sends DTLS messages. |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS core context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dtls_cmn_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_dtls_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_tx_msg_sync |  | ||||||
|  *	Sends DTLS messages synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_dtls_cmn_msg_type \n |  | ||||||
|  * nss_dtls_cmn_msg \n |  | ||||||
|  * nss_dtls_cmn_error |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     type     Type of message. |  | ||||||
|  * @param[in]     len      Size of the payload. |  | ||||||
|  * @param[in]     ndcm     Pointer to the message data. |  | ||||||
|  * @param[in,out] resp     Response for the configuration. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dtls_cmn_tx_msg_sync(struct nss_ctx_instance *nss_ctx, uint32_t if_num, |  | ||||||
| 						enum nss_dtls_cmn_msg_type type, uint16_t len, |  | ||||||
| 						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 |  | ||||||
|  *	Registers a DTLS session interface with the NSS for sending and receiving |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_cmn_data_callback_t \n |  | ||||||
|  * nss_dtls_cmn_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] data_cb   Callback function for the message. |  | ||||||
|  * @param[in] msg_cb    Callback for DTLS tunnel message. |  | ||||||
|  * @param[in] netdev    Pointer to the associated network device. |  | ||||||
|  * @param[in] features  Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] type      Type of message. |  | ||||||
|  * @param[in] app_ctx   Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dtls_cmn_register_if(uint32_t if_num, |  | ||||||
| 							 nss_dtls_cmn_data_callback_t data_cb, |  | ||||||
| 							 nss_dtls_cmn_msg_callback_t msg_cb, |  | ||||||
| 							 struct net_device *netdev, |  | ||||||
| 							 uint32_t features, |  | ||||||
| 							 uint32_t type, |  | ||||||
| 							 void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_notify_unregister |  | ||||||
|  *	Deregisters an event callback. |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_dtls_cmn_notify_unregister(uint32_t ifnum); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_notify_register |  | ||||||
|  *	Registers an event callback to handle notification from DTLS firmware package. |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum     NSS interface number. |  | ||||||
|  * @param[in] ev_cb     Callback for DTLS tunnel message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dtls_cmn_notify_register(uint32_t ifnum, nss_dtls_cmn_msg_callback_t ev_cb, |  | ||||||
| 							     void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_msg_init |  | ||||||
|  *	Initializes a DTLS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dtls_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_dtls_cmn_msg_init(struct nss_dtls_cmn_msg *ncm, uint32_t if_num, uint32_t type, uint32_t len, void *cb, |  | ||||||
| 				void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_get_context |  | ||||||
|  *	Gets the NSS core context for the DTLS session. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dtls_cmn_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dtls_cmn_get_ifnum |  | ||||||
|  *	Gets the DTLS interface number with a core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __KERNEL__ */ |  | ||||||
| #endif /* _NSS_DTLS_CMN_H_. */ |  | ||||||
| @@ -1,343 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-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_dynamic_interface.h |  | ||||||
|  *	NSS Dynamic interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_DYNAMIC_INTERFACE_H |  | ||||||
| #define __NSS_DYNAMIC_INTERFACE_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_dynamic_interface_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_MAX_DYNAMIC_INTERFACES 128	/**< Maximum number of dynamic interfaces. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_type |  | ||||||
|  *	Dynamic interface types. |  | ||||||
|  * |  | ||||||
|  * @note |  | ||||||
|  * Every time a new dynamic interface type is added to an enumeration in the following list, |  | ||||||
|  * a corresponding type name string should be added in the dynamic interface type string array. |  | ||||||
|  */ |  | ||||||
| enum nss_dynamic_interface_type { |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_NONE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_5, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_VAP, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_0, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PPPOE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_VIRTIF_DEPRECATED, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_L2TPV2, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_4, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PORTID, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_DTLS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_QVPN_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_QVPN_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_VLAN, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_INTERNAL, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_MAP_T_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_HOST_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_WIFI_OFFL_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_SJACK_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INLINE_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INLINE_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_N2H, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GENERIC_REDIR_H2N, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TUN6RD_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_US, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER_EXCEPTION, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_US, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PPTP_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PPTP_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PPTP_HOST_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IPSEC_CMN_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IPSEC_CMN_MDATA_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IPSEC_CMN_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IPSEC_CMN_MDATA_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IPSEC_CMN_REDIRECT, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PVXLAN_HOST_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_PVXLAN_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_IGS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_US, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_CLMAP_DS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_VXLAN_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_MATCH, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_N2H, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_MIRROR, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_WDS, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_VLAN, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_dynamic_interface_type nss_dynamic_interface_assigned; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_message_types |  | ||||||
|  *	Message types for dynamic interface requests. |  | ||||||
|  */ |  | ||||||
| enum nss_dynamic_interface_message_types { |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ALLOC_NODE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_DEALLOC_NODE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_error_types |  | ||||||
|  *	Error types for dynamic interface requests. |  | ||||||
|  */ |  | ||||||
| enum nss_dynamic_interface_error_types { |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_EUNKNOWN = 1, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_EUNAVAIL, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_INVALID_TYPE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_INVALID_INTERFACE_NUM, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_ALLOC_FUNC_UNAVAILABLE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_DEALLOC_FUNC_UNAVAILABLE, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_EALLOC, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_IFNUM_TYPE_MISMATCH, |  | ||||||
| 	NSS_DYNAMIC_INTERFACE_ERR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_stats_notification |  | ||||||
|  *	Dynamic interface statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_dynamic_interface_notification { |  | ||||||
| 	uint32_t core_id;	/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;	/**< Dynamic interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_alloc_node_msg |  | ||||||
|  *	Message information for a dynamic interface allocation node. |  | ||||||
|  */ |  | ||||||
| struct nss_dynamic_interface_alloc_node_msg { |  | ||||||
| 	enum nss_dynamic_interface_type type;	/**< Type of dynamic interface. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Response. |  | ||||||
| 	 */ |  | ||||||
| 	int if_num;				/**< Dynamic interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_dealloc_node_msg |  | ||||||
|  *	Message information for dynamic interface deallocation node. |  | ||||||
|  */ |  | ||||||
| struct nss_dynamic_interface_dealloc_node_msg { |  | ||||||
| 	enum nss_dynamic_interface_type type; |  | ||||||
| 			/**< Type of dynamic interface. */ |  | ||||||
| 	int if_num;	/**< Dynamic interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_msg |  | ||||||
|  *	Data for sending and receiving dynamic interface messages. |  | ||||||
|  */ |  | ||||||
| struct nss_dynamic_interface_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a dynamic interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_dynamic_interface_alloc_node_msg alloc_node; |  | ||||||
| 				/**< Allocates a dynamic node. */ |  | ||||||
| 		struct nss_dynamic_interface_dealloc_node_msg dealloc_node; |  | ||||||
| 				/**< Deallocates a dynamic node. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_alloc_node |  | ||||||
|  *	Allocates a node for a dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dynamic_interface_type |  | ||||||
|  * |  | ||||||
|  * @param[in] type  Type of dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Number for the dynamic interface created. |  | ||||||
|  * @par |  | ||||||
|  * Otherwise, -1 for a failure. |  | ||||||
|  */ |  | ||||||
| extern int nss_dynamic_interface_alloc_node(enum nss_dynamic_interface_type type); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_dealloc_node |  | ||||||
|  *	Deallocates a node created for a dynamic interface on the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dynamic_interface_type |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Dynamic interface number. |  | ||||||
|  * @param[in] type    Type of dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dynamic_interface_dealloc_node(int if_num, enum nss_dynamic_interface_type type); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_is_dynamic_interface |  | ||||||
|  *	Specifies whether the interface number belongs to the dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Dynamic interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE |  | ||||||
|  */ |  | ||||||
| extern bool nss_is_dynamic_interface(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_get_nss_ctx_by_type |  | ||||||
|  *	Returns NSS context corresponding to the dynamic interface type. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dynamic_interface_type |  | ||||||
|  * |  | ||||||
|  * @param[in] type  Type of dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_dynamic_interface_get_nss_ctx_by_type(enum nss_dynamic_interface_type type); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_get_type |  | ||||||
|  *	Returns the type of dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   Interface number of dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Type of dynamic interface per the dynamic interface number. |  | ||||||
|  */ |  | ||||||
| extern enum nss_dynamic_interface_type nss_dynamic_interface_get_type(struct nss_ctx_instance *nss_ctx, int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_tx |  | ||||||
|  *	Transmits an asynchronous message to the firmware. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_dynamic_interface_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_dynamic_interface_tx(struct nss_ctx_instance *nss_ctx, struct nss_dynamic_interface_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for dynamic interface 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_dynamic_interface_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_msg_init |  | ||||||
|  *	Initializes a dynamic interface message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_dynamic_interface_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ndm       Pointer to the dynamic interface message. |  | ||||||
|  * @param[in] if_num    Dynamic interface number. |  | ||||||
|  * @param[in] type      Type of message. |  | ||||||
|  * @param[in] len       Size of the payload. |  | ||||||
|  * @param[in] cb        Pointer to the message callback. |  | ||||||
|  * @param[in] app_data  Pointer to the application context that is passed to the callback function. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_dynamic_interface_msg_init(struct nss_dynamic_interface_msg *ndm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 						void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_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_dynamic_interface_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_dynamic_interface_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_dynamic_interface_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_DYNAMIC_INTERFACE_H*/ |  | ||||||
| @@ -1,375 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_edma.h |  | ||||||
|  *	NSS EDMA interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_EDMA_H |  | ||||||
| #define __NSS_EDMA_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_edma_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * NSS EDMA port and ring defines |  | ||||||
|  */ |  | ||||||
| #define NSS_EDMA_NUM_PORTS_MAX		256 |  | ||||||
| 		/**< Maximum number of EDMA ports. */ |  | ||||||
| #define NSS_EDMA_NUM_RX_RING_MAX	16 |  | ||||||
| 		/**< Maximum number of physical EDMA Rx rings. */ |  | ||||||
| #define NSS_EDMA_NUM_RXFILL_RING_MAX	8 |  | ||||||
| 		/**< Maximum number of physical EDMA Rx fill rings. */ |  | ||||||
| #define NSS_EDMA_NUM_TX_RING_MAX	24 |  | ||||||
| 		/**< Maximum number of physical EDMA Tx rings. */ |  | ||||||
| #define NSS_EDMA_NUM_TXCMPL_RING_MAX	8 |  | ||||||
| 		/**< Maximum number of physical EDMA Tx complete rings. */ |  | ||||||
| #define NSS_EDMA_STATS_MSG_MAX_PORTS	16 |  | ||||||
| 		/**< Maximum ports processed per statistics message. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_metadata_types |  | ||||||
|  *	Message types for EDMA requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_metadata_types { |  | ||||||
| 	NSS_METADATA_TYPE_EDMA_PORT_STATS_SYNC, |  | ||||||
| 	NSS_METADATA_TYPE_EDMA_RING_STATS_SYNC, |  | ||||||
| 	NSS_METADATA_TYPE_EDMA_ERR_STATS_SYNC, |  | ||||||
| 	NSS_METADATA_TYPE_EDMA_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_port_t |  | ||||||
|  *	EDMA port types. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_port_t { |  | ||||||
| 	NSS_EDMA_PORT_PHYSICAL, |  | ||||||
| 	NSS_EDMA_PORT_VIRTUAL, |  | ||||||
| 	NSS_EDMA_PORT_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_stats_tx_t |  | ||||||
|  *	Types of EDMA Tx ring statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_stats_tx_t { |  | ||||||
| 	NSS_EDMA_STATS_TX_ERR, |  | ||||||
| 	NSS_EDMA_STATS_TX_DROPPED, |  | ||||||
| 	NSS_EDMA_STATS_TX_DESC, |  | ||||||
| 	NSS_EDMA_STATS_TX_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_stats_rx_t |  | ||||||
|  *	Types of EDMA Rx ring statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_stats_rx_t { |  | ||||||
| 	NSS_EDMA_STATS_RX_CSUM_ERR, |  | ||||||
| 	NSS_EDMA_STATS_RX_DESC, |  | ||||||
| 	NSS_EDMA_STATS_RX_QOS_ERR, |  | ||||||
| 	NSS_EDMA_STATS_RX_SRC_PORT_INVALID, |  | ||||||
| 	NSS_EDMA_STATS_RX_SRC_IF_INVALID, |  | ||||||
| 	NSS_EDMA_STATS_RX_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_stats_txcmpl_t |  | ||||||
|  *	Types of EDMA Tx complete statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_stats_txcmpl_t { |  | ||||||
| 	NSS_EDMA_STATS_TXCMPL_DESC, |  | ||||||
| 	NSS_EDMA_STATS_TXCMPL_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_stats_rxfill_t |  | ||||||
|  *	Types of EDMA Rx fill statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_stats_rxfill_t { |  | ||||||
| 	NSS_EDMA_STATS_RXFILL_DESC, |  | ||||||
| 	NSS_EDMA_STATS_RXFILL_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_port_ring_map_t |  | ||||||
|  *	Port to EDMA ring map. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_port_ring_map_t { |  | ||||||
| 	NSS_EDMA_PORT_RX_RING, |  | ||||||
| 	NSS_EDMA_PORT_TX_RING, |  | ||||||
| 	NSS_EDMA_PORT_RING_MAP_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_err_t |  | ||||||
|  *	Types of EDMA error statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_edma_err_t { |  | ||||||
| 	NSS_EDMA_AXI_RD_ERR, |  | ||||||
| 	NSS_EDMA_AXI_WR_ERR, |  | ||||||
| 	NSS_EDMA_RX_DESC_FIFO_FULL_ERR, |  | ||||||
| 	NSS_EDMA_RX_BUF_SIZE_ERR, |  | ||||||
| 	NSS_EDMA_TX_SRAM_FULL_ERR, |  | ||||||
| 	NSS_EDMA_TX_CMPL_BUF_FULL_ERR, |  | ||||||
| 	NSS_EDMA_PKT_LEN_LA64K_ERR, |  | ||||||
| 	NSS_EDMA_PKT_LEN_LE33_ERR, |  | ||||||
| 	NSS_EDMA_DATA_LEN_ERR, |  | ||||||
| 	NSS_EDMA_ALLOC_FAIL_CNT, |  | ||||||
| 	NSS_EDMA_QOS_INVAL_DST_DROPS, |  | ||||||
| 	NSS_EDMA_ERR_STATS_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_rx_ring_stats |  | ||||||
|  *	EDMA Rx ring statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_rx_ring_stats { |  | ||||||
| 	uint32_t rx_csum_err;		/**< Number of Rx checksum errors. */ |  | ||||||
| 	uint32_t desc_cnt;		/**< Number of descriptors processed. */ |  | ||||||
| 	uint32_t qos_err;		/**< Number of QoS 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. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_tx_ring_stats |  | ||||||
|  *	EDMA Tx ring statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_tx_ring_stats { |  | ||||||
| 	uint32_t tx_err;		/**< Number of Tx errors. */ |  | ||||||
| 	uint32_t tx_dropped;		/**< Number of Tx dropped packets. */ |  | ||||||
| 	uint32_t desc_cnt;		/**< Number of descriptors processed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_rxfill_ring_stats |  | ||||||
|  *	EDMA Rx fill ring statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_rxfill_ring_stats { |  | ||||||
| 	uint32_t desc_cnt;		/**< Number of descriptors processed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_txcmpl_ring_stats |  | ||||||
|  *	EDMA Tx complete ring statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_txcmpl_ring_stats { |  | ||||||
| 	uint32_t desc_cnt;		/**< Number of descriptors processed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_port_stats |  | ||||||
|  *	Statistics for each EDMA port. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_port_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	enum nss_edma_port_t port_type;		/**< Type of port. */ |  | ||||||
| 	uint16_t edma_rx_ring;			/**< Rx ring statistics. */ |  | ||||||
| 	uint16_t edma_tx_ring;			/**< Tx ring statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_port_stats_sync |  | ||||||
|  *	Statistics for a group of EDMA ports. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_port_stats_sync { |  | ||||||
| 	uint16_t start_port;		/**< Starting index of the subset. */ |  | ||||||
| 	uint16_t end_port;		/**< Ending index of the subset. */ |  | ||||||
| 	struct nss_edma_port_stats port_stats[]; |  | ||||||
| 					/**< Subset of EDMA port statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_ring_stats_sync |  | ||||||
|  *	EDMA ring statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_ring_stats_sync { |  | ||||||
| 	struct nss_edma_tx_ring_stats tx_ring[NSS_EDMA_NUM_TX_RING_MAX]; |  | ||||||
| 			/**< EDMA Tx ring statistics. */ |  | ||||||
| 	struct nss_edma_rx_ring_stats rx_ring[NSS_EDMA_NUM_RX_RING_MAX]; |  | ||||||
| 			/**< EDMA Rx ring statistics. */ |  | ||||||
| 	struct nss_edma_txcmpl_ring_stats txcmpl_ring[NSS_EDMA_NUM_TXCMPL_RING_MAX]; |  | ||||||
| 			/**< EDMA Tx complete ring statistics. */ |  | ||||||
| 	struct nss_edma_rxfill_ring_stats rxfill_ring[NSS_EDMA_NUM_RXFILL_RING_MAX]; |  | ||||||
| 			/**< EDMA Rx fill ring statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_misc_err_stats |  | ||||||
|  *	EDMA error statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_misc_err_stats { |  | ||||||
| 	uint32_t axi_rd_err;            /**< EDMA AXI read error. */ |  | ||||||
| 	uint32_t axi_wr_err;            /**< EDMA AXI write error. */ |  | ||||||
| 	uint32_t rx_desc_fifo_full_err;	/**< EDMA receive descriptor FIFO full error. */ |  | ||||||
| 	uint32_t rx_buf_size_err;       /**< EDMA receive buffer size error. */ |  | ||||||
| 	uint32_t tx_sram_full_err;      /**< EDMA transmit SRAM full error. */ |  | ||||||
| 	uint32_t tx_cmpl_buf_full_err;  /**< EDMA transmit completion buffer full error. */ |  | ||||||
| 	uint32_t pkt_len_la64k_err;     /**< EDMA packet length greater than 64k error. */ |  | ||||||
| 	uint32_t pkt_len_le33_err;      /**< EDMA packet length smaller than 33b error. */ |  | ||||||
| 	uint32_t data_len_err;          /**< EDMA data length error. */ |  | ||||||
| 	uint32_t alloc_fail_cnt;	/**< EDMA number of times the allocation of pbuf for statistics failed. */ |  | ||||||
| 	uint32_t qos_inval_dst_drops;	/**< EDMA number of QoS packet dropped due to invalid destination. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_err_stats_sync |  | ||||||
|  *	Message for error statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_err_stats_sync { |  | ||||||
| 	struct nss_edma_misc_err_stats msg_err_stats;	/**< Message for error statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_msg |  | ||||||
|  *	Data for sending and receiving EDMA messages (to synchronize with |  | ||||||
|  *	the firmware EDMA). |  | ||||||
|  */ |  | ||||||
| struct nss_edma_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an EDMA message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_edma_port_stats_sync port_stats; |  | ||||||
| 				/**< EDMA port statistics message payload. */ |  | ||||||
| 		struct nss_edma_ring_stats_sync ring_stats; |  | ||||||
| 				/**< EDMA ring statistics message payload. */ |  | ||||||
| 		struct nss_edma_err_stats_sync err_stats; |  | ||||||
| 				/**< EDMA error statistics message payload. */ |  | ||||||
| 	} msg;			/**< EDMA message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_port_info |  | ||||||
|  *	NSS EDMA port statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_port_info { |  | ||||||
| 	uint64_t port_stats[NSS_STATS_NODE_MAX]; 		/**< EDMA port statistics. */ |  | ||||||
| 	uint64_t port_type;					/**< EDMA port type. */ |  | ||||||
| 	uint64_t port_ring_map[NSS_EDMA_PORT_RING_MAP_MAX];	/**< EDMA ring statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_stats |  | ||||||
|  *	NSS EDMA node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_edma_stats { |  | ||||||
| 	struct nss_edma_port_info port[NSS_EDMA_NUM_PORTS_MAX]; |  | ||||||
| 				/**< EDMA port statistics. */ |  | ||||||
| 	uint64_t tx_stats[NSS_EDMA_NUM_TX_RING_MAX][NSS_EDMA_STATS_TX_MAX]; |  | ||||||
| 				/**< Physical EDMA Tx ring statistics. */ |  | ||||||
| 	uint64_t rx_stats[NSS_EDMA_NUM_RX_RING_MAX][NSS_EDMA_STATS_RX_MAX]; |  | ||||||
| 				/**< Physical EDMA Rx ring statistics. */ |  | ||||||
| 	uint64_t txcmpl_stats[NSS_EDMA_NUM_TXCMPL_RING_MAX][NSS_EDMA_STATS_TXCMPL_MAX]; |  | ||||||
| 				/**< Physical EDMA Tx complete statistics. */ |  | ||||||
| 	uint64_t rxfill_stats[NSS_EDMA_NUM_RXFILL_RING_MAX][NSS_EDMA_STATS_RXFILL_MAX]; |  | ||||||
| 				/**< Physical EDMA Rx fill statistics. */ |  | ||||||
| 	uint64_t misc_err[NSS_EDMA_ERR_STATS_MAX]; |  | ||||||
| 				/**< EDMA error complete statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving EDMA messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_edma_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context for this message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_edma_msg_callback_t)(void *app_data, struct nss_edma_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_notify_register |  | ||||||
|  *	Registers a callback notifier with the NSS for sending and receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_edma_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context for this message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_edma_notify_register(nss_edma_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_notify_unregister |  | ||||||
|  *	Deregisters a callback notifier from the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The callback notifier must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_edma_notify_unregister(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_get_stats |  | ||||||
|  *	Sends EDMA statistics to NSS clients. |  | ||||||
|  * |  | ||||||
|  * @param[in] stats	EDMA statistics to be sent to Netlink. |  | ||||||
|  * @param[in] port_id	EDMA port ID. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_edma_get_stats(uint64_t  *stats, int port_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_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_edma_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_edma_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_edma_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| #endif /* __KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_EDMA_H */ |  | ||||||
| @@ -1,100 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_eth_rx.h |  | ||||||
|  *	NSS Ethernet interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_ETH_RX_H |  | ||||||
| #define __NSS_ETH_RX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_eth_rx_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_eth_rx_stats |  | ||||||
|  *	Ethernet node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_eth_rx_stats { |  | ||||||
| 	NSS_ETH_RX_STATS_TOTAL_TICKS,		/**< Total clock ticks spent inside the Ethernet package. */ |  | ||||||
| 	NSS_ETH_RX_STATS_WORST_CASE_TICKS,	/**< Worst case iteration of the Ethernet in ticks. */ |  | ||||||
| 	NSS_ETH_RX_STATS_ITERATIONS,		/**< Number of iterations around Ethernet. */ |  | ||||||
| 	NSS_ETH_RX_STATS_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_eth_rx_exception_events |  | ||||||
|  *	Exception events from bridge or route handler. |  | ||||||
|  */ |  | ||||||
| enum nss_eth_rx_exception_events { |  | ||||||
| 	NSS_ETH_RX_EXCEPTION_EVENT_UNKNOWN_L3_PROTOCOL, |  | ||||||
| 	NSS_ETH_RX_EXCEPTION_EVENT_ETH_HDR_MISSING, |  | ||||||
| 	NSS_ETH_RX_EXCEPTION_EVENT_VLAN_MISSING, |  | ||||||
| 	NSS_ETH_RX_EXCEPTION_EVENT_TRUSTSEC_HDR_MISSING, |  | ||||||
| 	NSS_ETH_RX_EXCEPTION_EVENT_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_eth_rx_stats_notification |  | ||||||
|  *	Data for sending Ethernet statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_eth_rx_stats_notification { |  | ||||||
| 	uint32_t core_id;						/**< Core ID. */ |  | ||||||
| 	uint64_t cmn_node_stats[NSS_STATS_NODE_MAX];			/**< Node statistics. */ |  | ||||||
| 	uint64_t special_stats[NSS_ETH_RX_STATS_MAX];			/**< Special statistics. */ |  | ||||||
| 	uint64_t exception_stats[NSS_ETH_RX_EXCEPTION_EVENT_MAX];	/**< Exception statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_eth_rx_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_eth_rx_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_eth_rx_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_eth_rx_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *@} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_ETH_RX_H */ |  | ||||||
| @@ -1,64 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2013-2019, 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_freq.h |  | ||||||
|  *	NSS frequency definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_FREQ_H |  | ||||||
| #define __NSS_FREQ_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_freq_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_freq_change |  | ||||||
|  *	Changes the frequency of the NSS cores. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx       Pointer to the NSS context. |  | ||||||
|  * @param[in] eng           Frequency value in Hz. |  | ||||||
|  * @param[in] stats_enable  Enable NSS to send scaling statistics. |  | ||||||
|  * @param[in] start_or_end  Start or end of the frequency change. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_freq_change(struct nss_ctx_instance *nss_ctx, uint32_t eng, uint32_t stats_enable, uint32_t start_or_end); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_freq_get_cpu_usage |  | ||||||
|  *	Returns the CPU usage value in percentage at any instance for a required core. Range of usage is 0-100. |  | ||||||
|  * |  | ||||||
|  * @param[in] core_id       NSS Core ID. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * CPU usage value in percentage averaged over 1 second. -1 in case of error. |  | ||||||
|  * @note |  | ||||||
|  * This API does not support gathering CPU usage data for core 1. |  | ||||||
|  */ |  | ||||||
| extern int8_t nss_freq_get_cpu_usage(uint32_t core_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_FREQ_H */ |  | ||||||
| @@ -1,494 +0,0 @@ | |||||||
| /* |  | ||||||
|  **************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_gre.h |  | ||||||
|  *	NSS GRE interface definitions. |  | ||||||
|  */ |  | ||||||
| #ifndef _NSS_GRE_H_ |  | ||||||
| #define _NSS_GRE_H_ |  | ||||||
|  |  | ||||||
| #include <net/ip_tunnels.h> |  | ||||||
| #include <net/ip6_tunnel.h> |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_gre_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of session debug statistics |  | ||||||
|  */ |  | ||||||
| #define NSS_GRE_MAX_DEBUG_SESSION_STATS 16 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE flags |  | ||||||
|  */ |  | ||||||
| #define NSS_GRE_CONFIG_IKEY_VALID	0x00000001	/**< Incoming key of GRE header. */ |  | ||||||
| #define NSS_GRE_CONFIG_OKEY_VALID	0x00000002	/**< Key for outgoing GRE header. */ |  | ||||||
| #define NSS_GRE_CONFIG_ISEQ_VALID	0x00000004	/**< Enable sequence checking for incoming GRE traffic. */ |  | ||||||
| #define NSS_GRE_CONFIG_OSEQ_VALID	0x00000008	/**< Add sequence number for out going GRE packets. */ |  | ||||||
| #define NSS_GRE_CONFIG_ICSUM_VALID	0x00000010	/**< Validate incoming GRE header checksum. */ |  | ||||||
| #define NSS_GRE_CONFIG_OCSUM_VALID	0x00000020	/**< Add checksum header to GRE header. */ |  | ||||||
| #define NSS_GRE_CONFIG_TOS_INHERIT	0x00000040	/**< Inherit inner IP TOS to tunnel header, if not set configure provided TOS. */ |  | ||||||
| #define NSS_GRE_CONFIG_TTL_INHERIT	0x00000080	/**< Inherit inner IP TTL to tunnel header, if not set configure provided TTL. */ |  | ||||||
| #define NSS_GRE_CONFIG_SET_DF		0x00000100	/**< Enable DF bit on tunnel IP header. */ |  | ||||||
| #define NSS_GRE_CONFIG_SET_MAC		0x00000200	/**< Add MAC header to GRE+IP tunnel header. */ |  | ||||||
| #define NSS_GRE_CONFIG_SET_PADDING	0x00000400	/**< Add PADDING to align tunnel IP/GRE header. */ |  | ||||||
| #define NSS_GRE_CONFIG_NEXT_NODE_AVAILABLE  0x00000800	/**< Use provided next node instead of existing next node. */ |  | ||||||
| #define NSS_GRE_CONFIG_COPY_METADATA 	0x00001000	/**< Enable metadata copy in NSS during alignment. */ |  | ||||||
| #define NSS_GRE_CONFIG_USE_UNALIGNED 	0x00002000	/**< Use unaligned infrastructure in NSS. */ |  | ||||||
| #define NSS_GRE_CONFIG_DSCP_VALID	0x00004000	/**< Add DSCP per packet. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_error_types. |  | ||||||
|  *	Error types for GRE configuration messages. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_error_types { |  | ||||||
| 	NSS_GRE_ERR_UNKNOWN_MSG = 1,		/**< Unknown message. */ |  | ||||||
| 	NSS_GRE_ERR_IF_INVALID = 2,		/**< Invalid interface. */ |  | ||||||
| 	NSS_GRE_ERR_MODE_INVALID = 3,		/**< Invalid mode type. */ |  | ||||||
| 	NSS_GRE_ERR_IP_INVALID = 4,		/**< Invalid IP type. */ |  | ||||||
| 	NSS_GRE_ERR_GRE_SESSION_PARAMS_INVALID = 5,	/**< Invalid GRE session parameters provided. */ |  | ||||||
| 	NSS_GRE_ERR_DSCP_CFG_INVALID = 6,	/**< Both TOS and DSCP flags are enabled. */ |  | ||||||
| 	NSS_GRE_ERR_MAX,			/**< Maximum GRE error. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_info |  | ||||||
|  *	GRE private information. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_info { |  | ||||||
| 	/** |  | ||||||
| 	 * Union of IPv4/IPv6 tunnel. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct ip_tunnel t4;		/**< IPv4 tunnel. */ |  | ||||||
| 		struct ip6_tnl t6;		/**< IPv6 tunnel. */ |  | ||||||
| 	} t;		/**< IPv4 and IPv6 tunnel. */ |  | ||||||
| 	int nss_if_number_inner;		/**< NSS interface number for GRE inner. */ |  | ||||||
| 	struct net_device *next_dev_inner;	/**< Next network device for inner flow. */ |  | ||||||
| 	struct net_device *next_dev_outer;	/**< Next network device for outer flow. */ |  | ||||||
| 	uint8_t gre_hlen;			/**< GRE header length. */ |  | ||||||
| 	uint8_t pad_len;			/**< Pad length. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_msg_types |  | ||||||
|  *	Message types for GRE requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_msg_types { |  | ||||||
| 	NSS_GRE_MSG_ENCAP_CONFIGURE = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_GRE_MSG_DECAP_CONFIGURE, |  | ||||||
| 	NSS_GRE_MSG_ENCAP_DECONFIGURE, |  | ||||||
| 	NSS_GRE_MSG_DECAP_DECONFIGURE, |  | ||||||
| 	NSS_GRE_MSG_SESSION_STATS, |  | ||||||
| 	NSS_GRE_MSG_BASE_STATS, |  | ||||||
| 	NSS_GRE_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE Mode Types |  | ||||||
|  */ |  | ||||||
| enum nss_gre_mode { |  | ||||||
| 	NSS_GRE_MODE_TUN,	/**< GRE Tunnel interface. */ |  | ||||||
| 	NSS_GRE_MODE_TAP,	/**< GRE Tap interface. */ |  | ||||||
| 	NSS_GRE_MODE_MAX	/**< Maxmum GRE mode. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE IP Types |  | ||||||
|  */ |  | ||||||
| enum nss_gre_ip_types { |  | ||||||
| 	NSS_GRE_IP_IPV4,	/**<  Outer Tunnel is IPV4. */ |  | ||||||
| 	NSS_GRE_IP_IPV6,	/**<  Outer Tunnel is IPV6. */ |  | ||||||
| 	NSS_GRE_IP_MAX,		/**<  Maximum IP Types. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_base_types |  | ||||||
|  *	GRE base debug statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_base_types { |  | ||||||
| 	NSS_GRE_BASE_RX_PACKETS,		/**< Receive packet count. */ |  | ||||||
| 	NSS_GRE_BASE_RX_DROPPED,		/**< Number of packet dropped at receive. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_ETH_HDR_MISSING,	/**< Ethernet header missing. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_ETH_TYPE_NON_IP,	/**< Packet is not IPV4 or IPV6. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_UNKNOWN_PROTOCOL,	/**< Packet protocol is unknown. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_HEADER_INCOMPLETE,	/**< Bad IP header. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_BAD_TOTAL_LENGTH,	/**< IP total length is invalid. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_BAD_CHECKSUM,	/**< IP checksum is bad. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_DATAGRAM_INCOMPLETE,/**< Bad packet. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_FRAGMENT,		/**< IP packet is a fragment. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_OPTIONS_INCOMPLETE,	/**< IP option is invalid. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IP_WITH_OPTIONS,	/**< IP packet with options. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IPV6_UNKNOWN_PROTOCOL,	/**< Protocol is unknown. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_IPV6_HEADER_INCOMPLETE,/**< Incomplete ipv6 header. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_GRE_UNKNOWN_SESSION,	/**< Unknown GRE session. */ |  | ||||||
| 	NSS_GRE_BASE_EXP_GRE_NODE_INACTIVE,	/**< GRE node is inactive. */ |  | ||||||
| 	NSS_GRE_BASE_DEBUG_MAX,			/**< GRE base debug maximum. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_session_types |  | ||||||
|  *	GRE session packet drop and exception events. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_session_types { |  | ||||||
| 	NSS_GRE_SESSION_PBUF_ALLOC_FAIL,		/**< Pbuf allocation failure. */ |  | ||||||
| 	NSS_GRE_SESSION_DECAP_FORWARD_ENQUEUE_FAIL,	/**< Receive forward enqueue failure. */ |  | ||||||
| 	NSS_GRE_SESSION_ENCAP_FORWARD_ENQUEUE_FAIL,	/**< Transmit forward enqueue failure. */ |  | ||||||
| 	NSS_GRE_SESSION_DECAP_TX_FORWARDED,		/**< Number of packets forwarded after decapsulation. */ |  | ||||||
| 	NSS_GRE_SESSION_ENCAP_RX_RECEIVED,		/**< Number of packets received for encapsulation. */ |  | ||||||
| 	NSS_GRE_SESSION_ENCAP_RX_DROPPED,		/**< Packets dropped while enqueuing for encapsulation. */ |  | ||||||
| 	NSS_GRE_SESSION_ENCAP_RX_LINEAR_FAIL,		/**< Packets dropped during encapsulation linearization. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_KEY_ERROR,		/**< Receive key error. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_SEQ_ERROR,		/**< Receive Sequence number error. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_CS_ERROR,		/**< Receive checksum error */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_FLAG_MISMATCH,		/**< Receive flag mismatch. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_MALFORMED,		/**< Receive packet is malformed. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_INVALID_PROTOCOL,	/**< Receive packet protocol is invalid. */ |  | ||||||
| 	NSS_GRE_SESSION_EXP_RX_NO_HEADROOM,		/**< Packet does not have enough headroom. */ |  | ||||||
| 	NSS_GRE_SESSION_DEBUG_MAX,			/**< Session debug maximum. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE create message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_config_msg { |  | ||||||
| 	uint32_t src_ip[4];			/**< Source IPv4 or IPv6 Adddress. */ |  | ||||||
| 	uint32_t dest_ip[4];			/**< Destination IPv4 or IPv6 Adddress. */ |  | ||||||
| 	uint32_t flags;				/**< GRE Flags. */ |  | ||||||
| 	uint32_t ikey;				/**< GRE rx KEY.*/ |  | ||||||
| 	uint32_t okey;				/**< GRE tx KEY. */ |  | ||||||
| 	uint32_t mode;				/**< GRE TUN or TAP. */ |  | ||||||
| 	uint32_t ip_type;			/**< IPv4 or IPv6 type. */ |  | ||||||
| 	uint32_t next_node_if_num;		/**< To whom to forward packets. */ |  | ||||||
| 	uint32_t sibling_if_num;        	/**< Sibling interface number. */ |  | ||||||
| 	uint16_t src_mac[3];			/**< Source MAC address. */ |  | ||||||
| 	uint16_t dest_mac[3];			/**< Destination MAC address. */ |  | ||||||
| 	uint8_t ttl;				/**< TTL or HOPLIMIT. */ |  | ||||||
| 	uint8_t tos;				/**< Type of service. */ |  | ||||||
| 	uint16_t metadata_size;			/**< Metadata copy size. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE link up message structure |  | ||||||
|  */ |  | ||||||
| struct nss_gre_linkup_msg { |  | ||||||
| 	int if_number;			/**< Interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE link down message structure |  | ||||||
|  */ |  | ||||||
| struct nss_gre_linkdown_msg { |  | ||||||
| 	int if_number;			/**< Interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE deconfig message structure |  | ||||||
|  */ |  | ||||||
| struct nss_gre_deconfig_msg { |  | ||||||
| 	int if_number;			/**< Interface number */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE session statistics message |  | ||||||
|  */ |  | ||||||
| struct nss_gre_session_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */ |  | ||||||
| 	uint32_t stats[NSS_GRE_SESSION_DEBUG_MAX];	/**< Session debug statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * GRE base statistics message |  | ||||||
|  */ |  | ||||||
| struct nss_gre_base_stats_msg { |  | ||||||
| 	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. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_msg |  | ||||||
|  *	Message structure to send/receive GRE messages |  | ||||||
|  */ |  | ||||||
| struct nss_gre_msg { |  | ||||||
| 	struct nss_cmn_msg cm;					/**< Common message header */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a GRE message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_config_msg cmsg;			/**< GRE session config message. */ |  | ||||||
| 		struct nss_gre_deconfig_msg dmsg;		/**< GRE session deconfig message. */ |  | ||||||
| 		struct nss_gre_linkup_msg linkup;		/**< GRE link up message. */ |  | ||||||
| 		struct nss_gre_linkdown_msg linkdown;		/**< GRE link down message. */ |  | ||||||
| 		struct nss_gre_session_stats_msg sstats;	/**< GRE session statistics message. */ |  | ||||||
| 		struct nss_gre_base_stats_msg bstats;		/**< Base statistics message. */ |  | ||||||
| 	} msg;							/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function to receive GRE messages |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_gre_msg_callback_t)(void *app_data, struct nss_gre_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tx_msg |  | ||||||
|  *	Sends GRE messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tx_msg_sync |  | ||||||
|  *	Sends GRE messages to the NSS synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tx_buf |  | ||||||
|  *	Sends packet to the NSS |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   Nss interface number. |  | ||||||
|  * @param[in] skb      Pointer to sk_buff. |  | ||||||
|  * |  | ||||||
|  * @return Tx status |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_get_context. |  | ||||||
|  *	Gets the GRE context used in nss_gre_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * |  | ||||||
|  * nss_gre_ifnum_with_core_id |  | ||||||
|  * 	Append core ID on GRE interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * GRE interface number with core ID. |  | ||||||
|  */ |  | ||||||
| extern int nss_gre_ifnum_with_core_id(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE session 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_gre_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_register_if |  | ||||||
|  *	Registers the GRE interface with the NSS for sending and |  | ||||||
|  *	receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_data_callback_t \n |  | ||||||
|  * nss_gre_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num         NSS interface number. |  | ||||||
|  * @param[in] type           NSS interface type. |  | ||||||
|  * @param[in] gre_callback   Callback for the data. |  | ||||||
|  * @param[in] msg_callback   Callback for the message. |  | ||||||
|  * @param[in] netdev         Pointer to the associated network device. |  | ||||||
|  * @param[in] features       Socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_register_if(uint32_t if_num, uint32_t type, nss_gre_data_callback_t gre_callback, |  | ||||||
| 					nss_gre_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_unregister_if |  | ||||||
|  *	Deregisters the GRE interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
| . * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_msg_init |  | ||||||
|  *	Initializes a GRE message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    Interface number |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_msg_init(struct nss_gre_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_register_handler |  | ||||||
|  *	Registers the GRE interface with the NSS debug statistics handler. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for updating stats. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff \n |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] skb     Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_gre_pkt_callback_t)(struct net_device *netdev, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_register_pkt_callback |  | ||||||
|  *	Register for rx packet call back. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_pkt_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb  Call back function which needs to be registered. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_register_pkt_callback(nss_gre_pkt_callback_t cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_unregister_pkt_callback |  | ||||||
|  *	Unregister for rx packet call back. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_pkt_callback_t |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_GRE_H_ */ |  | ||||||
| @@ -1,712 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2015, 2017-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_gre_redir.h |  | ||||||
|  *	NSS GRE Redirect interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_GRE_REDIR_H |  | ||||||
| #define __NSS_GRE_REDIR_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_gre_redirect_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_GRE_REDIR_MAX_INTERFACES 24			/**< Maximum number of redirect interfaces. */ |  | ||||||
| #define NSS_GRE_REDIR_IP_DF_OVERRIDE_FLAG 0x80		/**< Override Do not Fragment bit in IPv4 flags. */ |  | ||||||
| #define NSS_GRE_REDIR_PER_PACKET_METADATA_OFFSET 4	/**< Offset of per packet metadata from start of packet. */ |  | ||||||
| #define NSS_GRE_REDIR_MAX_RADIO 5			/**< Maximum number of radios. */ |  | ||||||
| #define NSS_GRE_REDIR_HEADER_VERSION 0			/**< Version for GRE header. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_ip_hdr_type |  | ||||||
|  *	IP header types. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_ip_hdr_type { |  | ||||||
| 	NSS_GRE_REDIR_IP_HDR_TYPE_IPV4 = 1, |  | ||||||
| 	NSS_GRE_REDIR_IP_HDR_TYPE_IPV6 = 2, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_message_types |  | ||||||
|  *	Message types for GRE redirect requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_message_types { |  | ||||||
| 	NSS_GRE_REDIR_TX_TUNNEL_INNER_CONFIGURE_MSG,	/**< Configure message for inner node. */ |  | ||||||
| 	NSS_GRE_REDIR_TX_TUNNEL_OUTER_CONFIGURE_MSG,	/**< Configure message for outer node. */ |  | ||||||
| 	NSS_GRE_REDIR_TX_INTERFACE_MAP_MSG,		/**< Interface map message. */ |  | ||||||
| 	NSS_GRE_REDIR_TX_INTERFACE_UNMAP_MSG,		/**< Interface unmap message. */ |  | ||||||
| 	NSS_GRE_REDIR_TX_SJACK_MAP_MSG,			/**< SJACK map message. */ |  | ||||||
| 	NSS_GRE_REDIR_TX_SJACK_UNMAP_MSG,		/**< SJACK unmap message. */ |  | ||||||
| 	NSS_GRE_REDIR_RX_STATS_SYNC_MSG,		/**< Statistics synchronization message. */ |  | ||||||
| 	NSS_GRE_REDIR_EXCEPTION_DS_REG_CB_MSG,		/**< Configure message to register callback. */ |  | ||||||
| 	NSS_GRE_REDIR_MAX_MSG_TYPES,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_error_types |  | ||||||
|  *	Error types for GRE redirect configuration messages. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_error_types { |  | ||||||
| 	NSS_GRE_REDIR_ERROR_NONE,			/**< Configuration successful. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_UNKNOWN_MSG_TYPE,		/**< Unknown configuration message type error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_INVALID_IP_HDR_TYPE,	/**< Invalid IP header type error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_MAP_TABLE_FULL,		/**< Map table full error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_MAP_INVALID_PARAM,		/**< Invalid parameter with map message error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_UNMAP_INVALID_PARAM,	/**< Invalid parameter with unmap message error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_ENCAP_MAP_EXIST,		/**< Encapsulation map entry already exist. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_DECAP_MAP_EXIST,		/**< Decapsulation map entry already exist. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_ENCAP_MAP_ALLOC_FAIL,	/**< Encapsulation map entry allocation failure error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_DECAP_MAP_ALLOC_FAIL,	/**< Decapsulation map entry allocation failure error. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_ENCAP_ENTRY_UNMAPPED,	/**< Encapsulation map entry already unmapped. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_DECAP_ENTRY_UNMAPPED,	/**< Decapsulation map entry already unmapped. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_INVALID_ETH_IF,		/**< Invalid Ethernet NSS interface. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_INVALID_VAP_NEXTHOP_IF,	/**< Invalid nexthop NSS interface. */ |  | ||||||
| 	NSS_GRE_REDIR_ERROR_INVALID_PEER_INTERFACE,	/**< Invalid peer interface during tunnel configuration. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_tunnel_types |  | ||||||
|  *	GRE tunnel types. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_tunnel_types { |  | ||||||
| 	NSS_GRE_REDIR_TUNNEL_TYPE_UNKNOWN,	/**< Reserved. */ |  | ||||||
| 	NSS_GRE_REDIR_TUNNEL_TYPE_TUN,		/**< Tunnel mode. */ |  | ||||||
| 	NSS_GRE_REDIR_TUNNEL_TYPE_DTUN,		/**< D-tunnel mode. */ |  | ||||||
| 	NSS_GRE_REDIR_TUNNEL_TYPE_SPLIT,	/**< Split mode. */ |  | ||||||
| 	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 |  | ||||||
|  *	Message information for configuring GRE inner node. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_inner_configure_msg { |  | ||||||
| 	uint32_t ip_hdr_type;	/**< IP header type (IPv4 or IPv6). */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPv4 or IPv6 source address (lower 4 bytes are applicable for IPv4). |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t ip_src_addr[4]; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPv4 or IPv6 destination address (lower 4 bytes are applicable for IPv4). |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t ip_dest_addr[4]; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * The host outer-interface which handles post-encapsulation exception packets |  | ||||||
| 	 * originating from this inner interface. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t except_outerif; |  | ||||||
|  |  | ||||||
| 	uint8_t ip_df_policy;	/**< Default Do Not Fragment policy for the IP header. */ |  | ||||||
| 	uint8_t ip_ttl;		/**< Time-to-live value for the IP header. */ |  | ||||||
| 	uint8_t gre_version;	/**< Header version. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_outer_configure_msg |  | ||||||
|  *	Message information for configuring GRE outer node. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_outer_configure_msg { |  | ||||||
| 	uint32_t ip_hdr_type;		     /**< IP header type (IPv4 or IPv6). */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * The host inner-interface which handles post-decapsulation exception packets |  | ||||||
| 	 * originating from this outer interface, for flows destined to a VAP handled |  | ||||||
| 	 * by host. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t except_hostif; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * The host inner-interface which handles post-decapsulation exception packets |  | ||||||
| 	 * originating from this outer interface, for flows destined to a VAP handled |  | ||||||
| 	 * by NSS. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t except_offlif; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * The host inner-interface which handles post-decapsulation exception packets |  | ||||||
| 	 * originating from this outer interface, for flows destined to SJACK. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t except_sjackif; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * CPU core to which these packets should be steered. |  | ||||||
| 	 * - 0 -- Use core 0 |  | ||||||
| 	 * - 1 -- Use core 1 |  | ||||||
| 	 * - 2 -- Use core 2 |  | ||||||
| 	 * - 3 -- Use core 3 |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t rps_hint; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Flag to indicate validity of RPS hint. |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t rps_hint_valid; |  | ||||||
|  |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_exception_ds_reg_cb_msg |  | ||||||
|  *	Message information to register callback on VAP for GRE exception downstream. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_exception_ds_reg_cb_msg { |  | ||||||
| 	uint32_t dst_vap_nssif;	/**< NSS VAP interface on which the callback is registered. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_interface_map_msg |  | ||||||
|  *	Message information for adding a VAP interface-to-tunnel ID mapping. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_interface_map_msg { |  | ||||||
| 	uint32_t vap_nssif;			/**< NSS VAP interface. */ |  | ||||||
| 	uint32_t nexthop_nssif;			/**< Next hop NSS interface number. */ |  | ||||||
| 	uint16_t radio_id;			/**< Radio ID to derive tunnel ID. */ |  | ||||||
| 	uint16_t vap_id;			/**< VAP ID to derive tunnel ID. */ |  | ||||||
| 	uint16_t lag_en;			/**< Flag for LAG mode. */ |  | ||||||
| 	uint16_t tunnel_type;			/**< Type of tunnel. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPsec security association pattern. Pattern |  | ||||||
| 	 * 0x5A is supported only. |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t ipsec_pattern; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_interface_unmap_msg |  | ||||||
|  *	Message information for deleting a VAP interface-to-tunnel ID mapping. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_interface_unmap_msg { |  | ||||||
| 	uint32_t vap_nssif;	/**< NSS VAP interface. */ |  | ||||||
| 	uint16_t radio_id;	/**< Radio ID to derive tunnel ID. */ |  | ||||||
| 	uint16_t vap_id;	/**< VAP ID to derive tunnel ID. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_sjack_map_msg |  | ||||||
|  *	Message information for adding an Ethernet interface-to-tunnel ID mapping. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_sjack_map_msg { |  | ||||||
| 	uint32_t eth_nssif;			/**< NSS Ethernet interface number. */ |  | ||||||
| 	uint32_t eth_id;			/**< Ethernet interface ID. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPsec security association pattern. Pattern |  | ||||||
| 	 * 0x5A is supported only. |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t ipsec_pattern; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_sjack_unmap_msg |  | ||||||
|  *	Message information for deleting an Ethernet interface-to-tunnel ID mapping. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_sjack_unmap_msg { |  | ||||||
| 	uint32_t eth_nssif;	/**< NSS Ethernet interface number. */ |  | ||||||
| 	uint32_t eth_id;	/**< Ethernet interface ID. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_stats_sync_msg |  | ||||||
|  *	Message information for synchronized GRE redirect statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */ |  | ||||||
| 	uint32_t sjack_rx_packets;			/**< SJACK packet counter. */ |  | ||||||
| 	uint32_t offl_rx_pkts[NSS_GRE_REDIR_MAX_RADIO];	/**< Offload packet counter. */ |  | ||||||
| 	uint32_t encap_sg_alloc_drop;			/**< Encapsulation drop counters due to scatter gather buffer allocation failure. */ |  | ||||||
| 	uint32_t decap_fail_drop;			/**< Decapsulation drop counters due to invalid IP header. */ |  | ||||||
| 	uint32_t decap_split_drop;			/**< Decapsulation drop counters due to split flow processing. */ |  | ||||||
| 	uint32_t split_sg_alloc_fail;			/**< Split processing fail counter due to scatter gather buffer allocation failure. */ |  | ||||||
| 	uint32_t split_linear_copy_fail;		/**< Split processing fail counter due to linear copy fail. */ |  | ||||||
| 	uint32_t split_not_enough_tailroom;		/**< Split processing fail counter due to insufficient tailroom. */ |  | ||||||
| 	uint32_t exception_ds_invalid_dst_drop;		/**< Downstream exception handling fail counter due to invalid destination. */ |  | ||||||
| 	uint32_t decap_eapol_frames;			/**< Decapsulation EAPoL frame counters. */ |  | ||||||
| 	uint32_t exception_ds_inv_appid;		/**< Invalid application ID for the Tx completion packets on exception downstream node. */ |  | ||||||
| 	uint32_t headroom_unavail;			/**< Packet headroom unavailable to write metadata. */ |  | ||||||
| 	uint32_t tx_completion_success;			/**< Host enqueue success 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 |  | ||||||
|  *	GRE redirect statistics as seen by the HLOS. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_tunnel_stats { |  | ||||||
| 	struct net_device *dev;			/**< Net device. */ |  | ||||||
| 	struct nss_gre_redir_tun_stats tstats;	/**< Structure to accumulate all the 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 |  | ||||||
|  *	Data for sending and receiving GRE tunnel redirect messages. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a GRE tunnel redirect message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_redir_inner_configure_msg inner_configure; |  | ||||||
| 				/**< Configure a GRE inner node. */ |  | ||||||
| 		struct nss_gre_redir_outer_configure_msg outer_configure; |  | ||||||
| 				/**< Configure a GRE outer node. */ |  | ||||||
| 		struct nss_gre_redir_interface_map_msg interface_map; |  | ||||||
| 				/**< Add a VAP interface-to-tunnel ID mapping. */ |  | ||||||
| 		struct nss_gre_redir_interface_unmap_msg interface_unmap; |  | ||||||
| 				/**< Delete a VAP interafce-to-tunnel ID mapping. */ |  | ||||||
| 		struct nss_gre_redir_sjack_map_msg sjack_map; |  | ||||||
| 				/**< Add an Ethernet interface-to-tunnel ID mapping for SJACK. */ |  | ||||||
| 		struct nss_gre_redir_sjack_unmap_msg sjack_unmap; |  | ||||||
| 				/**< Delete an Ethernet interface-to-tunnel ID mapping for SJACK. */ |  | ||||||
| 		struct nss_gre_redir_stats_sync_msg stats_sync; |  | ||||||
| 				/**< Synchronized tunnel statistics. */ |  | ||||||
| 		struct nss_gre_redir_exception_ds_reg_cb_msg exception_ds_configure; |  | ||||||
| 				/**< Registering callback on VAP for the GRE downstream flows. */ |  | ||||||
| 	} msg;			/**< Message payload for GRE redirect messages exchanged with NSS core. */ |  | ||||||
|  |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_encap_per_pkt_metadata |  | ||||||
|  *	Metadata information for an HLOS-to-NSS packet. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_encap_per_pkt_metadata { |  | ||||||
| 	uint16_t gre_tunnel_id;			/**< ID of the tunnel. */ |  | ||||||
| 	uint8_t gre_flags;			/**< Flags field from GRE header. */ |  | ||||||
| 	uint8_t gre_prio;			/**< Priority field from GRE header. */ |  | ||||||
| 	uint8_t gre_seq;			/**< Sequence number. */ |  | ||||||
| 	uint8_t ip_dscp;			/**< DSCP values. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Override the default DF policy for the packet by setting bit 8. |  | ||||||
| 	 * The lower 7 bits provide the DF value to be used for this packet. |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t ip_df_override; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPsec security association pattern. Pattern |  | ||||||
| 	 * 0x5A is supported only. |  | ||||||
| 	 */ |  | ||||||
| 	uint8_t ipsec_pattern; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_decap_per_pkt_metadata |  | ||||||
|  *	Metadata information for an NSS-to-HLOS packet. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_decap_per_pkt_metadata { |  | ||||||
| 	uint32_t src_if_num;    /**< Number of the source Ethernet interface. */ |  | ||||||
| 	uint16_t gre_tunnel_id; /**< ID of the tunnel. */ |  | ||||||
| 	uint8_t gre_flags;	/**< Flags from GRE header. */ |  | ||||||
| 	uint8_t gre_prio;	/**< Priority from GRE header. */ |  | ||||||
| 	uint8_t gre_seq;	/**< Sequence number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_exception_us_metadata |  | ||||||
|  *	Metadata information for upstream exception packet. |  | ||||||
|  * |  | ||||||
|  * Note: Additional fields need to be added by customer as required. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_exception_us_metadata { |  | ||||||
| 	uint8_t tid;		/**< TID value. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_exception_ds_metadata |  | ||||||
|  *	Metadata information for downstream exception packet. |  | ||||||
|  * |  | ||||||
|  * Note: Additional fields need to be added by customer as required. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_exception_ds_metadata { |  | ||||||
| 	uint32_t dst_vap_nssif;	/**< Destination VAP interface number. */ |  | ||||||
| 	uint8_t tid;		/**< TID value. */ |  | ||||||
| 	uint8_t app_id;		/**< Application ID. */ |  | ||||||
| 	uint16_t hw_hash_idx;	/**< Hardware AST hash index value. */ |  | ||||||
| 	uint32_t tx_status;	/**< Tx status. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE tunnel 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_gre_redir_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE tunnel 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_gre_redir_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_unregister_if |  | ||||||
|  *	Deregisters a GRE 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_gre_redir_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_tx_msg |  | ||||||
|  *	Sends GRE redirect tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_tx_buf |  | ||||||
|  *	Sends GRE redirect tunnel packets. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g., skbuff). |  | ||||||
|  * @param[in] if_num   Tunnel interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 		uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_tx_buf_noreuse |  | ||||||
|  *	Sends GRE redirect tunnel packets. |  | ||||||
|  * |  | ||||||
|  * Note: The buffers will be not be reused or |  | ||||||
|  * kept in the accelerator. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g., skbuff). |  | ||||||
|  * @param[in] if_num   Tunnel interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_tx_buf_noreuse(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 			uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_stats_get |  | ||||||
|  *	Gets GRE redirect tunnel statistics. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_tunnel_stats |  | ||||||
|  * |  | ||||||
|  * @param[in]  index  Index in the tunnel statistics array. |  | ||||||
|  * @param[out] stats  Pointer to the tunnel statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  */ |  | ||||||
| extern bool nss_gre_redir_stats_get(int index, struct nss_gre_redir_tunnel_stats *stats); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_alloc_and_register_node |  | ||||||
|  *	Allocates and registers GRE redirect dynamic node with NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_gre_redir_data_callback_t \n |  | ||||||
|  * nss_gre_redir_msg_callback_t \n |  | ||||||
|  * |  | ||||||
|  * @param[in] dev      Pointer to the associated network device. |  | ||||||
|  * @param[in] data_cb  Callback for the data. |  | ||||||
|  * @param[in] msg_cb   Callback for the message. |  | ||||||
|  * @param[in] type     Type of dynamic node. |  | ||||||
|  * @param[in] app_ctx  Application context for notify callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS interface number allocated. |  | ||||||
|  */ |  | ||||||
| extern int nss_gre_redir_alloc_and_register_node(struct net_device *dev, |  | ||||||
| 		nss_gre_redir_data_callback_t data_cb, |  | ||||||
| 		nss_gre_redir_msg_callback_t msg_cb, |  | ||||||
| 		uint32_t type, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_configure_inner_node |  | ||||||
|  *	Configures inner GRE redirect node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_inner_configure_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum              NSS interface number. |  | ||||||
|  * @param[in] ngrcm              Inner node configuration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_configure_inner_node(int ifnum, |  | ||||||
| 		struct nss_gre_redir_inner_configure_msg *ngrcm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_configure_outer_node |  | ||||||
|  *	Configures outer GRE redirect node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_outer_configure_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum              NSS interface number. |  | ||||||
|  * @param[in] ngrcm              Outer node configuration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_configure_outer_node(int ifnum, |  | ||||||
| 		struct nss_gre_redir_outer_configure_msg *ngrcm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_exception_ds_reg_cb |  | ||||||
|  *	Configure a callback on VAP for downstream GRE exception flows. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_exception_ds_reg_cb_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum              NSS interface number. |  | ||||||
|  * @param[in] ngrcm              Downstream exception callback registration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_exception_ds_reg_cb(int ifnum, |  | ||||||
| 		struct nss_gre_redir_exception_ds_reg_cb_msg *ngrcm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_tx_msg_sync |  | ||||||
|  *	Sends messages to NSS firmware synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  NSS core context. |  | ||||||
|  * @param[in] ngrm     Pointer to GRE redirect message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_msg *ngrm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_get_context |  | ||||||
|  *	Gets the GRE redirect context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_redir_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_get_dentry |  | ||||||
|  *	Returns directory entry created in debugfs for statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to created directory entry for GRE redirect. |  | ||||||
|  */ |  | ||||||
| extern struct dentry *nss_gre_redir_get_dentry(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_get_device |  | ||||||
|  *	Gets the original device from probe. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the device. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_GRE_REDIR_H */ |  | ||||||
| @@ -1,732 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above 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_gre_redir_lag.h |  | ||||||
|  *	NSS GRE redirect LAG interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_GRE_REDIR_LAG_H |  | ||||||
| #define __NSS_GRE_REDIR_LAG_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_gre_redirect_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_GRE_REDIR_LAG_MAX_NODE 12			/**< Maximum number of LAG nodes. */ |  | ||||||
| #define NSS_GRE_REDIR_LAG_MAX_SLAVE 8			/**< Maximum number of GRE redirect nodes per LAG node. */ |  | ||||||
| #define NSS_GRE_REDIR_LAG_MIN_SLAVE 2			/**< Minimum required GRE redirect nodes per LAG node. */ |  | ||||||
| #define NSS_GRE_REDIR_LAG_US_STATS_SYNC_RETRY 3		/**< Number of retries for sending query hash messages. */ |  | ||||||
| #define NSS_GRE_REDIR_LAG_US_MAX_HASH_PER_MSG 80	/**< Maximum hash entries per message. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_gre_redir_lag_err_types |  | ||||||
|  *	GRE redirect LAG error types. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_lag_err_types { |  | ||||||
| 	NSS_GRE_REDIR_LAG_SUCCESS, |  | ||||||
| 	NSS_GRE_REDIR_LAG_ERR_INCORRECT_IFNUM, |  | ||||||
| 	NSS_GRE_REDIR_LAG_ERR_CORE_UNREGISTER_FAILED, |  | ||||||
| 	NSS_GRE_REDIR_LAG_ERR_STATS_INDEX_NOT_FOUND, |  | ||||||
| 	NSS_GRE_REDIR_LAG_ERR_DEALLOC_FAILED, |  | ||||||
| 	NSS_GRE_REDIR_LAG_ERR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_message_types |  | ||||||
|  *	GRE redirect LAG upstream message types. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_lag_us_message_types { |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_CONFIG_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_ADD_HASH_NODE_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_DEL_HASH_NODE_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_QUERY_HASH_NODE_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_CMN_STATS_SYNC_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_DB_HASH_NODE_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_message_types |  | ||||||
|  *	GRE redirect LAG downstream message types. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_lag_ds_message_types { |  | ||||||
| 	NSS_GRE_REDIR_LAG_DS_ADD_STA_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_DS_DEL_STA_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_DS_UPDATE_STA_MSG, |  | ||||||
| 	NSS_GRE_REDIR_LAG_DS_STATS_SYNC_MSG, |  | ||||||
| 	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 |  | ||||||
|  *	GRE redirect LAG upstream hash modes. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_lag_us_hash_mode { |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_HASH_MODE_SRC_AND_DEST, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_HASH_MODE_SRC, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_HASH_MODE_DEST, |  | ||||||
| 	NSS_GRE_REDIR_LAG_US_HASH_MODE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_config_msg |  | ||||||
|  *	Upstream configure message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_config_msg { |  | ||||||
| 	uint32_t hash_mode;					/**< Hash operating mode. */ |  | ||||||
| 	uint32_t num_slaves;					/**< Number of slaves. */ |  | ||||||
| 	uint32_t if_num[NSS_GRE_REDIR_LAG_MAX_SLAVE];		/**< NSS interface numbers of GRE redirect tunnels. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_add_hash_node_msg |  | ||||||
|  *	Message to add hash entry. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_add_hash_node_msg { |  | ||||||
| 	uint32_t if_num;			/**< NSS interface number of GRE redirect. */ |  | ||||||
| 	uint16_t src_mac[ETH_ALEN / 2];		/**< Source MAC address. */ |  | ||||||
| 	uint16_t dest_mac[ETH_ALEN / 2];	/**< Destination MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_del_hash_node_msg |  | ||||||
|  *	Message to delete hash entry. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_del_hash_node_msg { |  | ||||||
| 	uint16_t src_mac[ETH_ALEN / 2];		/**< Source MAC address. */ |  | ||||||
| 	uint16_t dest_mac[ETH_ALEN / 2];	/**< Destination MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_query_hash_node_msg |  | ||||||
|  *	Message to query if a hash entry is present. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_query_hash_node_msg { |  | ||||||
| 	uint16_t src_mac[ETH_ALEN / 2];		/**< Source MAC address. */ |  | ||||||
| 	uint16_t dest_mac[ETH_ALEN / 2];	/**< Destination MAC address. */ |  | ||||||
| 	uint32_t ifnum;				/**< NSS interface number of GRE redirect. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_cmn_sync_stats |  | ||||||
|  *	GRE redirect LAG upstream statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_cmn_sync_stats { |  | ||||||
| 	uint32_t amsdu_pkts;			/**< Number of AMSDU packets seen. */ |  | ||||||
| 	uint32_t amsdu_pkts_enqueued;		/**< Number of AMSDU packets enqueued. */ |  | ||||||
| 	uint32_t amsdu_pkts_exceptioned;	/**< Number of AMSDU packets exceptioned. */ |  | ||||||
| 	uint32_t exceptioned;			/**< Number of exceptioned packets. */ |  | ||||||
| 	uint32_t freed;				/**< Number of freed packets. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_cmn_db_sync_stats |  | ||||||
|  *	Upstream database statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_cmn_db_sync_stats { |  | ||||||
| 	uint32_t add_attempt;		/**< Add hash attempts. */ |  | ||||||
| 	uint32_t add_success;		/**< Add hash success. */ |  | ||||||
| 	uint32_t add_fail_table_full;	/**< Add hash failed due to full table. */ |  | ||||||
| 	uint32_t add_fail_exists;	/**< Add hash failed as entry already exists. */ |  | ||||||
| 	uint32_t del_attempt;		/**< Delete hash attempts. */ |  | ||||||
| 	uint32_t del_success;		/**< Delete hash success. */ |  | ||||||
| 	uint32_t del_fail_not_found;	/**< Delete hash failed as entry not found in hash table. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_tunnel_hash_node_stats |  | ||||||
|  *	Hash statistics for GRE redirect LAG. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_tunnel_hash_node_stats { |  | ||||||
| 	uint64_t hits;					/**< Number of hits on this hash entry. */ |  | ||||||
| 	uint32_t if_num;				/**< GRE redirect interface number. */ |  | ||||||
| 	uint16_t src_mac[ETH_ALEN / 2];			/**< Source MAC address. */ |  | ||||||
| 	uint16_t dest_mac[ETH_ALEN / 2];		/**< Destination MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_hash_stats_query_msg |  | ||||||
|  *	Hash statistics synchronization message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_hash_stats_query_msg { |  | ||||||
| 	/* |  | ||||||
| 	 * Request. |  | ||||||
| 	 * Hash stats request has starting index of hash entry. |  | ||||||
| 	 * Request is initiated by driver periodically. |  | ||||||
| 	 */ |  | ||||||
| 	uint16_t db_entry_idx;			/**< Starting index of request. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Response. |  | ||||||
| 	 * Response contains count of hash entries. It also has next field |  | ||||||
| 	 * which used as the request index in subsequent request by caller. |  | ||||||
| 	 */ |  | ||||||
| 	uint16_t db_entry_next;			/**< Next index to be requested. */ |  | ||||||
| 	uint16_t count;			/**< Number of hash entries in the message. */ |  | ||||||
| 	uint16_t reserved;		/**< Reserved. */ |  | ||||||
| 	struct nss_gre_redir_lag_us_tunnel_hash_node_stats hstats[NSS_GRE_REDIR_LAG_US_MAX_HASH_PER_MSG]; |  | ||||||
| 					/**< Array of hash table entries. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_cmn_sync_stats_msg |  | ||||||
|  *	Upstream statistics synchronization message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_cmn_sync_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;				/**< Common node statistics. */ |  | ||||||
| 	struct nss_gre_redir_lag_us_cmn_sync_stats us_stats;		/**< Upstream statistics. */ |  | ||||||
| 	struct nss_gre_redir_lag_us_cmn_db_sync_stats db_stats;		/**< Common hash statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *nss_gre_redir_lag_us_msg |  | ||||||
|  *	GRE redirect LAG upstream messages. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Payload of a GRE redirect LAG message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_redir_lag_us_config_msg config_us;			/**< Upstream configuration message. */ |  | ||||||
| 		struct nss_gre_redir_lag_us_add_hash_node_msg add_hash;			/**< Add hash entry. */ |  | ||||||
| 		struct nss_gre_redir_lag_us_del_hash_node_msg del_hash;			/**< Delete hash entry. */ |  | ||||||
| 		struct nss_gre_redir_lag_us_query_hash_node_msg query_hash;		/**< Hash entry query message. */ |  | ||||||
| 		struct nss_gre_redir_lag_us_cmn_sync_stats_msg us_sync_stats;		/**< Upstream statistics. */ |  | ||||||
| 		struct nss_gre_redir_lag_us_hash_stats_query_msg hash_stats;		/**< Hash statistics message. */ |  | ||||||
| 	} msg;				/**< GRE redirect LAG upstream message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_cmn_stats |  | ||||||
|  *	GRE redirect LAG upstream statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_cmn_stats { |  | ||||||
| 	uint64_t amsdu_pkts;			/**< Number of AMSDU packets seen. */ |  | ||||||
| 	uint64_t amsdu_pkts_enqueued;		/**< Number of AMSDU packets enqueued. */ |  | ||||||
| 	uint64_t amsdu_pkts_exceptioned;	/**< Number of AMSDU packets exceptioned. */ |  | ||||||
| 	uint64_t exceptioned;			/**< Number of exceptioned packets. */ |  | ||||||
| 	uint64_t freed;				/**< Freed packets when equeue to NSS to host fails. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_cmn_db_stats |  | ||||||
|  *	Upstream database statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_cmn_db_stats { |  | ||||||
| 	uint64_t add_attempt;		/**< Add hash attempts. */ |  | ||||||
| 	uint64_t add_success;		/**< Add hash success. */ |  | ||||||
| 	uint64_t add_fail_table_full;	/**< Add hash failed due to full table. */ |  | ||||||
| 	uint64_t add_fail_exists;	/**< Add hash failed as entry already exists. */ |  | ||||||
| 	uint64_t del_attempt;		/**< Delete hash attempts. */ |  | ||||||
| 	uint64_t del_success;		/**< Delete hash success. */ |  | ||||||
| 	uint64_t del_fail_not_found;	/**< Delete hash failed as entry not found in hash table. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_tunnel_stats |  | ||||||
|  *	Upstream tunnel node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_us_tunnel_stats { |  | ||||||
| 	uint64_t rx_packets;					/**< Received packets. */ |  | ||||||
| 	uint64_t rx_bytes;					/**< Received bytes. */ |  | ||||||
| 	uint64_t tx_packets;					/**< Transmit packets. */ |  | ||||||
| 	uint64_t tx_bytes;					/**< Transmit bytes. */ |  | ||||||
| 	uint64_t rx_dropped[NSS_MAX_NUM_PRI];			/**< Packets dropped on receive due to queue full. */ |  | ||||||
| 	struct nss_gre_redir_lag_us_cmn_stats us_stats;		/**< Common node 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 |  | ||||||
|  *	Message to add station in LAG deployment. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_add_sta_msg { |  | ||||||
| 	uint16_t mac[ETH_ALEN / 2];		/**< Station MAC address. */ |  | ||||||
| 	uint8_t reorder_type;			/**< Reorder type for downstream. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_delete_sta_msg |  | ||||||
|  *	Message to delete station in LAG deployment. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_delete_sta_msg { |  | ||||||
| 	uint16_t mac[ETH_ALEN / 2];	/**< Station MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_update_sta_msg |  | ||||||
|  *	Message to update station. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_update_sta_msg { |  | ||||||
| 	uint16_t mac[ETH_ALEN / 2];		/**< Station MAC address. */ |  | ||||||
| 	uint8_t reorder_type;			/**< Reorder type for downstream. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_stats |  | ||||||
|  * 	GRE redirect link aggregation downstream statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_stats { |  | ||||||
| 	uint32_t dst_invalid;			/**< Invalid destination packets. */ |  | ||||||
| 	uint32_t exception_cnt;			/**< Exception count. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_sync_stats_msg |  | ||||||
|  *	Downstream statistics synchronization message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_sync_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */ |  | ||||||
| 	struct nss_gre_redir_lag_ds_stats ds_stats;	/**< GRE redirect LAG downstream statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *nss_gre_redir_lag_ds_msg |  | ||||||
|  *	GRE redirect LAG downstream messages. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a GRE redirect LAG downstream message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_redir_lag_ds_add_sta_msg add_sta;		/**< Add station entry. */ |  | ||||||
| 		struct nss_gre_redir_lag_ds_delete_sta_msg del_sta;		/**< Delete station entry. */ |  | ||||||
| 		struct nss_gre_redir_lag_ds_update_sta_msg update_sta;		/**< Station entry update message. */ |  | ||||||
| 		struct nss_gre_redir_lag_ds_sync_stats_msg ds_sync_stats;	/**< Downstream statistics. */ |  | ||||||
| 	} msg;				/**< GRE redirect LAG downstream message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_tun_stats |  | ||||||
|  *	Downstream statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_lag_ds_tun_stats { |  | ||||||
| 	uint64_t rx_packets;		/**< Received packets. */ |  | ||||||
| 	uint64_t rx_bytes;		/**< Received bytes. */ |  | ||||||
| 	uint64_t tx_packets;		/**< Transmit packets. */ |  | ||||||
| 	uint64_t tx_bytes;		/**< Transmit bytes. */ |  | ||||||
| 	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 exception_cnt;		/**< Packets that are exceptioned to host. */ |  | ||||||
| 	uint32_t ifnum;			/**< NSS interface number. */ |  | ||||||
| 	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. |  | ||||||
|  * |  | ||||||
|  * @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_gre_redir_lag_us_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE redirect LAG downstream 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_gre_redir_lag_ds_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
|  /** |  | ||||||
|  * Callback function for receiving GRE redirect LAG upstream 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_gre_redir_lag_us_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
|  /** |  | ||||||
|  * Callback function for receiving GRE redirect LAG downstream 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_gre_redir_lag_ds_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_alloc_and_register_node |  | ||||||
|  *	Allocates and registers GRE redirect upstream LAG node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_gre_redir_lag_us_data_callback_t \n |  | ||||||
|  * nss_gre_redir_lag_us_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] dev           Net device pointer. |  | ||||||
|  * @param[in] cb_func_data  Data callback function. |  | ||||||
|  * @param[in] cb_func_msg   Message callback function. |  | ||||||
|  * @param[in] app_ctx       Application context for notify callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number if allocation and registration is succesful, else -1. |  | ||||||
|  */ |  | ||||||
| extern int nss_gre_redir_lag_us_alloc_and_register_node(struct net_device *dev, |  | ||||||
| 		nss_gre_redir_lag_us_data_callback_t cb_func_data, |  | ||||||
| 		nss_gre_redir_lag_us_msg_callback_t cb_func_msg, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_alloc_and_register_node |  | ||||||
|  *	Allocates and registers GRE redirect downstream LAG node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_gre_redir_lag_ds_data_callback_t \n |  | ||||||
|  * nss_gre_redir_lag_ds_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] dev           Net device pointer. |  | ||||||
|  * @param[in] cb_func_data  Data callback function. |  | ||||||
|  * @param[in] cb_func_msg   Message callback function. |  | ||||||
|  * @param[in] app_ctx       Application context for notify callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number if allocation and registration is succesful, else -1. |  | ||||||
|  */ |  | ||||||
| extern int nss_gre_redir_lag_ds_alloc_and_register_node(struct net_device *dev, |  | ||||||
| 		nss_gre_redir_lag_ds_data_callback_t cb_func_data, |  | ||||||
| 		nss_gre_redir_lag_ds_msg_callback_t cb_func_msg, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_configure_node |  | ||||||
|  *	Configures LAG upstream node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_lag_us_config_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum              NSS interface number. |  | ||||||
|  * @param[in] ngluc              Pointer to LAG upstream node configuration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_gre_redir_lag_us_configure_node(uint32_t ifnum, |  | ||||||
| 		struct nss_gre_redir_lag_us_config_msg *ngluc); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_unregister_and_dealloc |  | ||||||
|  *	Deregister and deallocate GRE redirect upstream node. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Error code. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The GRE redirect LAG interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern enum nss_gre_redir_lag_err_types nss_gre_redir_lag_us_unregister_and_dealloc(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_unregister_and_dealloc |  | ||||||
|  *	Deregisters and dealloc GRE redirect LAG downstream interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Error code. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The GRE redirect LAG interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern enum nss_gre_redir_lag_err_types nss_gre_redir_lag_ds_unregister_and_dealloc(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_tx_msg |  | ||||||
|  *	Sends GRE redirect upstream LAG messages asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_lag_us_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_lag_us_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_us_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_tx_msg |  | ||||||
|  *	Sends GRE redirect downstream LAG messages asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_lag_ds_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_lag_ds_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_ds_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_tx_buf |  | ||||||
|  *	Sends packets to GRE Redirect LAG upstream node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g., skbuff). |  | ||||||
|  * @param[in] if_num   Tunnel interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_lag_us_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 						uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_tx_buf |  | ||||||
|  *	Sends packets to GRE Redirect LAG downstream node. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g., skbuff). |  | ||||||
|  * @param[in] if_num   Tunnel interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_lag_ds_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 						uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_us_tx_msg_sync |  | ||||||
|  *	Sends upstream LAG messages to NSS firmware synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_lag_us_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  NSS core context. |  | ||||||
|  * @param[in] ngrm     Pointer to GRE redirect upstream LAG message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_lag_us_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_us_msg *ngrm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_tx_msg_sync |  | ||||||
|  *	Sends downstream LAG messages to NSS firmware synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_lag_ds_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  NSS core context. |  | ||||||
|  * @param[in] ngrm     Pointer to GRE redirect downstream LAG message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| 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_stats_get |  | ||||||
|  *	Fetches common node statistics for upstream GRE Redir LAG. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_lag_us_tunnel_stats |  | ||||||
|  * |  | ||||||
|  * @param[out] cmn_stats  Pointer to common node statistics structure. |  | ||||||
|  * @param[in]  index      Index to fetch statistics from. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| 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_stats_get |  | ||||||
|  *	Fetches common node statistics for downstream GRE Redir LAG. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_lag_ds_tun_stats |  | ||||||
|  * |  | ||||||
|  * @param[out] cmn_stats  Pointer to common node statistics structure. |  | ||||||
|  * @param[in]  index      Index to fetch statistics from. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| 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 |  | ||||||
|  *	Gets the GRE redirect LAG upstream context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_redir_lag_us_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_lag_ds_get_context |  | ||||||
|  *	Gets the GRE redirect LAG downstream context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_GRE_REDIR_LAG_H */ |  | ||||||
| @@ -1,338 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_gre_redir_mark.h |  | ||||||
|  *	NSS GRE Redirect mark interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_GRE_REDIR_MARK_H |  | ||||||
| #define __NSS_GRE_REDIR_MARK_H |  | ||||||
|  |  | ||||||
| #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. */ |  | ||||||
|  |  | ||||||
| extern struct nss_gre_redir_mark_stats gre_mark_stats; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark messages |  | ||||||
|  *	Message types for GRE redirect mark requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_mark_msg_types { |  | ||||||
| 	NSS_GRE_REDIR_MARK_REG_CB_MSG,		/**< Register callback configuration message. */ |  | ||||||
| 	NSS_GRE_REDIR_MARK_STATS_SYNC_MSG,	/**< Statistics synchronization message. */ |  | ||||||
| 	NSS_GRE_REDIR_MARK_MSG_MAX,		/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark errors |  | ||||||
|  *	Error codes for GRE redirect mark configuration message. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_redir_mark_error_types { |  | ||||||
| 	NSS_GRE_REDIR_MARK_ERROR_NONE,		/**< Configuration successful. */ |  | ||||||
| 	NSS_GRE_REDIR_MARK_ERROR_INV_IF_NUM,	/**< Invalid interface number for callback registration. */ |  | ||||||
| 	NSS_GRE_REDIR_MARK_ERROR_INV_ETH_TYPE,	/**< Invalid Ethernet type for the destination interface. */ |  | ||||||
| 	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 |  | ||||||
|  *	HLOS to NSS per packet downstream metadata. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_mark_metadata { |  | ||||||
| 	uint32_t dst_ifnum;		/**< Destination Tx interface number. */ |  | ||||||
| 	uint8_t wifi_tid;		/**< TID value. */ |  | ||||||
| 	uint8_t app_id;			/**< Application ID. */ |  | ||||||
| 	uint16_t hw_hash_idx;		/**< Hardware AST hash index value. */ |  | ||||||
| 	uint32_t tx_status;		/**< Transmit status. */ |  | ||||||
| 	uint16_t offset;		/**< Buffer offset from the metadata. */ |  | ||||||
| 	uint16_t magic;			/**< Metadata magic. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_stats |  | ||||||
|  *	GRE redirect mark statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_mark_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t hlos_magic_fail;               /**< HLOS magic fail 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_drop;		/**< Next egress interface enqueue drop count. */ |  | ||||||
| 	uint32_t inv_appid;			/**< Invalid application ID for the transmit completion packets. */ |  | ||||||
| 	uint32_t headroom_unavail;		/**< Packet headroom unavailable to write metadata. */ |  | ||||||
| 	uint32_t tx_completion_success;		/**< Transmit completion host enqueue success count. */ |  | ||||||
| 	uint32_t tx_completion_drop;		/**< Transmit completion host enqueue drop count. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_register_cb_msg |  | ||||||
|  *	Transmit completion function register configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_mark_register_cb_msg { |  | ||||||
| 	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. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_msg |  | ||||||
|  *	Structure that describes the interface message. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_redir_mark_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a GRE redirect mark message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_redir_mark_register_cb_msg reg_cb_msg; |  | ||||||
| 					/**< Configuration message to register for callback on completion. */ |  | ||||||
| 		struct nss_gre_redir_mark_stats_sync_msg stats_sync; |  | ||||||
| 					/**< Mark node statistics synchronization. */ |  | ||||||
| 	} msg;				/**< Message payload for GRE redirect mark messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE redirect mark 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_gre_redir_mark_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE redirect mark 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_gre_redir_mark_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_unregister_if |  | ||||||
|  *      Deregisters a GRE redirect mark interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  GRE redirect mark interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The GRE redirect mark interface must have been previously registered. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_gre_redir_mark_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_tx_buf |  | ||||||
|  *      Sends data buffers to NSS firmware asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g. skbuff). |  | ||||||
|  * @param[in] if_num   GRE redirect mark interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_mark_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 		uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_reg_cb |  | ||||||
|  *	Configure a callback on VAP for downstream application flows. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_mark_register_cb_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum  NSS interface number. |  | ||||||
|  * @param[in] ngrcm  Downstream application callback registration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_mark_reg_cb(int ifnum, |  | ||||||
|                 struct nss_gre_redir_mark_register_cb_msg *ngrcm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_tx_msg |  | ||||||
|  *	Sends GRE redirect mark messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_redir_mark_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_mark_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_tx_msg_sync |  | ||||||
|  *	Sends messages to NSS firmware synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_redir_mark_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  NSS core context. |  | ||||||
|  * @param[in] ngrm     Pointer to GRE redirect mark message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx operation. |  | ||||||
|  */ |  | ||||||
| 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_stats_get |  | ||||||
|  *      Gets GRE redirect mark statistics. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_redir_mark_stats |  | ||||||
|  * |  | ||||||
|  * @param[out] stats  Pointer to the memory address, which must be large enough to |  | ||||||
|  *                    hold all the statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  */ |  | ||||||
| extern bool nss_gre_redir_mark_stats_get(struct nss_gre_redir_mark_stats *stats); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_alloc_and_register_node |  | ||||||
|  *      Registers GRE redirect mark static node with NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_gre_redir_mark_data_callback_t \n |  | ||||||
|  * nss_gre_redir_mark_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev       Pointer to the associated network device. |  | ||||||
|  * @param[in] if_num       NSS interface number. |  | ||||||
|  * @param[in] cb_func_data Callback for the data. |  | ||||||
|  * @param[in] cb_func_msg  Callback for the message. |  | ||||||
|  * @param[in] features     Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS interface number allocated. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_redir_mark_register_if(struct net_device *netdev, uint32_t if_num, |  | ||||||
| 		nss_gre_redir_mark_data_callback_t cb_func_data, nss_gre_redir_mark_msg_callback_t cb_func_msg, |  | ||||||
| 		uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_get_context |  | ||||||
|  *	Gets the GRE redirect mark context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_redir_mark_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_redir_mark_get_dentry |  | ||||||
|  *	Returns directory entry created in debug filesystem for statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to created directory entry for GRE redirect mark. |  | ||||||
|  */ |  | ||||||
| extern struct dentry *nss_gre_redir_mark_get_dentry(void); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_gre_redir_mark_get_device |  | ||||||
|  *	Gets the original device from probe. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the device. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_GRE_REDIR_MARK_H */ |  | ||||||
| @@ -1,428 +0,0 @@ | |||||||
| /* |  | ||||||
|  **************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2018, 2020-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_gre_tunnel.h |  | ||||||
|  *	NSS GRE Tunnel interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_GRE_TUNNEL_H |  | ||||||
| #define __NSS_GRE_TUNNEL_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_gre_tunnel_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported GRE tunnel sessions. |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_GRE_TUNNEL_SESSIONS 16 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_message_types |  | ||||||
|  *	Message types for a GRE tunnel rule. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_tunnel_message_types { |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_CONFIGURE, |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_SESSION_DESTROY, |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_STATS, |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_CONFIGURE_DI_TO_WLAN_ID, |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_INQUIRY, |  | ||||||
| 	NSS_GRE_TUNNEL_MSG_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_encrypt_types |  | ||||||
|  *	Encryption types for a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_tunnel_encrypt_types { |  | ||||||
| 	NSS_GRE_TUNNEL_ENCRYPT_NONE, |  | ||||||
| 	NSS_GRE_TUNNEL_ENCRYPT_AES128_CBC, |  | ||||||
| 	NSS_GRE_TUNNEL_ENCRYPT_AES256_CBC, |  | ||||||
| 	NSS_GRE_TUNNEL_ENCRYPT_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_mode_types |  | ||||||
|  *	Mode types for a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_tunnel_mode_types { |  | ||||||
| 	NSS_GRE_TUNNEL_MODE_GRE, |  | ||||||
| 	NSS_GRE_TUNNEL_MODE_GRE_UDP, |  | ||||||
| 	NSS_GRE_TUNNEL_MODE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_ip_types |  | ||||||
|  *	IP types for a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_tunnel_ip_types { |  | ||||||
| 	NSS_GRE_TUNNEL_IP_IPV4, |  | ||||||
| 	NSS_GRE_TUNNEL_IP_IPV6, |  | ||||||
| 	NSS_GRE_TUNNEL_IP_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_error_types |  | ||||||
|  *	Error types for a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| enum nss_gre_tunnel_error_types { |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_UNKNOWN_MSG = 1, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_IF_INVALID = 2, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_CPARAM_INVALID = 3, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_MODE_INVALID = 4, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_ENCRYPT_INVALID = 5, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_IP_INVALID = 6, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_ENCRYPT_IDX_INVALID = 7, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_NOMEM = 8, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_PROTO_TEB_INVALID = 9, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_SIBLING_IF = 10, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_CRYPTO_NODE_ID = 11, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_RPS = 12, |  | ||||||
| 	NSS_GRE_TUNNEL_ERR_DI_INVALID = 13, |  | ||||||
| 	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 |  | ||||||
|  *	Dynamic interface to WLAN ID message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_tunnel_di_to_wlan_id { |  | ||||||
| 	uint32_t dynamic_interface_num;		/**< Dynamic interface number. */ |  | ||||||
| 	uint16_t wlan_id;			/**< WLAN ID number. */ |  | ||||||
| 	uint16_t fwd_policy;                    /**< Forward policy bits. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_configure |  | ||||||
|  *	Message information for configuring a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_tunnel_configure { |  | ||||||
| 	uint32_t mh_version;		/**< Meta header version. */ |  | ||||||
| 	uint8_t gre_mode;		/**< GRE or GRE plus UDP. */ |  | ||||||
| 	uint8_t ip_type;		/**< IPv4 or IPv6. */ |  | ||||||
| 	uint16_t encrypt_type;		/**< Encryption type. */ |  | ||||||
| 	uint32_t src_ip[4];		/**< Source IPv4 or IPv6 address. */ |  | ||||||
| 	uint32_t dest_ip[4];		/**< Destination IPv4 or IPv6 address. */ |  | ||||||
| 	uint16_t src_port;		/**< GRE plus UDP only for the source. */ |  | ||||||
| 	uint16_t dest_port;		/**< GRE plus UDP only for the destination. */ |  | ||||||
| 	uint32_t crypto_node_id;	/**< Cryto node identifier. */ |  | ||||||
| 	uint32_t crypto_idx_encrypt;	/**< Crypto index for encryption. */ |  | ||||||
| 	uint32_t crypto_idx_decrypt;	/**< Crypto index for decryption. */ |  | ||||||
| 	uint32_t word0;			/**< Word0 header. */ |  | ||||||
| 	uint8_t iv_val[16];		/**< Initialization vector value. */ |  | ||||||
| 	uint32_t sibling_if;		/**< Sibling interface number. */ |  | ||||||
| 	uint8_t ttl;			/**< Time-to-live value of the IP header. */ |  | ||||||
| 	int8_t rps;			/**< Steer packets to host core. */ |  | ||||||
| 	uint16_t reserved;		/**< Reserved space. */ |  | ||||||
| 	uint32_t word1;			/**< Word1 header. */ |  | ||||||
| 	uint32_t word2;			/**< Word2 header. */ |  | ||||||
| 	uint32_t word3;			/**< Word3 header. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_stats |  | ||||||
|  *	Message statistics for a GRE tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_tunnel_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t rx_malformed;			/**< Malformed packet was received. */ |  | ||||||
| 	uint32_t rx_invalid_prot;		/**< Invalid protocol was received. */ |  | ||||||
| 	uint32_t decap_queue_full;		/**< Decapsulation queue is full. */ |  | ||||||
| 	uint32_t rx_single_rec_dgram;		/**< Single fragment was received. */ |  | ||||||
| 	uint32_t rx_invalid_rec_dgram;		/**< Invalid fragment was received. */ |  | ||||||
| 	uint32_t buffer_alloc_fail;		/**< Buffer memory allocation failed. */ |  | ||||||
| 	uint32_t buffer_copy_fail;		/**< Buffer memory copy failed. */ |  | ||||||
| 	uint32_t outflow_queue_full;		/**< Outflow queue is full. */ |  | ||||||
| 	uint32_t rx_dropped_hroom; |  | ||||||
| 				/**< Packets dropped because of insufficent headroom. */ |  | ||||||
| 	uint32_t rx_cbuf_alloc_fail; |  | ||||||
| 				/**< Receive crypto buffer allocation failed. */ |  | ||||||
| 	uint32_t rx_cenqueue_fail;		/**< Receive enqueue-to-crypto failed. */ |  | ||||||
| 	uint32_t rx_decrypt_done;		/**< Receive decryption is complete. */ |  | ||||||
| 	uint32_t rx_forward_enqueue_fail;	/**< Receive forward enqueue failed. */ |  | ||||||
| 	uint32_t tx_cbuf_alloc_fail; |  | ||||||
| 				/**< Receive crypto buffer allocation failed. */ |  | ||||||
| 	uint32_t tx_cenqueue_fail;		/**< Transmit enqueue-to-crypto failed. */ |  | ||||||
| 	uint32_t rx_dropped_troom; |  | ||||||
| 				/**< Packets dropped because of insufficent tailroom. */ |  | ||||||
| 	uint32_t tx_forward_enqueue_fail;	/**< Transmit forward enqueue failed. */ |  | ||||||
| 	uint32_t tx_cipher_done;		/**< Transmit cipher is complete. */ |  | ||||||
| 	uint32_t crypto_nosupp; |  | ||||||
| 				/**< Error count for non-supported crypto packets. */ |  | ||||||
| 	uint32_t rx_dropped_mh_ver;		/**< Receive drop: bad meta header. */ |  | ||||||
| 	uint32_t rx_unaligned_pkt;		/**< Counter for unaligned packets. */ |  | ||||||
| #if defined(NSS_HAL_IPQ807x_SUPPORT) |  | ||||||
| 	uint32_t crypto_resp_error[NSS_CRYPTO_CMN_RESP_ERROR_MAX]; |  | ||||||
| 						/** Crypto response errors. */ |  | ||||||
| #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 |  | ||||||
|  *	Data for sending and receiving GRE tunnel messages. |  | ||||||
|  */ |  | ||||||
| struct nss_gre_tunnel_msg { |  | ||||||
| 	struct nss_cmn_msg cm;					/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a GRE tunnel message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_gre_tunnel_configure configure;	/**< Tunnel configuration data. */ |  | ||||||
| 		struct nss_gre_tunnel_stats stats;		/**< Tunnel statistics. */ |  | ||||||
| 		struct nss_gre_tunnel_di_to_wlan_id dtwi;	/**< Tunnel dynamic interface number to WLAN ID mapping. */ |  | ||||||
| 	} msg;							/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_tunnel_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_gre_tunnel_msg_callback_t)(void *app_data, struct nss_gre_tunnel_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving GRE tunnel session 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_gre_tunnel_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_tx_buf |  | ||||||
|  *	Sends a GRE tunnel packet. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff \n |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] skb      Pointer to the data socket buffer. |  | ||||||
|  * @param[in] if_num   Tunnel interface number. |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tunnel_tx_buf(struct sk_buff *skb, uint32_t if_num, struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_tx_msg |  | ||||||
|  *	Sends a GRE tunnel message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_tunnel_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tunnel_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_tunnel_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_tx_msg_sync |  | ||||||
|  *	Sends a GRE tunnel message synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_gre_tunnel_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tunnel_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_tunnel_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_msg_init |  | ||||||
|  *	Initalizes a GRE tunnel message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_tunnel_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ngtm      Pointer to the tunnel message. |  | ||||||
|  * @param[in] if_num    Tunnel interface number. |  | ||||||
|  * @param[in] type      Type of message. |  | ||||||
|  * @param[in] len       Size of the payload. |  | ||||||
|  * @param[in] cb        Pointer to the message callback. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_tunnel_msg_init(struct nss_gre_tunnel_msg *ngtm, uint16_t if_num, uint32_t type, uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_get_ctx |  | ||||||
|  *	Returns the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_tunnel_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_register_if |  | ||||||
|  *	Registers a network device with the NSS for sending and receiving tunnel |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_gre_tunnel_data_callback_t \n |  | ||||||
|  * nss_gre_tunnel_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] ev_cb     Callback for the GRE tunnel message. |  | ||||||
|  * @param[in] netdev    Pointer to the associated network device. |  | ||||||
|  * @param[in] features  Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx   Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_gre_tunnel_register_if(uint32_t if_num, |  | ||||||
| 						nss_gre_tunnel_data_callback_t cb, |  | ||||||
| 						nss_gre_tunnel_msg_callback_t ev_cb, |  | ||||||
| 						struct net_device *netdev, |  | ||||||
| 						uint32_t features, |  | ||||||
| 						void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_unregister_if |  | ||||||
|  *	Deregisters a network device from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The network device must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_gre_tunnel_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_gre_tunnel_inquiry() |  | ||||||
|  *	Inquiry if a GRE tunnel has been established in NSS FW. |  | ||||||
|  * |  | ||||||
|  * @param[in] inquiry_info  Query parameters similar to creation parameters. |  | ||||||
|  * @param[in] cb            Pointer to the message callback. |  | ||||||
|  * @param[in] app_data      Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_gre_tunnel_inquiry( |  | ||||||
| 		struct nss_gre_tunnel_configure *inquiry_info, |  | ||||||
| 		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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_GRE_TUNNEL_H */ |  | ||||||
| @@ -1,454 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-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_if.h |  | ||||||
|  *	NSS interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IF_H |  | ||||||
| #define __NSS_IF_H |  | ||||||
|  |  | ||||||
| #define NSS_IF_TX_TIMEOUT 3000 /* 3 Seconds */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_driver_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_message_types |  | ||||||
|  *	Message types for the NSS interface. |  | ||||||
|  */ |  | ||||||
| enum nss_if_message_types { |  | ||||||
| 	NSS_IF_OPEN, |  | ||||||
| 	NSS_IF_CLOSE, |  | ||||||
| 	NSS_IF_LINK_STATE_NOTIFY, |  | ||||||
| 	NSS_IF_MTU_CHANGE, |  | ||||||
| 	NSS_IF_MAC_ADDR_SET, |  | ||||||
| 	NSS_IF_STATS, |  | ||||||
| 	NSS_IF_ISHAPER_ASSIGN, |  | ||||||
| 	NSS_IF_BSHAPER_ASSIGN, |  | ||||||
| 	NSS_IF_ISHAPER_UNASSIGN, |  | ||||||
| 	NSS_IF_BSHAPER_UNASSIGN, |  | ||||||
| 	NSS_IF_ISHAPER_CONFIG, |  | ||||||
| 	NSS_IF_BSHAPER_CONFIG, |  | ||||||
| 	NSS_IF_PAUSE_ON_OFF, |  | ||||||
| 	NSS_IF_VSI_ASSIGN, |  | ||||||
| 	NSS_IF_VSI_UNASSIGN, |  | ||||||
| 	NSS_IF_SET_NEXTHOP, |  | ||||||
| 	NSS_IF_SET_IGS_NODE, |  | ||||||
| 	NSS_IF_CLEAR_IGS_NODE, |  | ||||||
| 	NSS_IF_RESET_NEXTHOP, |  | ||||||
| 	NSS_IF_PPE_PORT_CREATE, |  | ||||||
| 	NSS_IF_PPE_PORT_DESTROY, |  | ||||||
| 	NSS_IF_MAX_MSG_TYPES = 9999, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_error_types |  | ||||||
|  *	Error types for the NSS interface. |  | ||||||
|  */ |  | ||||||
| enum nss_if_error_types { |  | ||||||
| 	NSS_IF_ERROR_NO_ISHAPERS, |  | ||||||
| 	NSS_IF_ERROR_NO_BSHAPERS, |  | ||||||
| 	NSS_IF_ERROR_NO_ISHAPER, |  | ||||||
| 	NSS_IF_ERROR_NO_BSHAPER, |  | ||||||
| 	NSS_IF_ERROR_ISHAPER_OLD, |  | ||||||
| 	NSS_IF_ERROR_BSHAPER_OLD, |  | ||||||
| 	NSS_IF_ERROR_ISHAPER_CONFIG_FAILED, |  | ||||||
| 	NSS_IF_ERROR_BSHAPER_CONFIG_FAILED, |  | ||||||
| 	NSS_IF_ERROR_TYPE_UNKNOWN, |  | ||||||
| 	NSS_IF_ERROR_TYPE_EOPEN, |  | ||||||
| 	NSS_IF_ERROR_TYPE_INVALID_MTU, |  | ||||||
| 	NSS_IF_ERROR_TYPE_INVALID_MAC_ADDR, |  | ||||||
| 	NSS_IF_ERROR_TYPE_VSI_NOT_MATCH, |  | ||||||
| 	NSS_IF_ERROR_TYPE_VSI_REASSIGN, |  | ||||||
| 	NSS_IF_ERROR_TYPE_VSI_INVALID, |  | ||||||
| 	NSS_IF_ERROR_TYPE_MAX = 9999, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_data_align |  | ||||||
|  *	Data alignment modes for the NSS interface. |  | ||||||
|  */ |  | ||||||
| enum nss_if_data_align { |  | ||||||
| 	NSS_IF_DATA_ALIGN_2BYTE = 0, |  | ||||||
| 	NSS_IF_DATA_ALIGN_4BYTE = 2, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_open |  | ||||||
|  *	Message information for opening the NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_open { |  | ||||||
| 	uint32_t tx_desc_ring;	/**< Tx descriptor ring address. */ |  | ||||||
| 	uint32_t rx_desc_ring;	/**< Rx descriptor ring address. */ |  | ||||||
| 	uint32_t rx_forward_if;	/**< Forward received packets to this interface. */ |  | ||||||
| 	uint32_t alignment_mode;/**< Header alignment mode. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_close |  | ||||||
|  *	Message information for closing the NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_close { |  | ||||||
| 	uint32_t reserved;	/**< Placeholder for the structure. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_link_state_notify |  | ||||||
|  *	Link state notification sent to the NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_link_state_notify { |  | ||||||
| 	uint32_t state; |  | ||||||
| 			/**< Link state UP is bit 0 set. Other bits are as defined by Linux to indicate speed and duplex. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_mtu_change |  | ||||||
|  *	MTU change for the NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_mtu_change { |  | ||||||
| 	uint16_t min_buf_size;	/**< Changed value for the minimum buffer size. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_pause_on_off |  | ||||||
|  *	Enables or disables a pause frame for the NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_pause_on_off { |  | ||||||
| 	uint32_t pause_on;	/**< Turn the pause frame ON or OFF. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_mac_address_set |  | ||||||
|  *	MAC address setting. |  | ||||||
|  */ |  | ||||||
| struct nss_if_mac_address_set { |  | ||||||
| 	uint8_t mac_addr[ETH_ALEN];	/**< MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_shaper_assign |  | ||||||
|  *	Shaper assignment message. |  | ||||||
|  */ |  | ||||||
| struct nss_if_shaper_assign { |  | ||||||
| 	uint32_t shaper_id;		/**< ID of the request. */ |  | ||||||
| 	uint32_t new_shaper_id;		/**< ID of the response. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_shaper_unassign |  | ||||||
|  *	Shaper unassign message. |  | ||||||
|  */ |  | ||||||
| struct nss_if_shaper_unassign { |  | ||||||
| 	uint32_t shaper_id;		/**< ID of the request. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_shaper_configure |  | ||||||
|  *	Shaper configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_if_shaper_configure { |  | ||||||
| 	struct nss_shaper_configure config;	/**< Specific shaper message for a particular interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_vsi_assign |  | ||||||
|  *	VSI assignment message. |  | ||||||
|  */ |  | ||||||
| struct nss_if_vsi_assign { |  | ||||||
| 	uint32_t vsi;		/**< Virtual interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_vsi_unassign |  | ||||||
|  *	VSI unassign message. |  | ||||||
|  */ |  | ||||||
| struct nss_if_vsi_unassign { |  | ||||||
| 	uint32_t vsi;		/**< Virtual interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_set_nexthop |  | ||||||
|  *	Message to set nexthop for an interface. |  | ||||||
|  */ |  | ||||||
| struct nss_if_set_nexthop { |  | ||||||
| 	uint32_t nexthop;	/**< Nexthop interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_igs_config |  | ||||||
|  *	Ingress shaper set/clear configure message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_if_igs_config { |  | ||||||
| 	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 |  | ||||||
|  *	Information for physical NSS interface command messages. |  | ||||||
|  */ |  | ||||||
| union nss_if_msgs { |  | ||||||
| 	struct nss_if_link_state_notify link_state_notify; |  | ||||||
| 			/**< Link status notification. */ |  | ||||||
| 	struct nss_if_open open; |  | ||||||
| 			/**< Open the NSS interface. */ |  | ||||||
| 	struct nss_if_close close; |  | ||||||
| 			/**< Close the NSS interface. */ |  | ||||||
| 	struct nss_if_mtu_change mtu_change; |  | ||||||
| 			/**< MTU change notification. */ |  | ||||||
| 	struct nss_if_mac_address_set mac_address_set; |  | ||||||
| 			/**< MAC address setting. */ |  | ||||||
| 	struct nss_cmn_node_stats stats; |  | ||||||
| 			/**< Synchronize the satistics. */ |  | ||||||
| 	struct nss_if_shaper_assign shaper_assign; |  | ||||||
| 			/**< Assign the shaper. */ |  | ||||||
| 	struct nss_if_shaper_unassign shaper_unassign; |  | ||||||
| 			/**< Unassign the shaper. */ |  | ||||||
| 	struct nss_if_shaper_configure shaper_configure; |  | ||||||
| 			/**< Configure the shaper. */ |  | ||||||
| 	struct nss_if_pause_on_off pause_on_off; |  | ||||||
| 			/**< ON or OFF notification for a Pause frame. */ |  | ||||||
| 	struct nss_if_vsi_assign vsi_assign; |  | ||||||
| 			/**< Assign the VSI. */ |  | ||||||
| 	struct nss_if_vsi_unassign vsi_unassign; |  | ||||||
| 			/**< Remove the VSI assignment. */ |  | ||||||
| 	struct nss_if_set_nexthop set_nexthop; |  | ||||||
| 			/**< Set nexthop of interface. */ |  | ||||||
| 	struct nss_if_igs_config config_igs; |  | ||||||
| 			/**< Configure an ingress shaper interface. */ |  | ||||||
| 	struct nss_if_ppe_port_create ppe_port_create; |  | ||||||
| 			/**< Create a PPE port. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_msg |  | ||||||
|  *	Data for sending and receiving base class messages for all interface types. |  | ||||||
|  */ |  | ||||||
| struct nss_if_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
| 	union nss_if_msgs msg;		/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving NSS interface messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_if_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_if_msg_callback_t)(void *app_data, struct nss_if_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving NSS interface data. |  | ||||||
|  * |  | ||||||
|  * TODO: Adjust to pass app_data as unknown to the |  | ||||||
|  * list layer and netdev/sk as known. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] skb     Pointer to the data socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_if_rx_callback_t)(struct net_device *netdev, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_register |  | ||||||
|  *	Registers the NSS interface for sending and receiving GMAC packets and messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_if_rx_callback_t \n |  | ||||||
|  * nss_if_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num        NSS interface number. |  | ||||||
|  * @param[in] rx_callback   Receive callback for the packet. |  | ||||||
|  * @param[in] msg_callback  Receive callback for message. |  | ||||||
|  * @param[in] if_ctx        Pointer to the interface context provided in the |  | ||||||
|                             callback. This context must be the OS network |  | ||||||
|                             device context pointer (net_device in Linux). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_if_register(uint32_t if_num, |  | ||||||
| 					nss_if_rx_callback_t rx_callback, |  | ||||||
| 					nss_if_msg_callback_t msg_callback, |  | ||||||
| 					struct net_device *if_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_tx_buf |  | ||||||
|  *	Sends GMAC packets to a specific physical or virtual network interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g., skbuff). |  | ||||||
|  * @param[in] if_num   Network physical or virtual interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_if_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_tx_msg |  | ||||||
|  *	Sends a message to the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_if_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     nim      Pointer to the NSS interface message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_msg_sync |  | ||||||
|  *	Sends a message to the NSS interface and wait for the response. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_if_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     nim      Pointer to the NSS interface message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_if_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_set_nexthop |  | ||||||
|  *	Configure the next hop for an interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * @param[in] nexthop  NSS interface number for next hop node. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_if_reset_nexthop |  | ||||||
|  *	De-configure the next hop for an interface. |  | ||||||
|  * |  | ||||||
|  * @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_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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /*  __NSS_IF_H */ |  | ||||||
| @@ -1,213 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 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_igs.h |  | ||||||
|  *	NSS ingress shaper interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_IGS_H_ |  | ||||||
| #define _NSS_IGS_H_ |  | ||||||
|  |  | ||||||
| #ifndef DOXYGEN_SHOULD_SKIP_THIS |  | ||||||
| #ifdef CONFIG_NET_CLS_ACT |  | ||||||
| #include <net/act_api.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ingress_shaper_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported ingress shaping interfaces. |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_IGS_DYNAMIC_INTERFACES 8 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_msg_types |  | ||||||
|  *	Message types for ingress shaper requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_igs_msg_types { |  | ||||||
| 	NSS_IGS_MSG_SYNC_STATS = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_IGS_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_node_stats |  | ||||||
|  *	Ingress shaping node debug statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_igs_node_stats { |  | ||||||
| 	uint32_t tx_dropped;		/**< Dropped post shaping. */ |  | ||||||
| 	uint32_t shaper_drop;		/**< Dropped during shaper enqueue. */ |  | ||||||
| 	uint32_t ipv4_parse_fail;	/**< IPv4 parse fail. */ |  | ||||||
| 	uint32_t ipv4_unknown_gre_type;	/**< IPv4 unknown GRE type. */ |  | ||||||
| 	uint32_t ipv4_unknown_l4;	/**< IPv4 unknown L4 type. */ |  | ||||||
| 	uint32_t ipv4_no_cme;		/**< IPv4 connection match entry not found. */ |  | ||||||
| 	uint32_t ipv4_frag_initial;	/**< IPv4 initial fragment. */ |  | ||||||
| 	uint32_t ipv4_frag_non_initial;	/**< Ipv4 subsequent fragment. */ |  | ||||||
| 	uint32_t ipv4_malformed_udp;	/**< Incomplete IPv4 UDP packet. */ |  | ||||||
| 	uint32_t ipv4_malformed_tcp;	/**< Incomplete IPv4 TCP packet. */ |  | ||||||
| 	uint32_t ipv4_malformed_udpl;	/**< Incomplete IPv4 UDP-Lite packet. */ |  | ||||||
| 	uint32_t ipv4_malformed_gre;	/**< Incomplete IPv4 GRE packet. */ |  | ||||||
| 	uint32_t ipv6_parse_fail;	/**< IPv6 parse fail. */ |  | ||||||
| 	uint32_t ipv6_unknown_l4;	/**< IPv6 unknown L4 type. */ |  | ||||||
| 	uint32_t ipv6_no_cme;		/**< IPv6 connection match entry not found. */ |  | ||||||
| 	uint32_t ipv6_frag_initial;	/**< IPv6 initial fragment. */ |  | ||||||
| 	uint32_t ipv6_frag_non_initial;	/**< Ipv6 subsequent fragment. */ |  | ||||||
| 	uint32_t ipv6_malformed_udp;	/**< Incomplete IPv6 UDP packet. */ |  | ||||||
| 	uint32_t ipv6_malformed_tcp;	/**< Incomplete IPv6 TCP packet. */ |  | ||||||
| 	uint32_t ipv6_malformed_udpl;	/**< Incomplete IPv6 UDP-Lite packet. */ |  | ||||||
| 	uint32_t ipv6_malformed_frag;	/**< Incomplete IPv6 fragment. */ |  | ||||||
| 	uint32_t event_no_si;		/**< No shaper configured. */ |  | ||||||
| 	uint32_t eth_parse_fail;	/**< Ethernet header parse failed. */ |  | ||||||
| 	uint32_t eth_unknown_type;	/**< Non-IP/PPPoE ether type. */ |  | ||||||
| 	uint32_t pppoe_non_ip;		/**< Non-IP PPPoE packet. */ |  | ||||||
| 	uint32_t pppoe_malformed;	/**< Incomplete PPPoE packet. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_stats_sync_msg |  | ||||||
|  *	Message information for ingress shaping synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_igs_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	struct nss_igs_node_stats igs_stats;	/**< Debug statistics for ingress shaping. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_msg |  | ||||||
|  *	Data for sending and receiving ingress shaper messages. |  | ||||||
|  */ |  | ||||||
| struct nss_igs_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a ingress shaper message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		union nss_if_msgs if_msg; |  | ||||||
| 				/**< NSS interface base message. */ |  | ||||||
| 		struct nss_igs_stats_sync_msg stats; |  | ||||||
| 				/**< Statistics message to host. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving ingress shaper 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_igs_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_get_context |  | ||||||
|  *	Gets the ingress shaper context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_igs_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_register_if |  | ||||||
|  *	Registers a ingress shaper interface with the NSS for sending and receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_igs_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num          NSS interface number. |  | ||||||
|  * @param[in] type            NSS interface type. |  | ||||||
|  * @param[in] msg_callback    Callback for the ingress shaper message. |  | ||||||
|  * @param[in] netdev          Pointer to the associated network device. |  | ||||||
|  * @param[in] features        Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_igs_register_if(uint32_t if_num, uint32_t type, |  | ||||||
| 		nss_igs_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_unregister_if |  | ||||||
|  *	Deregisters a ingress shaper interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_igs_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_igs_verify_if_num |  | ||||||
|  *	Verify whether interface is an ingress shaper interface or not. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if interface is an ingress shaper interface. |  | ||||||
|  */ |  | ||||||
| extern bool nss_igs_verify_if_num(uint32_t if_num); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef CONFIG_NET_CLS_ACT |  | ||||||
| /* |  | ||||||
|  * nss_igs_module_save() |  | ||||||
|  *	Save the ingress shaping module reference. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * tc_action_ops \n |  | ||||||
|  * module |  | ||||||
|  * |  | ||||||
|  * @param[in] act     Operation structure for ingress shaping action. |  | ||||||
|  * @param[in] module  Module structure of ingress shaping module. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_igs_module_save(struct tc_action_ops *act, struct module *module); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_igs_module_get() |  | ||||||
|  *	Get the ingress shaping module reference. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * False if not able to take the ingress shaping module reference, otherwise true. |  | ||||||
|  * |  | ||||||
|  */ |  | ||||||
| extern bool nss_igs_module_get(void); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_igs_module_put() |  | ||||||
|  *	Release the ingress shaping module reference. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_igs_module_put(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
| #endif |  | ||||||
| @@ -1,550 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2018, 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_ipsec.h |  | ||||||
|  *	NSS IPSec interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IPSEC_H |  | ||||||
| #define __NSS_IPSEC_H |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * For some reason Linux doesn't define this in if_arp.h, |  | ||||||
|  * refer http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml |  | ||||||
|  * for the full list |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ipsec_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSEC_ARPHRD_IPSEC 31 |  | ||||||
| 		/**< ARP (iana.org) hardware type for an IPsec tunnel. */ |  | ||||||
| #define NSS_IPSEC_MAX_RULES 256 |  | ||||||
| 		/**< Maximum number of rules supported. */ |  | ||||||
| #define NSS_IPSEC_MAX_SA NSS_CRYPTO_MAX_IDXS |  | ||||||
| 		/**< Maximum number of SAs supported. */ |  | ||||||
|  |  | ||||||
| #if (~(NSS_IPSEC_MAX_RULES - 1) & (NSS_IPSEC_MAX_RULES >> 1)) |  | ||||||
| #error "NSS Max SA should be a power of 2" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Size of an IPsec message. |  | ||||||
|  */ |  | ||||||
| #define NSS_IPSEC_MSG_LEN (sizeof(struct nss_ipsec_msg) - sizeof(struct nss_cmn_msg)) |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_msg_type |  | ||||||
|  *	Rules for the IPsec interface. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_msg_type { |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_NONE = 0, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_ADD_RULE = 1, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_DEL_RULE = 2, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_FLUSH_TUN = 3, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_SYNC_SA_STATS = 4, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_SYNC_FLOW_STATS = 5, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_SYNC_NODE_STATS = 6, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_CONFIGURE_NODE = 7, |  | ||||||
| 	NSS_IPSEC_MSG_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_status |  | ||||||
|  *	Status types for the IPsec interface. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_ipsec_status { |  | ||||||
| 	NSS_IPSEC_STATUS_OK = 0, |  | ||||||
| 	NSS_IPSEC_STATUS_ENOMEM = 1, |  | ||||||
| 	NSS_IPSEC_STATUS_ENOENT = 2, |  | ||||||
| 	NSS_IPSEC_STATUS_MAX |  | ||||||
| } nss_ipsec_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_error_type |  | ||||||
|  *	Error types for the IPsec interface. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_error_type { |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_NONE = 0, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_HASH_DUPLICATE = 1, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_HASH_COLLISION = 2, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_UNHANDLED_MSG = 3, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_INVALID_RULE = 4, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_MAX_SA = 5, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_MAX_FLOW = 6, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_INVALID_CINDEX = 7, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_INVALID_IPVER = 8, |  | ||||||
| 	NSS_IPSEC_ERROR_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_type |  | ||||||
|  *	Operation types for the IPsec interface. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_type { |  | ||||||
| 	NSS_IPSEC_TYPE_NONE = 0, |  | ||||||
| 	NSS_IPSEC_TYPE_ENCAP = 1, |  | ||||||
| 	NSS_IPSEC_TYPE_DECAP = 2, |  | ||||||
| 	NSS_IPSEC_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_tuple |  | ||||||
|  *	Common IPsec rule selector tuple for encapsulation and decapsulation. |  | ||||||
|  * |  | ||||||
|  * This selector is used for preparing a lookup tuple for incoming packets. |  | ||||||
|  * The tuple is used to derive the index into the rule table. |  | ||||||
|  * |  | ||||||
|  * Choosing the selector fields depends on the IPsec encapsulation or decapsulation |  | ||||||
|  * package. The host has no understanding of the index derived from the selector fields, |  | ||||||
|  * and thus it provides information for all entries in the structure. |  | ||||||
|  * |  | ||||||
|  * The encapsulation and decapsulation packages return the index in their respective |  | ||||||
|  * tables to the host. The host stores the rule for future reference purposes. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_tuple { |  | ||||||
| 	uint32_t dst_addr[4];		/**< Destination IP address. */ |  | ||||||
| 	uint32_t src_addr[4];		/**< Source IP address. */ |  | ||||||
|  |  | ||||||
| 	uint32_t esp_spi;		/**< SPI index. */ |  | ||||||
|  |  | ||||||
| 	uint16_t dst_port;		/**< Destination port (UDP or TCP). */ |  | ||||||
| 	uint16_t src_port;		/**< Source port (UDP or TCP). */ |  | ||||||
|  |  | ||||||
| 	uint8_t proto_next_hdr;		/**< IP header type. */ |  | ||||||
| 	uint8_t ip_ver;			/**< IP version. */ |  | ||||||
| 	uint8_t res[2];			/**< Reserved for 4-byte alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_rule_oip |  | ||||||
|  *	Common information about the IPsec rule outer IP header. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_rule_oip { |  | ||||||
| 	uint32_t dst_addr[4];		/**< IPv4 destination address to apply. */ |  | ||||||
| 	uint32_t src_addr[4];		/**< IPv4 source address to apply. */ |  | ||||||
|  |  | ||||||
| 	uint32_t esp_spi;		/**< ESP SPI index to apply. */ |  | ||||||
|  |  | ||||||
| 	uint16_t dst_port;		/**< Destination port (UDP or TCP). */ |  | ||||||
| 	uint16_t src_port;		/**< Source port (UDP or TCP). */ |  | ||||||
|  |  | ||||||
| 	uint8_t ttl_hop_limit;		/**< IPv4 time-to-live value to apply. */ |  | ||||||
| 	uint8_t ip_ver;			/**< IP version. */ |  | ||||||
| 	uint8_t proto_next_hdr;         /**< IP header type. */ |  | ||||||
| 	uint8_t res;			/**< Reserved for 4-byte alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_rule_data |  | ||||||
|  *	IPsec rule data used for per-packet transformation. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_rule_data { |  | ||||||
|  |  | ||||||
| 	uint16_t crypto_index;		/**< Crypto index for the security association. */ |  | ||||||
| 	uint16_t window_size;		/**< ESP sequence number window. */ |  | ||||||
|  |  | ||||||
| 	uint8_t cipher_blk_len;		/**< Size of the cipher block. */ |  | ||||||
| 	uint8_t iv_len;			/**< Size of the initialization vector. */ |  | ||||||
| 	uint8_t nat_t_req;		/**< NAT-T required. */ |  | ||||||
| 	uint8_t esp_icv_len;		/**< Size of the ICV to be produced as a result of authentication. */ |  | ||||||
|  |  | ||||||
| 	uint8_t esp_seq_skip;		/**< Skip an ESP sequence number. */ |  | ||||||
| 	uint8_t esp_tail_skip;		/**< Skip an ESP trailer. */ |  | ||||||
| 	uint8_t use_pattern;		/**< Use random pattern in a hash calculation. */ |  | ||||||
| 	uint8_t enable_esn;		/**< Enable extended sequence number. */ |  | ||||||
|  |  | ||||||
| 	uint8_t dscp;                   /**< Default DSCP value of the SA. */ |  | ||||||
| 	uint8_t df;			/**< Default dont fragment value of the SA. */ |  | ||||||
| 	uint8_t copy_dscp;		/**< The flag tells whether to copy DSCP from inner header. */ |  | ||||||
| 	uint8_t copy_df;		/**< The flag tells Whether to copy DF from inner header. */ |  | ||||||
|  |  | ||||||
| 	uint32_t res2[4];		/**< Reserved 16 bytes for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_rule |  | ||||||
|  *	Push message for IPsec rules. |  | ||||||
|  * |  | ||||||
|  * This message is sent from the host to the NSS for performing an operation |  | ||||||
|  * on NSS rule tables. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_rule { |  | ||||||
| 	struct nss_ipsec_rule_oip oip;	/**< Per rule outer IP information. */ |  | ||||||
| 	struct nss_ipsec_rule_data data;/**< Per rule data. */ |  | ||||||
|  |  | ||||||
| 	uint32_t index;		/**< Index provided by the NSS. */ |  | ||||||
| 	uint32_t sa_idx;	/**< Rule index for the security association table. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_configure_node |  | ||||||
|  *	Push message for setting IPsec inline mode and initializing DMA rings. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_configure_node { |  | ||||||
| 	bool dma_redirect;	/**< Program redirect DMA ring. */ |  | ||||||
| 	bool dma_lookaside;	/**< Program lookaside DMA ring. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_sa_stats |  | ||||||
|  *	Packet statistics per security association. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_sa_stats { |  | ||||||
| 	uint32_t count;			/**< Packets processed. */ |  | ||||||
| 	uint32_t bytes;			/**< Bytes processed. */ |  | ||||||
| 	uint32_t no_headroom;		/**< Insufficient headroom. */ |  | ||||||
| 	uint32_t no_tailroom;		/**< Insufficient tailroom. */ |  | ||||||
| 	uint32_t no_resource;		/**< No crypto buffer. */ |  | ||||||
| 	uint32_t fail_queue;		/**< Failed to enqueue. */ |  | ||||||
| 	uint32_t fail_hash;		/**< Hash mismatch. */ |  | ||||||
| 	uint32_t fail_replay;		/**< Replay check failure. */ |  | ||||||
| 	uint64_t seq_num;		/**< Current sequence number. */ |  | ||||||
| 	uint64_t window_max;		/**< Maximum size of the window. */ |  | ||||||
| 	uint32_t window_size;		/**< Current window size. */ |  | ||||||
| 	uint32_t fail_hash_cont;	/**< Consecutive hash fail count. */ |  | ||||||
| 	uint8_t esn_enabled;		/**< Indicates whether ESN is enabled. */ |  | ||||||
| 	uint8_t res[3];			/**< Reserved for future use. */ |  | ||||||
| } /** @cond */ __attribute__((packed))/** @endcond */; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_flow_stats |  | ||||||
|  *	Per-flow statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_flow_stats { |  | ||||||
| 	uint32_t processed;		/**< Packets processed for this flow. */ |  | ||||||
|  |  | ||||||
| 	uint8_t use_pattern;		/**< Use random pattern. */ |  | ||||||
| 	uint8_t res[3];			/**< Reserved for 4-byte alignment padding. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_node_stats |  | ||||||
|  *	Per-node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_node_stats { |  | ||||||
| 	uint32_t enqueued;		/**< Packets enqueued to the node. */ |  | ||||||
| 	uint32_t completed;		/**< Packets processed by the node. */ |  | ||||||
| 	uint32_t linearized;		/**< Packet is linear. */ |  | ||||||
| 	uint32_t exceptioned;		/**< Packets exception from the NSS. */ |  | ||||||
| 	uint32_t fail_enqueue;		/**< Packets failed to enqueue. */ |  | ||||||
| 	uint32_t redir_rx;		/**< Packets received in redirect ring. */ |  | ||||||
| 	uint32_t fail_redir;		/**< Packets dropped in redirect ring. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_stats |  | ||||||
|  *	Common statistics structure. |  | ||||||
|  */ |  | ||||||
| union nss_ipsec_stats { |  | ||||||
| 	struct nss_ipsec_sa_stats sa;		/**< Security association statistics. */ |  | ||||||
| 	struct nss_ipsec_flow_stats flow;	/**< Flow statistics. */ |  | ||||||
| 	struct nss_ipsec_node_stats node;	/**< Node statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_msg |  | ||||||
|  *	Data for sending and receiving IPsec messages. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	uint32_t tunnel_id;		/**< ID of the tunnel associated with the message. */ |  | ||||||
| 	struct nss_ipsec_tuple tuple; |  | ||||||
| 			/**< Tuple to look up the SA table for encapsulation or decapsulation. */ |  | ||||||
| 	enum nss_ipsec_type type;	/**< Encapsulation or decapsulation operation. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an IPsec message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsec_rule rule; |  | ||||||
| 				/**< IPsec rule message. */ |  | ||||||
| 		struct nss_ipsec_configure_node node; |  | ||||||
| 				/**< IPsec node message. */ |  | ||||||
| 		union nss_ipsec_stats stats; |  | ||||||
| 				/**< Retrieve statistics for the tunnel. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving message notifications. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_ipsec_msg_callback_t)(void *app_data, struct nss_ipsec_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving 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 message data. |  | ||||||
|  * @param[in] napi    Pointer to the NAPI structure. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_ipsec_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_tx_msg |  | ||||||
|  *	Sends an IPsec message to the NSS HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_ipsec_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_ipsec_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_tx_msg_sync |  | ||||||
|  *	Sends IPsec messages synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_ipsec_msg_type \n |  | ||||||
|  * nss_ipsec_msg \n |  | ||||||
|  * nss_ipsec_error_type |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     if_num   Configuration interface number. |  | ||||||
|  * @param[in]     type     Type of the message. |  | ||||||
|  * @param[in]     len      Size of the payload. |  | ||||||
|  * @param[in]     nim      Pointer to the message data. |  | ||||||
|  * @param[in,out] resp     Response for the configuration. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_tx_msg_sync(struct nss_ctx_instance *nss_ctx, uint32_t if_num, |  | ||||||
| 						enum nss_ipsec_msg_type type, uint16_t len, |  | ||||||
| 						struct nss_ipsec_msg *nim, enum nss_ipsec_error_type *resp); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_tx_buf |  | ||||||
|  *	Sends a plain text packet to NSS for IPsec encapsulation or decapsulation. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] skb     Pointer to the message data. |  | ||||||
|  * @param[in] if_num  Pointer to the NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_tx_buf(struct sk_buff *skb, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_notify_register |  | ||||||
|  *	Registers an event callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * When registered, the message callback is called when the NSS |  | ||||||
|  * sends a response to the message sent by the host. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_ipsec_notify_register(uint32_t if_num, nss_ipsec_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_data_register |  | ||||||
|  *	Registers a data callback handler with the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * The HLOS driver calls the registered data callback to return |  | ||||||
|  * the packet to the OS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the data. |  | ||||||
|  * @param[in] netdev    Pointer to the associated network device. |  | ||||||
|  * @param[in] features  Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_ipsec_data_register(uint32_t if_num, nss_ipsec_buf_callback_t cb, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_notify_unregister |  | ||||||
|  *	Deregisters the message notifier from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The message notifier must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_ipsec_notify_unregister(struct nss_ctx_instance *ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_data_unregister |  | ||||||
|  *	Deregisters the data notifier from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The data notifier must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_ipsec_data_unregister(struct nss_ctx_instance *ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_get_context |  | ||||||
|  *	Gets the NSS context for the IPsec handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_ipsec_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_get_ifnum |  | ||||||
|  *	Gets the IPsec interface number with a core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_ipsec_get_ifnum(int32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_msg_init |  | ||||||
|  *	Initializes an IPsec message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_msg \n |  | ||||||
|  * nss_ipsec_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nim       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_ipsec_msg_init(struct nss_ipsec_msg *nim, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 				nss_ipsec_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_get_encap_interface |  | ||||||
|  *	Gets the NSS interface number to be used for IPsec encapsulation message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Encapsulation interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_ipsec_get_encap_interface(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_get_decap_interface |  | ||||||
|  *	Gets the NSS interface number to be used for an IPsec decapsulation message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Decapsulation interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_ipsec_get_decap_interface(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_get_data_interface |  | ||||||
|  *	Gets the NSS interface number to be used for an IPsec data transfer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_ipsec_get_data_interface(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_ppe_port_config |  | ||||||
|  *	Configure Packet Processing Engine IPsec port. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] if_num  Data interface number. |  | ||||||
|  * @param[in] vsi_num Virtual switch instance number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_ipsec_ppe_port_config(struct nss_ctx_instance *ctx, struct net_device *netdev, |  | ||||||
| 				uint32_t if_num, uint32_t vsi_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_ppe_mtu_update() |  | ||||||
|  *	Configure Packet Processing Engine MTU for IPsec in-line. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in] if_num  Data interface number. |  | ||||||
|  * @param[in] mtu     Maximum transmission unit of Interface number. |  | ||||||
|  * @param[in] mru     Maximum Receive unit of Interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsec_ppe_mtu_update(struct nss_ctx_instance *ctx, uint32_t if_num, uint16_t mtu, uint16_t mru); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_IPSEC_H */ |  | ||||||
| @@ -1,691 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above 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_ipsec_cmn.h |  | ||||||
|  *	NSS IPsec interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IPSEC_CMN_H_ |  | ||||||
| #define __NSS_IPSEC_CMN_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ipsec_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSEC_CMN_ARPHRD_IPSEC 31 /**< ARP (iana.org) hardware type for an IPsec tunnel. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Flags for SA configuration. |  | ||||||
|  */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_IPV6 (0x1 << 0)		/**< IPv6 header. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_IPV4_NATT (0x1 << 1)		/**< IPv4 NAT traversal. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_IPV4_UDP (0x1 << 2)		/**< IPv4 UDP traversal. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_ESP_ESN (0x1 << 3)		/**< Enable ESP extended sequence number. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_ESP_SKIP (0x1 << 4)		/**< Skip ESP sequence number and ICV. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_ESP_REPLAY (0x1 << 5)	/**< Check ESP replay counter. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_CIPHER_NULL (0x1 << 6)	/**< NULL cipher mode. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_CIPHER_GCM (0x1 << 7)	/**< Galios counter mode. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_COPY_DSCP (0x1 << 8)		/**< Copy DSCP from inner to outer header. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_COPY_DF (0x1 << 9)		/**< Copy DF from inner node to outer node. */ |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_MODE_TRANS (0x1 << 10)	/**< Encapsulate or decapsulate in transport mode (default is tunnel mode). */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSEC_CMN_FLAG_HDR_MASK \ |  | ||||||
| 	(NSS_IPSEC_CMN_FLAG_IPV6 | NSS_IPSEC_CMN_FLAG_IPV4_NATT | NSS_IPSEC_CMN_FLAG_IPV4_UDP) |  | ||||||
| 							/**< Flag header mask. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSEC_CMN_FEATURE_INLINE_ACCEL 0x1		/**< Interface enabled for inline exception. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSEC_CMN_MDATA_VERSION 0x01		/**< Metadata version. */ |  | ||||||
| #define NSS_IPSEC_CMN_MDATA_MAGIC 0x8893		/**< Metadata magic. */ |  | ||||||
| #define NSS_IPSEC_CMN_MDATA_ORIGIN_HOST 0x01		/**< Metadata originates at the host. */ |  | ||||||
| #define NSS_IPSEC_CMN_MDATA_ALIGN_SZ sizeof(uint32_t)	/**< Metadata alignment size. */ |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_msg_type |  | ||||||
|  *	IPsec message types. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_cmn_msg_type { |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_NONE = 0,		/**< Nothing to do. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_NODE_CONFIG = 1,		/**< Configure IPsec node. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_CTX_CONFIG = 2,		/**< Configure IPsec dynamic node. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_CTX_SYNC = 3,		/**< Synchronize context statistics to host. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_SA_CREATE = 4,		/**< Create SA. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_SA_DESTROY = 5,		/**< Destroy SA. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_SA_SYNC = 6,		/**< Synchronize SA statistics to host. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_FLOW_CREATE = 7,		/**< Create flow. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_FLOW_DESTROY = 8,	/**< Delete flow. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_msg_error |  | ||||||
|  *	IPsec message error types. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_cmn_msg_error { |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_NONE = 0,		/**< No error. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_CTX_INVAL = 1,		/**< Invalid context. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_SA_ALLOC = 2,		/**< Failed to allocate SA. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_SA_INVAL = 3,		/**< Invalid SA. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_SA_DUP = 4,			/**< SA exists. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_SA_INUSE = 5,		/**< SA is in use. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_FLOW_ALLOC = 6,		/**< Failed to allocate flow. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_FLOW_INVAL = 7,		/**< Flow not found. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_FLOW_DUP = 8,		/**< Duplicate flow. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_FLOW_SA = 9,		/**< Failed to find SA for the flow. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_NODE_REG_DYNIF = 10, |  | ||||||
| 							/**< Error registering dynamic interface. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_UNHANDLED_MSG= 11,	/**< Unhandled message type. */ |  | ||||||
| 	NSS_IPSEC_CMN_MSG_ERROR_MAX			/**< Maximum error message. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ctx_type |  | ||||||
|  *	IPsec context type. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsec_cmn_ctx_type { |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_NONE = 0,	/**< Invalid direction. */ |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_INNER,		/**< Encapsulation. */ |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_MDATA_INNER,	/**< Metadata for encapsulation. */ |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_OUTER,		/**< Decapsulation. */ |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_MDATA_OUTER,	/**< Metadata for decapsulation. */ |  | ||||||
| 	NSS_IPSEC_CMN_CTX_TYPE_REDIR,		/**< Redirect. */ |  | ||||||
| 	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 |  | ||||||
|  *	IPsec tuple for creating flow entries. |  | ||||||
|  * |  | ||||||
|  * Note: This is a common selector which is used for preparing |  | ||||||
|  * a lookup tuple for incoming packets. The tuple is used |  | ||||||
|  * for computing the hash index in the flow table. There are multiple |  | ||||||
|  * fields in the tuple and the recipient node decides which fields |  | ||||||
|  * it must use from the tuple to calculate the hash index. The host |  | ||||||
|  * has no view of the hash index and hence must compute its own index |  | ||||||
|  * based on the tuple. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_flow_tuple { |  | ||||||
| 	uint32_t dest_ip[4];		/**< Destination IP. */ |  | ||||||
| 	uint32_t src_ip[4];		/**< Source IP. */ |  | ||||||
| 	uint32_t spi_index;		/**< ESP SPI index. */ |  | ||||||
|  |  | ||||||
| 	uint16_t dst_port;		/**< Destination L4 port. */ |  | ||||||
| 	uint16_t src_port;		/**< Source L4 port. */ |  | ||||||
|  |  | ||||||
| 	uint8_t user_pattern;		/**< User defined field. */ |  | ||||||
| 	uint8_t protocol;		/**< IP protocol types. */ |  | ||||||
| 	uint8_t ip_ver;			/**< IP version. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *nss_ipsec_cmn_sa_tuple |  | ||||||
|  *	IPsec outer header configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa_tuple { |  | ||||||
| 	uint32_t dest_ip[4];		/**< Destination IP. */ |  | ||||||
| 	uint32_t src_ip[4];		/**< Source IP. */ |  | ||||||
| 	uint32_t spi_index;		/**< ESP SPI index. */ |  | ||||||
|  |  | ||||||
| 	uint16_t dest_port;		/* Destination L4 port. */ |  | ||||||
| 	uint16_t src_port;		/* Source L4 port. */ |  | ||||||
|  |  | ||||||
| 	uint16_t crypto_index;		/**< Crypto index for the SA. */ |  | ||||||
| 	uint8_t protocol;		/**< Outer protocol. */ |  | ||||||
| 	uint8_t ip_ver;			/**< IP version. */ |  | ||||||
|  |  | ||||||
| 	uint8_t hop_limit;		/**< Time-to-Live or next hop limit. */ |  | ||||||
| 	uint8_t res[3];			/**< Reserved. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *nss_ipsec_cmn_sa_data |  | ||||||
|  *	IPsec SA data used for transformation. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa_data { |  | ||||||
| 	uint32_t seq_start;		/**< Starting sequence number. */ |  | ||||||
| 	uint32_t flags;			/**< Configuration flags. */ |  | ||||||
|  |  | ||||||
| 	uint16_t window_size;		/**< ESP sequence number window. */ |  | ||||||
| 	uint8_t dscp;			/**< Default DSCP value of the SA. */ |  | ||||||
| 	uint8_t df;			/**< Default do not fragment value of the SA. */ |  | ||||||
|  |  | ||||||
| 	uint8_t blk_len;		/**< Cipher block length. */ |  | ||||||
| 	uint8_t iv_len;			/**< IV length. */ |  | ||||||
| 	uint8_t icv_len;		/**< ESP trailers ICV length to apply. */ |  | ||||||
| 	uint8_t res1;			/**< Reserved. */ |  | ||||||
|  |  | ||||||
| 	uint32_t res2[4];		/**< Reserved for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_flow |  | ||||||
|  *	IPsec flow configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_flow { |  | ||||||
| 	struct nss_ipsec_cmn_flow_tuple flow_tuple;	/**< Flow tuple. */ |  | ||||||
| 	struct nss_ipsec_cmn_sa_tuple sa_tuple;		/**< SA tuple. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_sa |  | ||||||
|  *	IPsec SA configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa { |  | ||||||
| 	struct nss_ipsec_cmn_sa_tuple sa_tuple;		/**< SA tuple. */ |  | ||||||
| 	struct nss_ipsec_cmn_sa_data sa_data;		/**< SA data. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ctx |  | ||||||
|  *	IPsec context configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_ctx { |  | ||||||
| 	enum nss_ipsec_cmn_ctx_type type;	/**< Node type. */ |  | ||||||
| 	uint32_t except_ifnum;			/**< Exception interface for egress. */ |  | ||||||
| 	uint32_t sibling_ifnum;			/**< Sibling interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_node |  | ||||||
|  *	IPsec node configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_node { |  | ||||||
| 	bool dma_redirect;		/**< Enable redirect DMA ring. */ |  | ||||||
| 	bool dma_lookaside;		/**< Enable lookaside DMA ring. */ |  | ||||||
| 	uint16_t max_sa;		/**< Maximum number of SA(s) supported. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_sa_replay |  | ||||||
|  *	IPsec replay statistics |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa_replay { |  | ||||||
| 	uint64_t seq_start;		/**< Start of replay window. */ |  | ||||||
| 	uint64_t seq_cur;		/**< Current sequence number. */ |  | ||||||
| 	uint16_t window_size;		/**< Window size. */ |  | ||||||
| 	uint8_t res[6];			/**< Reserved for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_sa_stats |  | ||||||
|  *	IPsec SA statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa_stats { |  | ||||||
| 	struct nss_cmn_node_stats cmn_stats;	/**< Packet statistics. */ |  | ||||||
| 	uint32_t fail_headroom;			/**< Failed headroom check. */ |  | ||||||
| 	uint32_t fail_tailroom;			/**< Failed tailroom check. */ |  | ||||||
| 	uint32_t fail_replay;			/**< Failure in anti-replay check. */ |  | ||||||
| 	uint32_t fail_replay_dup;		/**< Failure in anti-replay; duplicate records. */ |  | ||||||
| 	uint32_t fail_replay_win;		/**< Failure in anti-replay; packet outside the window. */ |  | ||||||
| 	uint32_t fail_pbuf_crypto;		/**< Failed to allocate crypto pbuf. */ |  | ||||||
| 	uint32_t fail_queue;			/**< Failure due to queue full in IPsec. */ |  | ||||||
| 	uint32_t fail_queue_crypto;		/**< Failure due to queue full in crypto. */ |  | ||||||
| 	uint32_t fail_queue_nexthop;		/**< Failure due to queue full in next hop. */ |  | ||||||
| 	uint32_t fail_pbuf_alloc;		/**< Failure in pbuf allocation. */ |  | ||||||
| 	uint32_t fail_pbuf_linear;		/**< Failure in pbuf linearization. */ |  | ||||||
| 	uint32_t fail_pbuf_stats;		/**< Failure in pbuf allocation for statistics. */ |  | ||||||
| 	uint32_t fail_pbuf_align;		/**< Failure in pbuf access due to non-word alignment. */ |  | ||||||
| 	uint32_t fail_cipher;			/**< Failure in decrypting the data. */ |  | ||||||
| 	uint32_t fail_auth;			/**< Failure in authenticating the data. */ |  | ||||||
| 	uint32_t fail_seq_ovf;			/**< Failure due to sequence number rollover. */ |  | ||||||
| 	uint32_t fail_blk_len;			/**< Failure in decapsulation due to bad cipher block length. */ |  | ||||||
| 	uint32_t fail_hash_len;			/**< Failure in decapsulation due to bad hash block length. */ |  | ||||||
| 	uint32_t fail_transform;		/**< Failure in transformation; general error. */ |  | ||||||
| 	uint32_t fail_crypto;			/**< Failure in crypto transformation. */ |  | ||||||
| 	uint32_t fail_cle;			/**< Failure in classification; general failure. */ |  | ||||||
| 	uint32_t is_stopped;			/**< Indicates if SA is stopped; for example, seq overflow. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_sa_sync |  | ||||||
|  *	IPsec SA sync message. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_sa_sync { |  | ||||||
| 	struct nss_ipsec_cmn_sa_replay replay;	/**< Replay statistics. */ |  | ||||||
| 	struct nss_ipsec_cmn_sa_tuple sa_tuple;	/**< SA tuple. */ |  | ||||||
| 	struct nss_ipsec_cmn_sa_stats stats;	/**< Packet and failure statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ctx_stats |  | ||||||
|  *	IPsec context statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_ctx_stats { |  | ||||||
| 	struct nss_cmn_node_stats cmn_stats; |  | ||||||
| 					/**< Packet statistics. */ |  | ||||||
| 	uint32_t exceptioned;		/**< Exceptioned to host. */ |  | ||||||
| 	uint32_t linearized;		/**< Linearized packets. */ |  | ||||||
| 	uint32_t redirected;		/**< Redirected from inline. */ |  | ||||||
| 	uint32_t dropped;		/**< Total dropped packets. */ |  | ||||||
| 	uint32_t fail_sa;		/**< Failed to find SA. */ |  | ||||||
| 	uint32_t fail_flow;		/**< Failed to find flow. */ |  | ||||||
| 	uint32_t fail_stats;		/**< Failed to send statistics. */ |  | ||||||
| 	uint32_t fail_exception;	/**< Failed to exception. */ |  | ||||||
| 	uint32_t fail_transform;	/**< Failed to produce output. */ |  | ||||||
| 	uint32_t fail_linearized;	/**< Failed to linearize. */ |  | ||||||
| 	uint32_t fail_mdata_ver;	/**< Invalid metadata version. */ |  | ||||||
| 	uint32_t fail_ctx_active;	/**< Failed to queue as context is not active. */ |  | ||||||
| 	uint32_t fail_pbuf_crypto;	/**< Failed to allocate pbuf for crypto operation. */ |  | ||||||
| 	uint32_t fail_queue_crypto;	/**< Failed to queue pbuf to crypto pnode. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ctx_sync |  | ||||||
|  *	IPsec context synchronous message. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_ctx_sync { |  | ||||||
| 	enum nss_ipsec_cmn_ctx_type type;	/**< IPsec context type. */ |  | ||||||
| 	struct nss_ipsec_cmn_ctx_stats stats;	/**< Context statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_mdata_cmn |  | ||||||
|  *	IPsec common metadata information. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_mdata_cmn { |  | ||||||
| 	uint8_t version;		/**< Metadata version. */ |  | ||||||
| 	uint8_t origin;			/**< Metadata origin (host or NSS). */ |  | ||||||
| 	uint16_t len;			/**< Metadata length including extra bytes. */ |  | ||||||
| 	uint8_t res[2];			/**< Reserved for future. */ |  | ||||||
| 	uint16_t magic;			/**< Metadata magic. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_mdata_encap |  | ||||||
|  *	IPsec encapsulation metadata information. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_mdata_encap { |  | ||||||
| 	struct nss_ipsec_cmn_sa_tuple sa;	/**< SA tuple. */ |  | ||||||
| 	uint32_t seq_num;			/**< Sequence number for encapsulation (zero disables it). */ |  | ||||||
| 	uint16_t data_len;			/**< Length of data to encapsulate. */ |  | ||||||
| 	uint16_t flags;				/**< Encapsulation metadata flags. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_mdata_decap |  | ||||||
|  *	IPsec decapsulation metadata information. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_mdata_decap { |  | ||||||
| 	struct nss_ipsec_cmn_sa_tuple sa;	/**< SA tuple. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_mdata |  | ||||||
|  *	IPsec metadata for host originated packets. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_mdata { |  | ||||||
| 	struct nss_ipsec_cmn_mdata_cmn cm;		/**< Common metadata. */ |  | ||||||
|  |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsec_cmn_mdata_encap encap;	/**< Encapsulation metadata. */ |  | ||||||
| 		struct nss_ipsec_cmn_mdata_decap decap;	/**< Decapsulation metadata. */ |  | ||||||
| 	} 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 |  | ||||||
|  *	Message structure for NSS IPsec messages. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsec_cmn_msg { |  | ||||||
| 	struct nss_cmn_msg cm;				/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of IPsec interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsec_cmn_node node;		/**< Node configuration message. */ |  | ||||||
| 		struct nss_ipsec_cmn_ctx ctx;		/**< Context configuration message. */ |  | ||||||
| 		struct nss_ipsec_cmn_sa sa;		/**< SA configuration message. */ |  | ||||||
| 		struct nss_ipsec_cmn_flow flow;		/**< Flow configuration message. */ |  | ||||||
| 		struct nss_ipsec_cmn_sa_sync sa_sync;	/**< SA statistics message. */ |  | ||||||
| 		struct nss_ipsec_cmn_ctx_sync ctx_sync; /**< Context statistics message. */ |  | ||||||
| 	} msg;						/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_mdata_init |  | ||||||
|  *	Initialize the metadata common fields. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_cmn_mdata |  | ||||||
|  * |  | ||||||
|  * @param[in] mdata Metadata pointer. |  | ||||||
|  * @param[in] len   Metadata length including extra bytes. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to metadata payload. |  | ||||||
|  */ |  | ||||||
| static inline void *nss_ipsec_cmn_mdata_init(struct nss_ipsec_cmn_mdata *mdata, uint16_t len) |  | ||||||
| { |  | ||||||
| 	mdata->cm.len = len; |  | ||||||
| 	mdata->cm.magic = NSS_IPSEC_CMN_MDATA_MAGIC; |  | ||||||
| 	mdata->cm.version = NSS_IPSEC_CMN_MDATA_VERSION; |  | ||||||
| 	mdata->cm.origin = NSS_IPSEC_CMN_MDATA_ORIGIN_HOST; |  | ||||||
|  |  | ||||||
| 	return &mdata->data; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving message notifications. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_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_ipsec_cmn_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving 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 message data. |  | ||||||
|  * @param[in] napi    Pointer to the NAPI structure. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_ipsec_cmn_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_get_context |  | ||||||
|  *	Gets the NSS context for the IPsec handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_ipsec_cmn_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_get_ifnum_with_coreid |  | ||||||
|  *	Gets the IPsec interface number with a core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| 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 |  | ||||||
|  *	Registers the IPsec interface with the NSS for sending and |  | ||||||
|  *	receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_cmn_data_callback_t \n |  | ||||||
|  * nss_ipsec_cmn_msg_callback_t \n |  | ||||||
|  * nss_dynamic_interface_type \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num        NSS interface number. |  | ||||||
|  * @param[in] netdev        Pointer to the associated network device. |  | ||||||
|  * @param[in] cb_data       Callback for the data. |  | ||||||
|  * @param[in] cb_msg        Callback for the message. |  | ||||||
|  * @param[in] features      Socket buffer types supported by this interface. |  | ||||||
|  * @param[in] type          Dynamic interface type. |  | ||||||
|  * @param[in] app_data      Application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_ipsec_cmn_register_if(uint32_t if_num, struct net_device *netdev, |  | ||||||
| 						nss_ipsec_cmn_data_callback_t cb_data, |  | ||||||
| 						nss_ipsec_cmn_msg_callback_t cb_msg, |  | ||||||
| 						uint32_t features, enum nss_dynamic_interface_type type, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_notify_unregister |  | ||||||
|  *	Deregisters the message notifier from the HLOS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The message notifier must have been previously registered. |  | ||||||
|  */ |  | ||||||
| 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 |  | ||||||
|  *	Initializes an IPsec message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsec_cmn_msg \n |  | ||||||
|  * nss_ipsec_cmn_msg_type \n |  | ||||||
|  * nss_ipsec_cmn_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nim       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_ipsec_cmn_msg_init(struct nss_ipsec_cmn_msg *nim, uint16_t if_num, enum nss_ipsec_cmn_msg_type type, |  | ||||||
| 				uint16_t len, nss_ipsec_cmn_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_tx_msg |  | ||||||
|  *	Sends an asynchronous IPsec message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_ipsec_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_cmn_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_ipsec_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_tx_msg_sync |  | ||||||
|  *	Sends a synchronous IPsec message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_ipsec_cmn_msg_type \n |  | ||||||
|  * nss_ipsec_cmn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]  nss_ctx  Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in]  if_num   NSS interface number. |  | ||||||
|  * @param[in]  type     Type of message. |  | ||||||
|  * @param[in]  len      Size of the payload. |  | ||||||
|  * @param[in]  nicm     Pointer to the NSS IPsec message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_cmn_tx_msg_sync(struct nss_ctx_instance *nss_ctx, uint32_t if_num, |  | ||||||
| 						enum nss_ipsec_cmn_msg_type type, uint16_t len, |  | ||||||
| 						struct nss_ipsec_cmn_msg *nicm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_tx_buf |  | ||||||
|  *	Sends a buffer to NSS for IPsec encapsulation or de-capsulation. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff \n |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in] skb     Pointer to the message data. |  | ||||||
|  * @param[in] if_num  Pointer to the NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_ipsec_cmn_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *skb, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ppe_port_config |  | ||||||
|  *	Configure Packet Processing Engine IPsec port. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] if_num  Data interface number. |  | ||||||
|  * @param[in] vsi_num Virtual switch instance number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_ipsec_cmn_ppe_port_config(struct nss_ctx_instance *ctx, struct net_device *netdev, |  | ||||||
| 					uint32_t if_num, uint32_t vsi_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsec_cmn_ppe_mtu_update() |  | ||||||
|  *	Configure Packet Processing Engine MTU for IPsec inline. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx     Pointer to the context of the HLOS driver. |  | ||||||
|  * @param[in] if_num  Data interface number. |  | ||||||
|  * @param[in] mtu     Maximum transmission unit of interface number. |  | ||||||
|  * @param[in] mru     Maximum receive unit of interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* !__NSS_IPSEC_CMN_H */ |  | ||||||
| @@ -1,443 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-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_ipsecmgr.h |  | ||||||
|  *	NSS IPSec Manager interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IPSECMGR_H |  | ||||||
| #define __NSS_IPSECMGR_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ipsec_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSECMGR_DEBUG_LVL_ERROR 1		/**< Turn on debug for an error. */ |  | ||||||
| #define NSS_IPSECMGR_DEBUG_LVL_WARN 2		/**< Turn on debug for a warning. */ |  | ||||||
| #define NSS_IPSECMGR_DEBUG_LVL_INFO 3		/**< Turn on debug for information. */ |  | ||||||
| #define NSS_IPSECMGR_DEBUG_LVL_TRACE 4		/**< Turn on debug for trace. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSECMGR_TUN_NAME "ipsectun%d" |  | ||||||
| 		/**< IPsec tunnel name. */ |  | ||||||
| #define NSS_IPSECMGR_MAX_TUNNELS (NSS_CRYPTO_MAX_IDXS/2) |  | ||||||
| 		/**< Maximum number of IPsec tunnels. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Length of the header added after encapsulation. |  | ||||||
|  * |  | ||||||
|  * This estimate must be accurate but large enough to accomodate most use cases. |  | ||||||
|  */ |  | ||||||
| #define NSS_IPSECMGR_TUN_MAX_HDR_LEN 96 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Space required in the head and tail of the buffer |  | ||||||
|  */ |  | ||||||
| #define NSS_IPSECMGR_TUN_HEADROOM 128		/**< Size of the buffer headroom. */ |  | ||||||
| #define NSS_IPSECMGR_TUN_TAILROOM 192		/**< Size of the buffer tailroom. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSECMGR_TUN_MTU(x) (x - NSS_IPSECMGR_TUN_MAX_HDR_LEN) |  | ||||||
| 		/**< MTU of the IPsec tunnel. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSECMGR_NATT_PORT_DATA 4500	/**< Number of the NATT port. */ |  | ||||||
|  |  | ||||||
| #define NSS_IPSECMGR_MIN_REPLAY_WIN 32		/**< Minimum size of the replay window. */ |  | ||||||
| #define NSS_IPSECMGR_MAX_REPLAY_WIN 1024	/**< Maximum size of the replay window. */ |  | ||||||
| #define NSS_IPSECMGR_MAX_ICV_LEN 32		/**< Maximum size of the ICV. */ |  | ||||||
| #define NSS_IPSECMGR_MAX_DSCP 63		/**< Maximum size of the descriptor. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_flow_type |  | ||||||
|  *	Flow types for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsecmgr_flow_type { |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_NONE = 0, |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_V4_TUPLE = 1, |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_V6_TUPLE = 2, |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_V4_SUBNET = 3, |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_V6_SUBNET = 4, |  | ||||||
| 	NSS_IPSECMGR_FLOW_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_type |  | ||||||
|  *	Security association types for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsecmgr_sa_type { |  | ||||||
| 	NSS_IPSECMGR_SA_TYPE_NONE = 0, |  | ||||||
| 	NSS_IPSECMGR_SA_TYPE_V4 = 1, |  | ||||||
| 	NSS_IPSECMGR_SA_TYPE_V6 = 2, |  | ||||||
| 	NSS_IPSECMGR_SA_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_event_type |  | ||||||
|  *	Event types for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| enum nss_ipsecmgr_event_type { |  | ||||||
| 	NSS_IPSECMGR_EVENT_NONE = 0, |  | ||||||
| 	NSS_IPSECMGR_EVENT_SA_STATS, |  | ||||||
| 	NSS_IPSECMGR_EVENT_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_v4 |  | ||||||
|  *	IPv4 security associations for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_sa_v4 { |  | ||||||
| 	uint32_t src_ip;		/**< IPv4 source IP. */ |  | ||||||
| 	uint32_t dst_ip;		/**< IPv4 destination IP. */ |  | ||||||
| 	uint32_t ttl;			/**< IPv4 time-to-live. */ |  | ||||||
| 	uint32_t spi_index;		/**< ESP SPI index. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_v6 |  | ||||||
|  *	IPv6 security associations for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_sa_v6 { |  | ||||||
| 	uint32_t src_ip[4];	/**< IPv6 source IP. */ |  | ||||||
| 	uint32_t dst_ip[4];	/**< IPv6 destination IP. */ |  | ||||||
| 	uint32_t hop_limit;	/**< IPv6 hop limit. */ |  | ||||||
| 	uint32_t spi_index;	/**< SPI index of the encapsulating security payload (ESP). */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_data |  | ||||||
|  *	Security association data for the IPsec manager. |  | ||||||
|  * |  | ||||||
|  * For DSCP marking, use the following settings: |  | ||||||
|  * - Copy inner header to outer header: |  | ||||||
|  *    - dscp_copy = 1 |  | ||||||
|  *    - dscp = 0 |  | ||||||
|  * - Fixed mark on outer header: |  | ||||||
|  *    - dscp_copy = 0 |  | ||||||
|  *    - dscp = <0 to 63> |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_sa_data { |  | ||||||
| 	uint32_t crypto_index;	/**< Crypto session index returned by the driver. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Security association data for the IPsec manager. |  | ||||||
| 	 */ |  | ||||||
| 	struct { |  | ||||||
| 		uint16_t replay_win; |  | ||||||
| 				/**< Sequence number window size for anti-replay. */ |  | ||||||
| 		uint8_t icv_len; |  | ||||||
| 				/**< Hash length. */ |  | ||||||
| 		uint8_t dscp; |  | ||||||
| 				/**< Default DSCP value of the security association. */ |  | ||||||
|  |  | ||||||
| 		bool dscp_copy; |  | ||||||
| 				/**< Copy DSCP from the inner header to the outer header. */ |  | ||||||
| 		bool nat_t_req; |  | ||||||
| 				/**< NAT-T is required. */ |  | ||||||
| 		bool seq_skip; |  | ||||||
| 				/**< Skip the ESP sequence for encapsulation. */ |  | ||||||
| 		bool trailer_skip; |  | ||||||
| 				/**< Skip the ESP trailer for encapsulation. */ |  | ||||||
| 		bool df_copy; |  | ||||||
| 				/**< Copy DF from the inner header to the outer header. */ |  | ||||||
| 		uint8_t df; |  | ||||||
| 				/**< DF value for the outer header, if nocopy is selected. */ |  | ||||||
| 	} esp;		/**< Payload of security association data. */ |  | ||||||
|  |  | ||||||
| 	bool enable_esn;	/**< Enable the extended sequence number. */ |  | ||||||
| 	bool use_pattern;	/**< Use a random pattern in a hash calculation. */ |  | ||||||
| 	uint32_t fail_hash_thresh;	/**< Threshold for consecutive hash failure. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_v4_tuple |  | ||||||
|  *	IPv4 encapsulation flow tuple for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_encap_v4_tuple { |  | ||||||
| 	uint32_t src_ip;		/**< Source IP. */ |  | ||||||
| 	uint32_t dst_ip;		/**< Destination IP. */ |  | ||||||
| 	uint32_t protocol;		/**< Protocol. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_v6_tuple |  | ||||||
|  *	IPv6 encapsulation flow tuple for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_encap_v6_tuple { |  | ||||||
| 	uint32_t src_ip[4];		/**< Source IP. */ |  | ||||||
| 	uint32_t dst_ip[4];		/**< Destination IP. */ |  | ||||||
| 	uint32_t next_hdr;		/**< Transport layer protocol. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_v4_subnet |  | ||||||
|  *	IPv4 encapsulation flow subnet for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_encap_v4_subnet { |  | ||||||
| 	uint32_t dst_subnet;		/**< Destination subnet. */ |  | ||||||
| 	uint32_t dst_mask;		/**< Destination subnet mask. */ |  | ||||||
| 	uint32_t protocol;		/**< IPv4 or IPv6 protocol. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_v6_subnet |  | ||||||
|  *	IPv6 encapsulation flow subnet for the IPsec manager. |  | ||||||
|  * |  | ||||||
|  * Store least significant word in dst_subnet[0] and the most significant word |  | ||||||
|  * in dst_subnet[3]. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_encap_v6_subnet { |  | ||||||
| 	uint32_t dst_subnet[4];		/**< Destination subnet. */ |  | ||||||
| 	uint32_t dst_mask[4];		/**< Destination subnet mask. */ |  | ||||||
| 	uint32_t next_hdr;		/**< Transport layer protocol. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa |  | ||||||
|  *	Security association information for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_sa { |  | ||||||
| 	enum nss_ipsecmgr_sa_type type;		/**< Security association type. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * IPsec manager security association data. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsecmgr_sa_v4 v4;	/**< IPv4 security association. */ |  | ||||||
| 		struct nss_ipsecmgr_sa_v6 v6;	/**< IPv6 security association. */ |  | ||||||
| 	} data;		/**< IPsec manager security association data. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_stats |  | ||||||
|  *	Security association statistics exported by the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_sa_stats { |  | ||||||
| 	struct nss_ipsecmgr_sa sa;	/**< Security association information. */ |  | ||||||
| 	uint32_t crypto_index;		/**< Crypto session index. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Security association statistics used by the IPsec manager. |  | ||||||
| 	 */ |  | ||||||
| 	struct { |  | ||||||
| 		uint32_t bytes;		/**< Number of bytes processed. */ |  | ||||||
| 		uint32_t count;		/**< Number of packets processed. */ |  | ||||||
| 	} pkts;		/**< Processing statistics. */ |  | ||||||
|  |  | ||||||
| 	uint64_t seq_num;		/**< Current sequence number. */ |  | ||||||
| 	uint64_t window_max;		/**< Maximum size of the window. */ |  | ||||||
| 	uint32_t window_size;		/**< Current size of the window. */ |  | ||||||
|  |  | ||||||
| 	bool fail_hash_alarm; |  | ||||||
| 			/**< Alarm for consecutive hash fail. */ |  | ||||||
| 	bool esn_enabled; |  | ||||||
| 			/**< Specifies whether ESN is enabled. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_event |  | ||||||
|  *	Event information for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_event { |  | ||||||
| 	enum nss_ipsecmgr_event_type type;	/**< Event type. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Event information statistics for the IPsec manager. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsecmgr_sa_stats stats; |  | ||||||
| 				/**< Security association statistics. */ |  | ||||||
| 	} data;			/**< Event information. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_flow |  | ||||||
|  *	Encapsulation flow information for the IPsec manager. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_encap_flow { |  | ||||||
| 	enum nss_ipsecmgr_flow_type type;	/**< Flow type. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of encapsulation flow data for the IPsec manager. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_ipsecmgr_encap_v4_tuple v4_tuple; |  | ||||||
| 				/**< IPv4 tuple. */ |  | ||||||
| 		struct nss_ipsecmgr_encap_v4_subnet v4_subnet; |  | ||||||
| 				/**< IPv4 subnet. */ |  | ||||||
| 		struct nss_ipsecmgr_encap_v6_tuple v6_tuple; |  | ||||||
| 				/**< IPv6 tuple. */ |  | ||||||
| 		struct nss_ipsecmgr_encap_v6_subnet v6_subnet; |  | ||||||
| 				/**< IPv6 subnet. */ |  | ||||||
| 	} data;		/**< Encapsulation flow information. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving IPsec data. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the context of the data. |  | ||||||
|  * @param[in] skb  Pointer to the data socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_ipsecmgr_data_cb_t) (void *ctx, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving IPsec events. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsecmgr_event |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the context of the event. |  | ||||||
|  * @param[in] ev   Pointer to the event. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_ipsecmgr_event_cb_t) (void *ctx, struct nss_ipsecmgr_event *ev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_callback |  | ||||||
|  *	Callback information. |  | ||||||
|  */ |  | ||||||
| struct nss_ipsecmgr_callback { |  | ||||||
| 	void *ctx;				/**< Context of the caller. */ |  | ||||||
| 	nss_ipsecmgr_data_cb_t data_fn;		/**< Data callback function. */ |  | ||||||
| 	nss_ipsecmgr_event_cb_t event_fn;	/**< Event callback function. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_tunnel_add |  | ||||||
|  *	Adds a new IPsec tunnel. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ipsecmgr_callback |  | ||||||
|  * |  | ||||||
|  * @param[in] cb  Pointer to the message callback. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Linux NETDEVICE or NULL. |  | ||||||
|  */ |  | ||||||
| struct net_device *nss_ipsecmgr_tunnel_add(struct nss_ipsecmgr_callback *cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_tunnel_del |  | ||||||
|  *	Deletes an existing IPsec tunnel. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] tun  Pointer to the network device associated with the tunnel. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsecmgr_tunnel_del(struct net_device *tun); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_tunnel_update_callback |  | ||||||
|  *	Updates the binding of netdevice and callback. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] tun  Pointer to IPsec tunnel. |  | ||||||
|  * @param[in] cur  Pointer to Linux netdevice. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_ipsecmgr_tunnel_update_callback(struct net_device *tun, struct net_device *cur); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_add |  | ||||||
|  *	Adds an encapsulation flow rule to the IPsec offload database. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_ipsecmgr_encap_flow \n |  | ||||||
|  * nss_ipsecmgr_sa \n |  | ||||||
|  * nss_ipsecmgr_sa_data |  | ||||||
|  * |  | ||||||
|  * @param[in] tun   Pointer to the network device associated with the tunnel. |  | ||||||
|  * @param[in] flow  Pointer to the flow or subnet to add. |  | ||||||
|  * @param[in] sa    Pointer to the security association for the flow. |  | ||||||
|  * @param[in] data  Pointer to additional security association data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsecmgr_encap_add(struct net_device *tun, struct nss_ipsecmgr_encap_flow *flow, struct nss_ipsecmgr_sa *sa, |  | ||||||
| 				struct nss_ipsecmgr_sa_data *data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_encap_del |  | ||||||
|  *	Deletes an encapsulation flow rule from the IPsec offload database. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_ipsecmgr_encap_flow \n |  | ||||||
|  * nss_ipsecmgr_sa |  | ||||||
|  * |  | ||||||
|  * @param[in] tun   Pointer to the network device associated with the tunnel. |  | ||||||
|  * @param[in] flow  Pointer to the flow or subnet to delete. |  | ||||||
|  * @param[in] sa    Pointer to the security association for the flow. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsecmgr_encap_del(struct net_device *tun, struct nss_ipsecmgr_encap_flow *flow, struct nss_ipsecmgr_sa *sa); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_decap_add |  | ||||||
|  *	Adds a decapsulation security association to the offload database. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_ipsecmgr_sa \n |  | ||||||
|  * nss_ipsenss_ipsecmgr_sa_datacmgr_sa |  | ||||||
|  * |  | ||||||
|  * @param[in] tun   Pointer to the network device associated with the tunnel. |  | ||||||
|  * @param[in] sa    Pointer to the security association for the decapsulation. |  | ||||||
|  * @param[in] data  Pointer to additional security association data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsecmgr_decap_add(struct net_device *tun, struct nss_ipsecmgr_sa *sa, struct nss_ipsecmgr_sa_data *data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipsecmgr_sa_flush |  | ||||||
|  *	Flushes the security association and all associated flows and subnets. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_ipsecmgr_sa |  | ||||||
|  * |  | ||||||
|  * @param[in] tun  Pointer to the network device associated with the tunnel. |  | ||||||
|  * @param[in] sa   Pointer to the security association to flush. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| bool nss_ipsecmgr_sa_flush(struct net_device *tun, struct nss_ipsecmgr_sa *sa); |  | ||||||
|  |  | ||||||
| #endif /* __KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_IPSECMGR_H */ |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,89 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * |  | ||||||
|  * 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_ipv4_reasm.h |  | ||||||
|  *	NSS IPv4 reassembly interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IPV4_REASM_H |  | ||||||
| #define __NSS_IPV4_REASM_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ipv4_reasm_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_ipv4_reasm_stats_types |  | ||||||
|  *	IPv4 reassembly node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_ipv4_reasm_stats_types { |  | ||||||
|         NSS_IPV4_REASM_STATS_EVICTIONS,		/**< Number of evicted fragment queues due to set memory threshold. */ |  | ||||||
| 	NSS_IPV4_REASM_STATS_ALLOC_FAILS,	/**< Number of fragment queue allocation failures. */ |  | ||||||
| 	NSS_IPV4_REASM_STATS_TIMEOUTS,		/**< Number of expired fragment queues. */ |  | ||||||
| 	NSS_IPV4_REASM_STATS_MAX,		/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv4_reasm_stats_notification |  | ||||||
|  *	Data for sending IPv4 reassembly statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipv4_reasm_stats_notification { |  | ||||||
| 	uint32_t core_id;					/**< Core ID. */ |  | ||||||
| 	uint64_t cmn_node_stats[NSS_STATS_NODE_MAX];		/**< Common node statistics. */ |  | ||||||
| 	uint64_t ipv4_reasm_stats[NSS_IPV4_REASM_STATS_MAX];	/**< IPv4 reassembly statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv4_reasm_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_ipv4_reasm_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv4_reasm_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_ipv4_reasm_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_IPV4_REASM_H */ |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,92 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * |  | ||||||
|  * 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_ipv6_reasm.h |  | ||||||
|  *	NSS IPv6 reassembly interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_IPV6_REASM_H |  | ||||||
| #define __NSS_IPV6_REASM_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ipv6_reasm_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv6_reasm_stats |  | ||||||
|  *	IPv6 reassembly node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_ipv6_reasm_stats { |  | ||||||
| 	NSS_IPV6_REASM_STATS_ALLOC_FAILS, |  | ||||||
| 				/**< Number of fragment queue allocation failures. */ |  | ||||||
| 	NSS_IPV6_REASM_STATS_TIMEOUTS, |  | ||||||
| 				/**< Number of expired fragment queues. */ |  | ||||||
| 	NSS_IPV6_REASM_STATS_DISCARDS, |  | ||||||
| 				/**< Number of fragment queues discarded due to malformed fragments. */ |  | ||||||
| 	NSS_IPV6_REASM_STATS_MAX, |  | ||||||
| 				/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv6_reasm_stats_notification |  | ||||||
|  *	Data for sending IPv6 reassembly statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_ipv6_reasm_stats_notification { |  | ||||||
| 	uint32_t core_id;					/**< Core ID. */ |  | ||||||
| 	uint64_t cmn_node_stats[NSS_STATS_NODE_MAX];		/**< Common node statistics. */ |  | ||||||
| 	uint64_t ipv6_reasm_stats[NSS_IPV6_REASM_STATS_MAX];	/**< IPv6 reassembly statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv6_reasm_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_ipv6_reasm_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ipv6_reasm_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_ipv6_reasm_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_IPV6_REASM_H */ |  | ||||||
| @@ -1,327 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2015, 2017-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_l2tpv2.h |  | ||||||
|  *	NSS L2TPv2 interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_L2TP_V2_H_ |  | ||||||
| #define _NSS_L2TP_V2_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_l2tpv2_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported L2TPv2 sessions. |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_L2TPV2_DYNAMIC_INTERFACES 4 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_metadata_types |  | ||||||
|  *	Message types for L2TPv2 requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_l2tpv2_metadata_types { |  | ||||||
| 	NSS_L2TPV2_MSG_SESSION_CREATE, |  | ||||||
| 	NSS_L2TPV2_MSG_SESSION_DESTROY, |  | ||||||
| 	NSS_L2TPV2_MSG_SYNC_STATS, |  | ||||||
| 	NSS_L2TPV2_MSG_BIND_IPSEC_IF, |  | ||||||
| 	NSS_L2TPV2_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_stats_session |  | ||||||
|  *	L2TPv2 debug statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_l2tpv2_stats_session { |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_RX_PPP_LCP_PKTS,		/**< Number of PPP LCP packets received. */ |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_RX_EXP_DATA_PKTS,		/**< Number of Rx exceptioned packets. */ |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_ENCAP_PBUF_ALLOC_FAIL_PKTS,	/**< Number of times packet buffer allocation failed during encapsulation. */ |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_DECAP_PBUF_ALLOC_FAIL_PKTS,	/*< Number of times packet buffer allocation failed during decapsulation. */ |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_DECAP_L2TPOIPSEC_SRC_ERR, |  | ||||||
| 						/**< Number of packets dropped due to source error in L2TP over IPsec flow in decapsulation. */ |  | ||||||
| 	NSS_L2TPV2_STATS_SESSION_MAX		/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_stats_notification |  | ||||||
|  *	L2TPv2 statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_stats_notification { |  | ||||||
| 	uint32_t core_id;				/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;				/**< Interface number. */ |  | ||||||
| 	uint64_t stats[NSS_L2TPV2_STATS_SESSION_MAX];	/**< L2TPv2 statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_session_create_msg |  | ||||||
|  *	Payload for creating an L2TPv2 session. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_session_create_msg { |  | ||||||
| 	uint16_t local_tunnel_id;	/**< Local identifier for the control connection. */ |  | ||||||
| 	uint16_t local_session_id;	/**< Local identifier of session inside a tunnel. */ |  | ||||||
| 	uint16_t peer_tunnel_id;	/**< Remote identifier for the control connection. */ |  | ||||||
| 	uint16_t peer_session_id;	/**< Remote identifier of session inside a tunnel. */ |  | ||||||
|  |  | ||||||
| 	uint32_t sip;			/**< Local tunnel endpoint IP address. */ |  | ||||||
| 	uint32_t dip;			/**< Remote tunnel endpoint IP address. */ |  | ||||||
| 	uint32_t reorder_timeout;	/**< Reorder timeout for out of order packets */ |  | ||||||
|  |  | ||||||
| 	uint16_t sport;			/**< Local source port. */ |  | ||||||
| 	uint16_t dport;			/**< Remote source port. */ |  | ||||||
|  |  | ||||||
| 	uint8_t recv_seq;		/**< Sequence number received. */ |  | ||||||
| 	uint8_t oip_ttl;		/**< Maximum time-to-live value for outer IP packet. */ |  | ||||||
| 	uint8_t udp_csum;		/**< UDP checksum. */ |  | ||||||
| 	uint8_t reserved;		/**< Alignment padding. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_session_destroy_msg |  | ||||||
|  *	Payload for deletion an L2TPv2 session. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_session_destroy_msg { |  | ||||||
| 	uint16_t local_tunnel_id;	/**< ID of the local tunnel. */ |  | ||||||
| 	uint16_t local_session_id;	/**< ID of the local session. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_bind_ipsec_if_msg |  | ||||||
|  *	Message for binding the IPsec interface with L2TP. |  | ||||||
|  * |  | ||||||
|  * Message for configuring the L2TP session with an |  | ||||||
|  * IPsec inner interface number. This is used when |  | ||||||
|  * L2TP tunnel is enabled with IPsec. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_bind_ipsec_if_msg { |  | ||||||
| 	uint32_t ipsec_ifnum;	/**< Inner IPSec interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_sync_session_stats_msg |  | ||||||
|  *	Message information for L2TPv2 synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_sync_session_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t rx_errors;			/**< Not used. Reserved for backward compatibility. */ |  | ||||||
| 	uint32_t rx_seq_discards; |  | ||||||
| 			/**< Rx packets discarded because of a sequence number check. */ |  | ||||||
| 	uint32_t rx_oos_packets;		/**< Number of out of sequence packets received. */ |  | ||||||
| 	uint32_t tx_errors;			/**< Not used. Reserved for backward compatibility. */ |  | ||||||
| 	uint32_t tx_dropped;			/**< Tx packets dropped because of encapsulation failure or next node's queue is full. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Debug statistics for L2tp v2. |  | ||||||
| 	 */ |  | ||||||
| 	struct { |  | ||||||
| 		uint32_t rx_ppp_lcp_pkts; |  | ||||||
| 				/**< Number of PPP LCP packets received. */ |  | ||||||
| 		uint32_t rx_exception_data_pkts; |  | ||||||
| 				/**< Data packet exceptions sent to the host. */ |  | ||||||
| 		uint32_t encap_pbuf_alloc_fail; |  | ||||||
| 				/**< Buffer allocation failure during encapsulation. */ |  | ||||||
| 		uint32_t decap_pbuf_alloc_fail; |  | ||||||
| 				/**< Buffer allocation failure during decapsulation. */ |  | ||||||
| 		uint32_t decap_l2tpoipsec_src_error; |  | ||||||
| 				/**< Packets dropped due to the wrong source for the L2TPoIPsec flow. */ |  | ||||||
| 	} debug_stats;	/**< Debug statistics object for l2tp v2. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_msg |  | ||||||
|  *	Data for sending and receiving L2TPv2 messages. |  | ||||||
|  */ |  | ||||||
| struct nss_l2tpv2_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an L2TPv2 message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_l2tpv2_session_create_msg session_create_msg; |  | ||||||
| 				/**< Session create message. */ |  | ||||||
| 		struct nss_l2tpv2_session_destroy_msg session_destroy_msg; |  | ||||||
| 				/**< Session delete message. */ |  | ||||||
| 		struct nss_l2tpv2_sync_session_stats_msg stats; |  | ||||||
| 				/**< Session statistics. */ |  | ||||||
| 		struct nss_l2tpv2_bind_ipsec_if_msg bind_ipsec_if_msg; |  | ||||||
| 				/**< Bind IPsec interface message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving L2TPv2 messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_l2tpv2_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_l2tpv2_msg_callback_t)(void *app_data, struct nss_l2tpv2_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_tx |  | ||||||
|  *	Sends L2TPv2 messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_l2tpv2_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_l2tpv2_tx(struct nss_ctx_instance *nss_ctx, struct nss_l2tpv2_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_get_context. |  | ||||||
|  *	Gets the L2TPv2 context used in L2TPv2 messages sent to the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_l2tpv2_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving L2TPv2 tunnel 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_l2tpv2_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_l2tpv2_if |  | ||||||
|  *	Registers the L2TPv2 tunnel interface with the NSS for sending and |  | ||||||
|  *	receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_l2tpv2_callback_t \n |  | ||||||
|  * nss_l2tpv2_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num           NSS interface number. |  | ||||||
|  * @param[in] l2tpv2_callback  Callback for the L2TP tunnel data. |  | ||||||
|  * @param[in] msg_callback     Callback for the L2TP tunnel message. |  | ||||||
|  * @param[in] netdev           Pointer to the associated network device. |  | ||||||
|  * @param[in] features         SKB types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_register_l2tpv2_if(uint32_t if_num, nss_l2tpv2_callback_t l2tpv2_callback, |  | ||||||
| 					nss_l2tpv2_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_l2tpv2_if |  | ||||||
|  *	Deregisters the L2TPv2 tunnel interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_l2tpv2_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_msg_init |  | ||||||
|  *	Initializes an L2TPv2 message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_l2tpv2_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    Interface number |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_l2tpv2_msg_init(struct nss_l2tpv2_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_register_handler |  | ||||||
|  *	Registers the L2TPv2 interface with the NSS debug statistics handler. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_l2tpv2_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_session_debug_stats_get |  | ||||||
|  *	Gets L2TPv2 NSS session debug statistics. |  | ||||||
|  * |  | ||||||
|  * @param[out] stats_mem  Pointer to the memory address, which must be large |  | ||||||
|  *                        enough to hold all the statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_l2tpv2_session_debug_stats_get(void  *stats_mem); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_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_l2tpv2_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_l2tpv2_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_l2tpv2_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_L2TP_V2_H_ */ |  | ||||||
| @@ -1,211 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014, 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_lag.h |  | ||||||
|  *	NSS LAG APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_lag_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_metadata_types |  | ||||||
|  *	Types of LAG metadata. |  | ||||||
|  */ |  | ||||||
| enum nss_lag_metadata_types { |  | ||||||
| 	NSS_TX_METADATA_LAG_STATE_CHANGE = 0, |  | ||||||
| 	NSS_TX_METADATA_LAG_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_state_change_ev |  | ||||||
|  *	LAG change events. |  | ||||||
|  */ |  | ||||||
| enum nss_lag_state_change_ev { |  | ||||||
| 	NSS_LAG_RELEASE = 0, |  | ||||||
| 	NSS_LAG_ENSLAVE = 1, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_error_types |  | ||||||
|  *	LAG return values. |  | ||||||
|  */ |  | ||||||
| enum nss_lag_error_types { |  | ||||||
| 	NSS_LAG_ERROR_EINTERFACE = 1, |  | ||||||
| 	NSS_LAG_ERROR_EMSG = 2, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_state_change |  | ||||||
|  *	Link aggregation (LAG) state changes. |  | ||||||
|  */ |  | ||||||
| struct nss_lag_state_change { |  | ||||||
| 	uint32_t lagid;				/**< ID of the link aggregation group. */ |  | ||||||
| 	uint32_t interface; |  | ||||||
| 			/**< Physical interface on which the state change occurred. */ |  | ||||||
| 	enum nss_lag_state_change_ev event;	/**< Type of state change event. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_msg |  | ||||||
|  *	Data for sending and receiving LAG messages. |  | ||||||
|  */ |  | ||||||
| struct nss_lag_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a LAG message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_lag_state_change state; |  | ||||||
| 				/**< State change message. */ |  | ||||||
| 	} msg;			/**< Message payload for LAG configuration messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_tx |  | ||||||
|  *	Sends a LAG message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_lag_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_lag_tx(struct nss_ctx_instance *nss_ctx, struct nss_lag_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving LAG data. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff \n |  | ||||||
|  * napi_struct |  | ||||||
|  * |  | ||||||
|  * @param[in] dev   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_lag_callback_t)(struct net_device *dev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving a LAG message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_lag_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the application context for this message. |  | ||||||
|  * @param[in] nm   Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_lag_msg_callback_t)(void *ctx, struct nss_lag_msg *nm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving a LAG event. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_lag_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_lag_event_callback_t)(void *app_data, struct nss_lag_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_lag_if |  | ||||||
|  *	Registers the LAG interface with the NSS for sending and receiving data |  | ||||||
|  *	and messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_lag_callback_t \n |  | ||||||
|  * nss_lag_event_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num     NSS interface number. |  | ||||||
|  * @param[in] lag_cb     Callback to receive LAG data. |  | ||||||
|  * @param[in] lag_ev_cb  Callback to receive LAG events. |  | ||||||
|  * @param[in] netdev     Pointer to the associated network device. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern void *nss_register_lag_if(uint32_t if_num, |  | ||||||
| 			 nss_lag_callback_t lag_cb, |  | ||||||
| 			 nss_lag_event_callback_t lag_ev_cb, |  | ||||||
| 			 struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_lag_if |  | ||||||
|  *	Deregisters the LAG interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  LAG interface number |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The LAG interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_lag_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_msg_init |  | ||||||
|  *	Initializes a LAG message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_lag_msg \n |  | ||||||
|  * nss_lag_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nlm       Pointer to the message. |  | ||||||
|  * @param[in]     lag_num   LAG interface number. |  | ||||||
|  * @param[in]     type      Type of buffer. |  | ||||||
|  * @param[in]     len       Length of the buffer. |  | ||||||
|  * @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_lag_msg_init(struct nss_lag_msg *nlm, uint16_t lag_num, uint32_t type, uint32_t len, |  | ||||||
| 				nss_lag_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lag_tx_slave_state |  | ||||||
|  *	Sends LAG slave state. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_lag_state_change_ev |  | ||||||
|  * |  | ||||||
|  * @param[in] lagid        LAG Group ID. |  | ||||||
|  * @param[in] slave_ifnum  Slave interface number. |  | ||||||
|  * @param[in] slave_state  Slave state. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_lag_tx_slave_state(uint16_t lagid, |  | ||||||
| 		int32_t slave_ifnum, |  | ||||||
| 		enum nss_lag_state_change_ev slave_state); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
| @@ -1,88 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |  | ||||||
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |  | ||||||
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |  | ||||||
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |  | ||||||
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |  | ||||||
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |  | ||||||
|  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_lso_rx.h |  | ||||||
|  *	NSS driver LSO (Large Send Offload) Rx header file. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_LSO_RX_H |  | ||||||
| #define __NSS_LSO_RX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_lso_rx_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lso_rx_stats_types |  | ||||||
|  *	LSO Rx driver statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_lso_rx_stats_types { |  | ||||||
| 	NSS_LSO_RX_STATS_TX_DROPPED,		/**< Number of packets dropped because transmit queue is full. */ |  | ||||||
| 	NSS_LSO_RX_STATS_DROPPED,		/**< Number of packets dropped because of node internal errors. */ |  | ||||||
| 	NSS_LSO_RX_STATS_PBUF_ALLOC_FAIL,	/**< Number of pbuf allocation failures. */ |  | ||||||
| 	NSS_LSO_RX_STATS_PBUF_REFERENCE_FAIL,	/**< Number of pbuf reference failures. */ |  | ||||||
| 	NSS_LSO_RX_STATS_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lso_rx_stats_notification |  | ||||||
|  *	Data for sending LSO Rx statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_lso_rx_stats_notification { |  | ||||||
| 	uint32_t core_id;				/**< Core ID. */ |  | ||||||
| 	uint64_t cmn_node_stats[NSS_STATS_NODE_MAX];	/**< Common node statistics. */ |  | ||||||
| 	uint64_t node_stats[NSS_LSO_RX_STATS_MAX];	/**< LSO Rx special statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_lso_rx_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_lso_rx_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_lso_rx_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_lso_rx_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_LSO_RX_H */ |  | ||||||
| @@ -1,382 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_map_t.h |  | ||||||
|  *	NSS MAP-T interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_MAP_T_H_ |  | ||||||
| #define _NSS_MAP_T_H_ |  | ||||||
|  |  | ||||||
| #ifndef DOXYGEN_SHOULD_SKIP_THIS |  | ||||||
| #include "nss_dynamic_interface.h" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_map_t_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported MAP-T instances. |  | ||||||
|  */ |  | ||||||
| #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 |  | ||||||
|  *	Message types for MAP-T requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_map_t_msg_types { |  | ||||||
| 	NSS_MAP_T_MSG_INSTANCE_RULE_CONFIGURE, |  | ||||||
| 	NSS_MAP_T_MSG_INSTANCE_RULE_DECONFIGURE, |  | ||||||
| 	NSS_MAP_T_MSG_SYNC_STATS, |  | ||||||
| 	NSS_MAP_T_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_stats_instance |  | ||||||
|  *	MAP-T debug error types. |  | ||||||
|  */ |  | ||||||
| enum nss_map_t_stats_instance { |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_PBUF_EXCEPTION, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_PBUF_NO_MATCHING_RULE, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_PBUF_NOT_TCP_OR_UDP, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_RULE_ERR_LOCAL_PSID, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_RULE_ERR_LOCAL_IPV6, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_RULE_ERR_REMOTE_PSID, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_RULE_ERR_REMOTE_EA_BITS, |  | ||||||
| 	NSS_MAP_T_STATS_V4_TO_V6_RULE_ERR_REMOTE_IPV6, |  | ||||||
| 	NSS_MAP_T_STATS_V6_TO_V4_PBUF_EXCEPTION, |  | ||||||
| 	NSS_MAP_T_STATS_V6_TO_V4_PBUF_NO_MATCHING_RULE, |  | ||||||
| 	NSS_MAP_T_STATS_V6_TO_V4_PBUF_NOT_TCP_OR_UDP, |  | ||||||
| 	NSS_MAP_T_STATS_V6_TO_V4_RULE_ERR_LOCAL_IPV4, |  | ||||||
| 	NSS_MAP_T_STATS_V6_TO_V4_RULE_ERR_REMOTE_IPV4, |  | ||||||
| 	NSS_MAP_T_STATS_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_stats_notification |  | ||||||
|  *	MAP-T statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_map_t_stats_notification { |  | ||||||
| 	uint32_t core_id;				/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;				/**< Interface number. */ |  | ||||||
| 	enum nss_dynamic_interface_type if_type;	/**< Dynamic interface type. */ |  | ||||||
| 	uint64_t stats[NSS_MAP_T_STATS_MAX];		/**< MAP-T statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
| /** |  | ||||||
|  * nss_map_t_instance_rule_config_msg |  | ||||||
|  *	Message information for configuring a MAP-T instance. |  | ||||||
|  */ |  | ||||||
| struct nss_map_t_instance_rule_config_msg { |  | ||||||
| 	uint32_t rule_num;			/**< Rule sequence number */ |  | ||||||
| 	uint32_t total_rules;			/**< Total number of NAT64 rules configured. */ |  | ||||||
| 	uint32_t local_ipv6_prefix_len;		/**< Local IPv6 prefix length. */ |  | ||||||
| 	uint32_t local_ipv4_prefix;		/**< Local IPv4 prefix. */ |  | ||||||
| 	uint32_t local_ipv4_prefix_len;		/**< Local IPv4 prefix length. */ |  | ||||||
| 	uint32_t local_ea_len;			/**< Local EA bits length. */ |  | ||||||
| 	uint32_t local_psid_offset;		/**< Local PSID offset. */ |  | ||||||
|  |  | ||||||
| 	uint32_t reserve_a;			/**< Reserved for backward compatibility. */ |  | ||||||
|  |  | ||||||
| 	uint32_t remote_ipv6_prefix_len;	/**< Remote IPv6 prefix length. */ |  | ||||||
| 	uint32_t remote_ipv4_prefix;		/**< Remote IPv4 prefix. */ |  | ||||||
| 	uint32_t remote_ipv4_prefix_len;	/**< Remote IPv4 prefix length. */ |  | ||||||
| 	uint32_t remote_ea_len;			/**< Remote EA bits length. */ |  | ||||||
| 	uint32_t remote_psid_offset;		/**< Remote PSID offset. */ |  | ||||||
|  |  | ||||||
| 	uint32_t local_map_style;		/**< Local MAP style. */ |  | ||||||
| 	uint32_t remote_map_style;		/**< Remote MAP style. */ |  | ||||||
|  |  | ||||||
| 	uint32_t sibling_if;			/**< Sibling interface number. */ |  | ||||||
|  |  | ||||||
| 	uint8_t local_ipv6_prefix[16];		/**< Local IPv6 prefix. */ |  | ||||||
| 	uint8_t reserve_b[16];			/**< Reserved for backward compatibility. */ |  | ||||||
| 	uint8_t remote_ipv6_prefix[16];		/**< Remote IPv6 prefix. */ |  | ||||||
|  |  | ||||||
| 	uint8_t valid_rule;			/**< MAP-T rule validity. */ |  | ||||||
| 	uint8_t flags;				/**< MAP-T flags. */ |  | ||||||
| 	uint8_t reserved[2];			/**< Reserved for byte alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_instance_rule_deconfig_msg |  | ||||||
|  *	Message information for deleting a MAP-T instance. |  | ||||||
|  */ |  | ||||||
| struct nss_map_t_instance_rule_deconfig_msg { |  | ||||||
| 	int32_t if_number;			/**< Interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_sync_stats_msg |  | ||||||
|  *	Message information for MAP-T synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_map_t_sync_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t tx_dropped;			/**< Dropped Tx packets. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Debug statistics for MAP-T. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
|  |  | ||||||
| 		/** |  | ||||||
| 		 * IPv4 to IPv6 path debug statistics. |  | ||||||
| 		 */ |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t exception_pkts; |  | ||||||
| 					/**< Number of packets exceptioned to host in IPv4 to IPv6 fast path. */ |  | ||||||
| 			uint32_t no_matching_rule; |  | ||||||
| 					/**< No matching of any rule. */ |  | ||||||
| 			uint32_t not_tcp_or_udp; |  | ||||||
| 					/**< Number of packets which are neither UDP nor TCP. */ |  | ||||||
| 			uint32_t rule_err_local_psid; |  | ||||||
| 					/**< Calculate the local PSID error. */ |  | ||||||
| 			uint32_t rule_err_local_ipv6; |  | ||||||
| 					/**< Calculate local IPv6 error. */ |  | ||||||
| 			uint32_t rule_err_remote_psid; |  | ||||||
| 					/**< Calculate remote PSID error. */ |  | ||||||
| 			uint32_t rule_err_remote_ea_bits; |  | ||||||
| 					/**< Calculate remote EA bits error. */ |  | ||||||
| 			uint32_t rule_err_remote_ipv6; |  | ||||||
| 					/**< Calculate remote IPv6 error. */ |  | ||||||
| 		} v4_to_v6;	/**< IPv4 to IPv6 debug statistics object. */ |  | ||||||
|  |  | ||||||
| 		/** |  | ||||||
| 		 * IPv6 to IPv4 path debug statistics. |  | ||||||
| 		 */ |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t exception_pkts; |  | ||||||
| 					/**< Number of packets exception to host in IPv6 to IPv4 fast path. */ |  | ||||||
| 			uint32_t no_matching_rule; |  | ||||||
| 					/**< No matching of any rule. */ |  | ||||||
| 			uint32_t not_tcp_or_udp; |  | ||||||
| 					/**< Number of packets which are neither UDP nor TCP. */ |  | ||||||
| 			uint32_t rule_err_local_ipv4; |  | ||||||
| 					/**< Calculate local IPv4 error. */ |  | ||||||
| 			uint32_t rule_err_remote_ipv4; |  | ||||||
| 					/**< Calculate remote IPv4 error. */ |  | ||||||
| 		} v6_to_v4;	/**< IPv6 to IPv4 debug statistics object */ |  | ||||||
|  |  | ||||||
| 	} debug_stats;		/**< Payload of debug statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_msg |  | ||||||
|  *	Data for sending and receiving MAP-T messages. |  | ||||||
|  */ |  | ||||||
| struct nss_map_t_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a MAP-T message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_map_t_instance_rule_config_msg create_msg; |  | ||||||
| 				/**< Create message. */ |  | ||||||
| 		struct nss_map_t_instance_rule_deconfig_msg destroy_msg; |  | ||||||
| 				/**< Destroy message. */ |  | ||||||
| 		struct nss_map_t_sync_stats_msg stats; |  | ||||||
| 				/**< Statistics message to host. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving MAP-T messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_map_t_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_map_t_msg_callback_t)(void *app_data, struct nss_map_t_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_tx |  | ||||||
|  *	Sends a MAP-T message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_map_t_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_map_t_tx(struct nss_ctx_instance *nss_ctx, struct nss_map_t_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_tx_sync |  | ||||||
|  *	Sends a MAP-T message synchronously to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_map_t_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_map_t_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_map_t_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_get_context |  | ||||||
|  *	Gets the MAP-T context used in nss_map_t_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_map_t_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving MAP-T tunnel 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_map_t_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_register_if |  | ||||||
|  *	Registers a MAP-T interface with the NSS for sending and receiving tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_map_t_callback_t \n |  | ||||||
|  * nss_map_t_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num          NSS interface number. |  | ||||||
|  * @param[in] type            NSS interface type. |  | ||||||
|  * @param[in] map_t_callback  Callback for the MAP-T data. |  | ||||||
|  * @param[in] msg_callback    Callback for the MAP-T message. |  | ||||||
|  * @param[in] netdev          Pointer to the associated network device. |  | ||||||
|  * @param[in] features        Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_map_t_register_if(uint32_t if_num, uint32_t type, nss_map_t_callback_t map_t_callback, |  | ||||||
| 					nss_map_t_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_unregister_if |  | ||||||
|  *	Deregisters a MAP-T tunnel interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_map_t_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_msg_init |  | ||||||
|  *	Initializes a MAP-T message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_map_t_msg_init |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    Interface number |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_map_t_msg_init(struct nss_map_t_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_register_handler |  | ||||||
|  *	Registers the MAP-T debug statistics handler with the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_map_t_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_instance_debug_stats_get |  | ||||||
|  *	Gets debug statistics for a MAP-T instance. |  | ||||||
|  * |  | ||||||
|  * @param[out] stats_mem  Pointer to the memory address, which must be large enough to |  | ||||||
|                          hold all the statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_map_t_instance_debug_stats_get(void *stats_mem); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_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_map_t_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_map_t_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_map_t_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_MAP_T_H_ */ |  | ||||||
| @@ -1,296 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_match.h |  | ||||||
|  *	NSS match interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_MATCH_H_ |  | ||||||
| #define _NSS_MATCH_H_ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_match_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported match instances. |  | ||||||
|  */ |  | ||||||
| #define NSS_MATCH_INSTANCE_MAX 4 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of rules supported per instance. |  | ||||||
|  */ |  | ||||||
| #define NSS_MATCH_INSTANCE_RULE_MAX 32 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of masksets. |  | ||||||
|  */ |  | ||||||
| #define NSS_MATCH_MASK_MAX 2 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of words per maskset. |  | ||||||
|  */ |  | ||||||
| #define NSS_MATCH_MASK_WORDS_MAX 4 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_error_type |  | ||||||
|  *	Match message error types. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_match_error_type { |  | ||||||
| 	NSS_MATCH_SUCCESS,			/**< No error. */ |  | ||||||
| 	NSS_MATCH_ERROR_UNKNOWN_MSG,		/**< Message unknown. */ |  | ||||||
| 	NSS_MATCH_ERROR_DSCP_OUTOFBOUND,	/**< DSCP out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_OUTER_8021P_OUTOFBOUND,	/**< Outer 802.1p out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_INNER_8021P_OUTOFBOUND,	/**< Inner 802.1p out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_RULE_ID_OUTOFBOUND,	/**< Rule ID is out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_ACTION_TYPE_INVALID,	/**< Invalid action type. */ |  | ||||||
| 	NSS_MATCH_ERROR_RULE_EXISTS,		/**< Rule ID already in use. */ |  | ||||||
| 	NSS_MATCH_ERROR_RULE_DOES_NOT_EXIST,	/**< Rule does not exist. */ |  | ||||||
| 	NSS_MATCH_ERROR_INSTANCE_CONFIGURED,	/**< Error in instance configuration. */ |  | ||||||
| 	NSS_MATCH_ERROR_PROFILE_CONFIG_INVALID,	/**< Invalid profile configuration message. */ |  | ||||||
| 	NSS_MATCH_ERROR_DB_INIT_FAILED,		/**< Database initialization failed. */ |  | ||||||
| 	NSS_MATCH_ERROR_TABLE_ID_OUTOFBOUND,	/**< Table ID is out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_RULE_ADD,		/**< Error in adding rule. */ |  | ||||||
| 	NSS_MATCH_ERROR_RULE_DELETE,		/**< Error in deleting rule. */ |  | ||||||
| 	NSS_MATCH_ERROR_TABLE_ADD,		/**< Error in adding table. */ |  | ||||||
| 	NSS_MATCH_ERROR_TABLE_DELETE,		/**< Error in deleting table. */ |  | ||||||
| 	NSS_MATCH_ERROR_MASK_ID_OUTOFBOUND,	/**< Mask ID is out of bound. */ |  | ||||||
| 	NSS_MATCH_ERROR_IFNUM_INVALID,		/**< Next node interface number is invalid. */ |  | ||||||
| 	NSS_MATCH_ERROR_MAX,			/**< Maximum error. */ |  | ||||||
| } nss_match_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_action_type |  | ||||||
|  * 	Bit positions for possible actions that can be taken. |  | ||||||
|  */ |  | ||||||
| enum nss_match_action_type { |  | ||||||
| 	NSS_MATCH_ACTION_NONE,		/**< No action. */ |  | ||||||
| 	NSS_MATCH_ACTION_SETPRIO = 1,	/**< Set given priority to the packet. */ |  | ||||||
| 	NSS_MATCH_ACTION_FORWARD = 2,	/**< Forward the packet to a given node. */ |  | ||||||
| 	NSS_MATCH_ACTION_DROP = 4,	/**< Drop the packet. */ |  | ||||||
| 	NSS_MATCH_ACTION_MAX,		/**< Maximum action type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_profile_type |  | ||||||
|  *	Different profile types. |  | ||||||
|  */ |  | ||||||
| enum nss_match_profile_type { |  | ||||||
| 	NSS_MATCH_PROFILE_TYPE_NONE, |  | ||||||
| 	NSS_MATCH_PROFILE_TYPE_VOW,		/**< Matches on interface number/DSCP/802.1P. */ |  | ||||||
| 	NSS_MATCH_PROFILE_TYPE_L2,		/**< Matches on interface number/destination MAC/source MAC/Ether type. */ |  | ||||||
| 	NSS_MATCH_PROFILE_TYPE_MAX,		/**< Maximum profile type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_msg_types. |  | ||||||
|  *	Message types for match requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_match_msg_types { |  | ||||||
| 	NSS_MATCH_INSTANCE_NONE,	/**< Invalid message. */ |  | ||||||
| 	NSS_MATCH_TABLE_CONFIGURE_MSG,	/**< Instance configure. */ |  | ||||||
| 	NSS_MATCH_ADD_VOW_RULE_MSG,	/**< Insert VoW rule. */ |  | ||||||
| 	NSS_MATCH_ADD_L2_RULE_MSG,	/**< Insert l2 rule. */ |  | ||||||
| 	NSS_MATCH_DELETE_VOW_RULE_MSG,	/**< Delete VoW rule. */ |  | ||||||
| 	NSS_MATCH_DELETE_L2_RULE_MSG,	/**< Delete l2 rule. */ |  | ||||||
| 	NSS_MATCH_STATS_SYNC,		/**< Instance statistics. */ |  | ||||||
| 	NSS_MATCH_MSG_MAX,		/**< Maximum instance messages. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_stats_sync |  | ||||||
|  *	Synchronization message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_match_stats_sync { |  | ||||||
| 	struct nss_cmn_node_stats p_stats;			/**< Pnode statistics. */ |  | ||||||
| 	uint32_t hit_count[NSS_MATCH_INSTANCE_RULE_MAX];	/**< Exception events. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_profile_configure_msg |  | ||||||
|  *	Message for configuring the profile for a match instance. |  | ||||||
|  */ |  | ||||||
| struct nss_match_profile_configure_msg { |  | ||||||
| 	uint32_t profile_type;				/**< Profile type. */ |  | ||||||
| 	uint32_t valid_mask_flag;			/**< Valid maskset flag. */ |  | ||||||
| 	uint32_t maskset[NSS_MATCH_MASK_MAX][NSS_MATCH_MASK_WORDS_MAX];	/**< Maskset. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_match_rule_action |  | ||||||
|  *	Message information for action. |  | ||||||
|  */ |  | ||||||
| struct nss_match_rule_action { |  | ||||||
| 	uint32_t action_flag;		/**< Action bit map. */ |  | ||||||
| 	uint32_t forward_ifnum;	/**< Next node interface number. */ |  | ||||||
| 	uint16_t setprio;	/**< Priority number to be set in packet. */ |  | ||||||
| 	uint16_t reserved;	/**< Reserved 2 bytes. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_rule_vow_msg |  | ||||||
|  *	Rule message for VoW profile. |  | ||||||
|  */ |  | ||||||
| struct nss_match_rule_vow_msg { |  | ||||||
| 	uint16_t rule_id;	/**< Rule ID for the rule. */ |  | ||||||
| 	uint16_t mask_id;       /**< Mask number used for the rule. */ |  | ||||||
| 	struct nss_match_rule_action action;	/**< Action related with the rule. */ |  | ||||||
| 	uint32_t if_num;	/**< Interface number. */ |  | ||||||
| 	uint8_t dscp;		/**< DSCP. */ |  | ||||||
| 	uint8_t outer_8021p;	/**< Outer 802.1p. */ |  | ||||||
| 	uint8_t inner_8021p;	/**< Inner 802.1p. */ |  | ||||||
| 	uint8_t reserved;	/**< Reserved byte. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_rule_l2_msg |  | ||||||
|  *	Rule message for L2 profile. |  | ||||||
|  */ |  | ||||||
| struct nss_match_rule_l2_msg { |  | ||||||
| 	uint16_t rule_id;	/**< Rule ID for the rule. */ |  | ||||||
| 	uint16_t mask_id;       /**< Mask number used for the rule. */ |  | ||||||
| 	struct nss_match_rule_action action;	/**< Action related with the rule. */ |  | ||||||
| 	uint32_t if_num;	/**< Interface number. */ |  | ||||||
| 	uint16_t dmac[3];	/**< Destination MAC address. */ |  | ||||||
| 	uint16_t smac[3];	/**< Source MAC address. */ |  | ||||||
| 	uint16_t ethertype;	/**< Ethernet type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_msg |  | ||||||
|  *	Data for sending and receiving match messages. |  | ||||||
|  */ |  | ||||||
| struct nss_match_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a match message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_match_profile_configure_msg configure_msg;	/**< Configure message. */ |  | ||||||
| 		struct nss_match_rule_vow_msg vow_rule;		/**< Insertion or deletion message for VoW profile. */ |  | ||||||
| 		struct nss_match_rule_l2_msg l2_rule;		/**< Insertion or deletion message for l2 profile. */ |  | ||||||
| 		struct nss_match_stats_sync stats;		/**< Instance synchronization statistics. */ |  | ||||||
| 	} msg;	/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_msg_tx_sync |  | ||||||
|  *	Sends proxy match messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_match_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_match_msg_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_match_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving match messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_match_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_match_msg_sync_callback_t)(void *app_data, struct nss_match_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_get_context |  | ||||||
|  * 	Returns NSS context of match. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_match_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_register_instance |  | ||||||
|  * 	Registers match dynamic node to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_match_msg_sync_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num     Interface number of match instance. |  | ||||||
|  * @param[in] notify_cb  Notify callback function for the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_match_register_instance(int if_num, nss_match_msg_sync_callback_t notify_cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_unregister_instance |  | ||||||
|  * 	Unregisters match dynamic node to NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Interface number of match instance. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_match_unregister_instance(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_msg_init |  | ||||||
|  * 	Initializes a match message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_match_msg \n |  | ||||||
|  * nss_match_msg_sync_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nmm       Pointer to the 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_match_msg_init(struct nss_match_msg *nmm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 		nss_match_msg_sync_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_match_init |  | ||||||
|  * 	Initializes match. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_match_init(void); |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_MATCH_H_ */ |  | ||||||
| @@ -1,317 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_mirror.h |  | ||||||
|  *	NSS mirror interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_MIRROR_H_ |  | ||||||
| #define _NSS_MIRROR_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_mirror_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported mirror interfaces. |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_MIRROR_DYNAMIC_INTERFACES 8 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_msg_types |  | ||||||
|  *	Message types for mirror interface requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_mirror_msg_types { |  | ||||||
| 	NSS_MIRROR_MSG_CONFIGURE,		/**< Configure message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_ENABLE,			/**< Enable message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_DISABLE,			/**< Disable message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_SET_NEXTHOP,		/**< Set nexthop message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_RESET_NEXTHOP,		/**< Reset nexthop message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_SYNC_STATS,		/**< Statistics synchronization message type. */ |  | ||||||
| 	NSS_MIRROR_MSG_MAX			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_pkt_clone_point |  | ||||||
|  *	Clone point to use for mirroring the packet. |  | ||||||
|  */ |  | ||||||
| enum nss_mirror_pkt_clone_point { |  | ||||||
| 	NSS_MIRROR_PKT_CLONE_POINT_DEFAULT = 1,			/**< Clone the packet from the start. */ |  | ||||||
| 	NSS_MIRROR_PKT_CLONE_POINT_BEFORE_PACKET_START,		/**< Clone n-bytes before packet start. */ |  | ||||||
| 	NSS_MIRROR_PKT_CLONE_POINT_AFTER_PACKET_START,		/**< Clone n-bytes after packet start. */ |  | ||||||
| 	NSS_MIRROR_PKT_CLONE_POINT_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_error_type |  | ||||||
|  *	Error types for mirror responses to messages from the host. |  | ||||||
|  */ |  | ||||||
| enum nss_mirror_error_type { |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_NONE,			/**< No error. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_NO_MEMORY,		/**< No memory to copy. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_TX_FAILURE,		/**< Transmit failure. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_BAD_PARAM,		/**< Bad parameter. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_BAD_CLONE_POINT,		/**< Bad packet clone point. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_INSTANCE_CONFIGURED,	/**< Instance already active. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_INSTANCE_DISABLED,	/**< Instance already disabled. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_BAD_NEXTHOP,		/**< Incorrect nexthop interface. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_NEXTHOP_CONFIGURED,	/**< Nexthop already interface. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_NEXTHOP_RESET,		/**< Nexthop already reset. */ |  | ||||||
| 	NSS_MIRROR_ERROR_TYPE_UNKNOWN_MSG,		/**< Unknown message. */ |  | ||||||
| 	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 |  | ||||||
|  *	Mirror interface configuration information. |  | ||||||
|  */ |  | ||||||
| struct nss_mirror_configure_msg { |  | ||||||
| 	uint32_t pkt_clone_point;	/**< Point in the packet to copy from. */ |  | ||||||
| 	uint16_t pkt_clone_size;	/**< Number of bytes to copy. */ |  | ||||||
| 	uint16_t pkt_clone_offset;	/**< Copy offset. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_set_nexthop_msg |  | ||||||
|  *	Mirror interface set nexthop information. |  | ||||||
|  */ |  | ||||||
| struct nss_mirror_set_nexthop_msg { |  | ||||||
| 	uint32_t if_num;		/**< Nexthop interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_node_stats |  | ||||||
|  *	Mirror interface debug statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_mirror_node_stats { |  | ||||||
| 	uint32_t mirror_pkts;		/**< Number of packets exceptioned to host. */ |  | ||||||
| 	uint32_t mirror_bytes;		/**< Number of bytes exceptioned to host. */ |  | ||||||
| 	uint32_t tx_send_fail;		/**< Transmit send failures. */ |  | ||||||
| 	uint32_t dest_lookup_fail;	/**< Destination lookup failures. */ |  | ||||||
| 	uint32_t mem_alloc_fail;	/**< Memory allocation failures. */ |  | ||||||
| 	uint32_t copy_fail;		/**< Copy failures. */ |  | ||||||
| 	uint32_t bad_param;		/**< Bad parameter. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_stats_sync_msg |  | ||||||
|  *	Message information for mirror interface synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_mirror_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	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 |  | ||||||
|  *	Data for sending and receiving mirror interface messages. |  | ||||||
|  */ |  | ||||||
| struct nss_mirror_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a mirror interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_mirror_configure_msg config; |  | ||||||
| 				/**< Mirror interface configure message. */ |  | ||||||
| 		struct nss_mirror_set_nexthop_msg nexthop; |  | ||||||
| 				/**< Mirror interface set nexthop message. */ |  | ||||||
| 		struct nss_mirror_stats_sync_msg stats; |  | ||||||
| 				/**< Statistics message to host. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving mirror instance 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_mirror_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving mirror interface 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_mirror_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_get_context |  | ||||||
|  *	Gets the mirror interface context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_mirror_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_tx_msg |  | ||||||
|  *	Sends mirror interface messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_mirror_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_mirror_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_mirror_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_tx_msg_sync |  | ||||||
|  *	Sends a mirror interface message to the NSS synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_mirror_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| 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 |  | ||||||
|  *	Registers a mirror interface with the NSS for sending and receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_mirror_data_callback_t \n |  | ||||||
|  * nss_mirror_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num          NSS interface number. |  | ||||||
|  * @param[in] data_callback   Callback for the mirror interface data. |  | ||||||
|  * @param[in] event_callback    Callback for the mirror interface message. |  | ||||||
|  * @param[in] netdev          Pointer to the associated network device. |  | ||||||
|  * @param[in] features        Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_mirror_register_if(uint32_t if_num, |  | ||||||
| 		nss_mirror_data_callback_t data_callback, |  | ||||||
| 		nss_mirror_msg_callback_t event_callback, |  | ||||||
| 		struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_verify_if_num |  | ||||||
|  *	Verify whether the interface is an mirror interface or not. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if the interface is an mirror interface. |  | ||||||
|  */ |  | ||||||
| extern bool nss_mirror_verify_if_num(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mirror_register_handler |  | ||||||
|  *	Registers the mirror interface debug statistics handler with the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
| #endif |  | ||||||
| @@ -1,572 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_n2h.h |  | ||||||
|  *	NSS to HLOS interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_N2H_H |  | ||||||
| #define __NSS_N2H_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_n2h_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define MAX_PAGES_PER_MSG 32	/**< Maximum number of pages per message. */ |  | ||||||
| #define NSS_N2H_RPS_PRI_DEFAULT -1	/**< Default RPS priority mapping. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_payload_info |  | ||||||
|  *	Payload configuration based on the watermark. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_payload_info { |  | ||||||
| 	uint32_t pool_size;		/**< Empty buffer pool size. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Low watermark. |  | ||||||
| 	 * Set this field to 0 for the system to automatically determine the watermark. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t low_water; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * High watermark. |  | ||||||
| 	 * Set this field to 0 for the system to automatically determine the watermark. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t high_water; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_cfg_pvt |  | ||||||
|  *	N2H private data configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_cfg_pvt { |  | ||||||
| 	struct semaphore sem;					/**< Semaphore for SMP synchronization. */ |  | ||||||
| 	struct completion complete;				/**< Waits for the NSS to process the message. */ |  | ||||||
| 	struct nss_n2h_payload_info empty_buf_pool_info;	/**< Empty buffer pool information. */ |  | ||||||
| 	struct nss_n2h_payload_info empty_paged_buf_pool_info;	/**< Paged buffer pool information. */ |  | ||||||
| 	int wifi_pool;						/**< Size of the empty Wi-Fi buffer pool. */ |  | ||||||
| 	int response;						/**< Response from the firmware. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_stats_types |  | ||||||
|  *	N2H node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_n2h_stats_types { |  | ||||||
| 	NSS_N2H_STATS_QUEUE_DROPPED = NSS_STATS_NODE_MAX, |  | ||||||
| 		/**< Number of packets dropped because the exception queue is too full. */ |  | ||||||
| 	NSS_N2H_STATS_TOTAL_TICKS,	/**< Total clock ticks spend inside the N2H. */ |  | ||||||
| 	NSS_N2H_STATS_WORST_CASE_TICKS,	/**< Worst case iteration of the exception path in ticks. */ |  | ||||||
| 	NSS_N2H_STATS_ITERATIONS,	/**< Number of iterations around the N2H. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_OCM_TOTAL_COUNT,	/**< Number of pbuf OCM total count. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_OCM_FREE_COUNT,	/**< Number of pbuf OCM free count. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_OCM_ALLOC_FAILS_WITH_PAYLOAD, |  | ||||||
| 					/**< Number of pbuf OCM allocations that have failed with payload. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_OCM_ALLOC_FAILS_NO_PAYLOAD, |  | ||||||
| 					/**< Number of pbuf OCM allocations that have failed without payload. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_DEFAULT_TOTAL_COUNT,	/**< Number of pbuf default total count. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_DEFAULT_FREE_COUNT,	/**< Number of pbuf default free count. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_DEFAULT_ALLOC_FAILS_WITH_PAYLOAD, |  | ||||||
| 					/**< Number of pbuf default allocations that have failed with payload. */ |  | ||||||
| 	NSS_N2H_STATS_PBUF_DEFAULT_ALLOC_FAILS_NO_PAYLOAD, |  | ||||||
| 	/**< Number of pbuf default allocations that have failed without payload. */ |  | ||||||
|  |  | ||||||
| 	NSS_N2H_STATS_PAYLOAD_ALLOC_FAILS,	/**< Number of pbuf allocations that have failed because there were no free payloads. */ |  | ||||||
| 	NSS_N2H_STATS_PAYLOAD_FREE_COUNT,	/**< Number of free payloads that exist. */ |  | ||||||
|  |  | ||||||
| 	NSS_N2H_STATS_H2N_CONTROL_PACKETS,	/**< Control packets received from HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_H2N_CONTROL_BYTES,	/**< Control bytes received from HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_CONTROL_PACKETS,	/**< Control packets sent to HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_CONTROL_BYTES,	/**< Control bytes sent to HLOS. */ |  | ||||||
|  |  | ||||||
| 	NSS_N2H_STATS_H2N_DATA_PACKETS,		/**< Data packets received from HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_H2N_DATA_BYTES,		/**< Data bytes received from HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_DATA_PACKETS,		/**< Data packets sent to HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_DATA_BYTES,		/**< Data bytes sent to HLOS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_TOT_PAYLOADS,		/**< Number of payloads in NSS. */ |  | ||||||
| 	NSS_N2H_STATS_N2H_INTERFACE_INVALID,	/**< Number of bad interface access. */ |  | ||||||
| 	NSS_N2H_STATS_ENQUEUE_RETRIES,		/**< Number of enqueue retries by N2H. */ |  | ||||||
|  |  | ||||||
| 	NSS_N2H_STATS_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_metadata_types |  | ||||||
|  *	Message types for N2H requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_n2h_metadata_types { |  | ||||||
| 	NSS_RX_METADATA_TYPE_N2H_STATS_SYNC = 0, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_RPS_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_EMPTY_POOL_BUF_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_FLUSH_PAYLOADS, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_MITIGATION_CFG, |  | ||||||
| 	NSS_METADATA_TYPE_N2H_ADD_BUF_POOL, |  | ||||||
| 	NSS_TX_METADATA_TYPE_SET_WATER_MARK, |  | ||||||
| 	NSS_TX_METADATA_TYPE_GET_WATER_MARK, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_WIFI_POOL_BUF_CFG, |  | ||||||
| 	NSS_TX_DDR_INFO_VIA_N2H_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_SET_PNODE_QUEUE_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_EMPTY_PAGED_POOL_BUF_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_SET_PAGED_WATER_MARK, |  | ||||||
| 	NSS_TX_METADATA_TYPE_GET_PAGED_WATER_MARK, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_RPS_PRI_MAP_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_QUEUE_LIMIT_CFG, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_PAGED_BUFFER_POOL_INIT, |  | ||||||
| 	NSS_TX_METADATA_TYPE_N2H_HOST_BACK_PRESSURE_CFG, |  | ||||||
| 	NSS_METADATA_TYPE_N2H_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_n2h_error_types |  | ||||||
|  *	N2H error types. |  | ||||||
|  */ |  | ||||||
| enum nss_n2h_error_types { |  | ||||||
| 	N2H_EUNKNOWN = 1, |  | ||||||
| 	N2H_ALREADY_CFG, |  | ||||||
| 	N2H_LOW_WATER_MIN_INVALID, |  | ||||||
| 	N2H_HIGH_WATER_LESS_THAN_LOW, |  | ||||||
| 	N2H_HIGH_WATER_LIMIT_INVALID, |  | ||||||
| 	N2H_LOW_WATER_LIMIT_INVALID, |  | ||||||
| 	N2H_WATER_MARK_INVALID, |  | ||||||
| 	N2H_EMPTY_BUFFER_TOO_HIGH, |  | ||||||
| 	N2H_EMPTY_BUFFER_TOO_LOW, |  | ||||||
| 	N2H_MMU_ENTRY_IS_INVALID, |  | ||||||
| 	N2H_PN_QUEUE_SET_FAILED, |  | ||||||
| 	N2H_PAGES_PER_MSG_EXCEEDED, |  | ||||||
| 	N2H_RPS_PRI_MAP_TOO_HIGH, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_stats_notification |  | ||||||
|  *	N2H statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_stats_notification { |  | ||||||
| 	uint32_t core_id;			/**< Core ID. */ |  | ||||||
| 	uint64_t n2h_stats[NSS_N2H_STATS_MAX];	/**< N2H statistics. */ |  | ||||||
| 	uint64_t drv_stats[NSS_STATS_DRV_MAX];	/**< Driver statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_rps |  | ||||||
|  *	N2H RPS configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_rps { |  | ||||||
| 	uint32_t enable;	/**< Enable RPS. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_rps_pri_map |  | ||||||
|  *	N2H priority configuration. |  | ||||||
|  * |  | ||||||
|  * This is used to direct packets with a given priority to a specific host CPU. |  | ||||||
|  * A value of -1 in pri_map[pri] is treated as invalid and will not override |  | ||||||
|  * RPS for that priority. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_rps_pri_map { |  | ||||||
| 	int32_t pri_map[NSS_MAX_NUM_PRI];	/**< Priority to RPS map. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_mitigation |  | ||||||
|  *	N2H mitigation configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_mitigation { |  | ||||||
| 	uint32_t enable;	/**< Enable NSS mitigation. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_buf_pool |  | ||||||
|  *	N2H buffer pool configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_buf_pool { |  | ||||||
| 	uint32_t nss_buf_page_size;	/**< Size of the buffer page. */ |  | ||||||
| 	uint32_t nss_buf_num_pages;	/**< Number of buffer pages. */ |  | ||||||
|  |  | ||||||
| 	uint32_t nss_buf_pool_addr[MAX_PAGES_PER_MSG]; |  | ||||||
| 			/**< Buffer addresses. */ |  | ||||||
| 	nss_ptr_t nss_buf_pool_vaddr[MAX_PAGES_PER_MSG]; |  | ||||||
| 			/**< Virtual addresses of the buffers. */ |  | ||||||
| #ifndef __LP64__ |  | ||||||
| 	uint32_t padding[MAX_PAGES_PER_MSG]; |  | ||||||
| 			/**< Pad to fit 64 bits, do not reuse. */ |  | ||||||
| #endif |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_pnode_queue_config |  | ||||||
|  *	Queue configuration command for pnodes in NSS. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_pnode_queue_config { |  | ||||||
| 	uint8_t mq_en;		/**< Enable multiple queues. */ |  | ||||||
| 	uint8_t reserved[3];	/**< Reserved for alignment. */ |  | ||||||
| 	uint16_t qlimits[NSS_MAX_NUM_PRI]; |  | ||||||
| 				/**< Limits of each queue. */ |  | ||||||
| #if (NSS_MAX_NUM_PRI & 1) |  | ||||||
| 	uint16_t reserved2; |  | ||||||
| #endif |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_empty_pool_buf |  | ||||||
|  *	Old way of setting the number of empty pool buffers (payloads). |  | ||||||
|  * |  | ||||||
|  * The NSS firmware sets the low watermark to n -- ring_size, and the high |  | ||||||
|  * watermark to n + ring_size. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_empty_pool_buf { |  | ||||||
| 	uint32_t pool_size;		/**< Size of the empty buffer pool. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_water_mark |  | ||||||
|  *	New way of setting the low and high watermarks in the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_water_mark { |  | ||||||
| 	/** |  | ||||||
| 	 * Low watermark. |  | ||||||
| 	 * Lower threshold for the number of payloads that can be held by NSS firmware. |  | ||||||
| 	 * Setting this value to 0 gets the system to automatically determine the watermark. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t low_water; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * High watermark. |  | ||||||
| 	 * Upper threshold for the number of paylods that be held by the NSS firmware. |  | ||||||
| 	 * Setting this value to 0 gets the system to automatically determine the watermark. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t high_water; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_flush_payloads |  | ||||||
|  *	Flush payload configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_flush_payloads { |  | ||||||
| 	uint32_t reserved;		/**< Reserved for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_wifi_payloads |  | ||||||
|  *	Payloads required for Wi-Fi offloading. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_wifi_payloads { |  | ||||||
| 	uint32_t payloads;	/**< Number of payloads for Wi-Fi use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_pbuf_mgr_stats |  | ||||||
|  *	Payload buffer manager statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_pbuf_mgr_stats { |  | ||||||
| 	uint32_t pbuf_total_count;	/**< Total number of buffers, free or in use. */ |  | ||||||
| 	uint32_t pbuf_free_count;	/**< Number of currently free buffers. */ |  | ||||||
| 	uint32_t pbuf_alloc_fails_with_payload; |  | ||||||
| 					/**< Number of buffer allocation failures. */ |  | ||||||
| 	uint32_t pbuf_alloc_fails_no_payload; |  | ||||||
| 					/**< Number of buffer allocation failures without payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_paged_buffer_pool_init |  | ||||||
|  *	Paged buffer configuration initialization. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_paged_buffer_pool_init { |  | ||||||
| 	uint32_t reserved;		/**< Reserved for future use. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_stats_sync |  | ||||||
|  *	N2H synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_stats_sync { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t queue_dropped; |  | ||||||
| 			/**< Number of packets dropped because the N2H queue is too full. */ |  | ||||||
| 	uint32_t total_ticks;		/**< Total clock ticks spent inside the N2H handler. */ |  | ||||||
| 	uint32_t worst_case_ticks;	/**< Worst case iteration of the N2H handler in ticks. */ |  | ||||||
| 	uint32_t iterations;		/**< Number of iterations around the N2H handler. */ |  | ||||||
|  |  | ||||||
| 	struct nss_n2h_pbuf_mgr_stats pbuf_ocm_stats; |  | ||||||
| 			/**< Statistics for on-chip memory payload buffers. */ |  | ||||||
| 	struct nss_n2h_pbuf_mgr_stats pbuf_default_stats; |  | ||||||
| 			/**< Statistics for DDR memory payload buffers. */ |  | ||||||
|  |  | ||||||
| 	uint32_t payload_alloc_fails;	/**< Number of payload allocation failures. */ |  | ||||||
| 	uint32_t payload_free_count;	/**< Number of free payloads. */ |  | ||||||
|  |  | ||||||
| 	uint32_t h2n_ctrl_pkts;		/**< Control packets received from the HLOS. */ |  | ||||||
| 	uint32_t h2n_ctrl_bytes;	/**< Control bytes received from the HLOS. */ |  | ||||||
| 	uint32_t n2h_ctrl_pkts;		/**< Control packets sent to the HLOS. */ |  | ||||||
| 	uint32_t n2h_ctrl_bytes;	/**< Control bytes sent to the HLOS. */ |  | ||||||
|  |  | ||||||
| 	uint32_t h2n_data_pkts;		/**< Data packets received from the HLOS. */ |  | ||||||
| 	uint32_t h2n_data_bytes;	/**< Data bytes received from the HLOS. */ |  | ||||||
| 	uint32_t n2h_data_pkts;		/**< Data packets sent to the HLOS. */ |  | ||||||
| 	uint32_t n2h_data_bytes;	/**< Data bytes sent to the HLOS. */ |  | ||||||
| 	uint32_t tot_payloads;		/**< Total number of payloads in the NSS firmware. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Number of data packets with invalid interface received from the host. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t data_interface_invalid; |  | ||||||
| 	uint32_t enqueue_retries;	/**< Number of times N2H retried enqueue to next node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_mmu_ddr_info |  | ||||||
|  *	System DDR memory information required by the firmware MMU to set range guards. |  | ||||||
|  */ |  | ||||||
| struct nss_mmu_ddr_info { |  | ||||||
| 	uint32_t ddr_size;	/**< Total size of the DDR. */ |  | ||||||
| 	uint32_t start_address;	/**< System start address. */ |  | ||||||
| 	uint32_t num_active_cores; |  | ||||||
| 				/**< Number of active cores. */ |  | ||||||
| 	uint32_t nss_ddr_size;	/**< Total memory for NSS SoC. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_queue_limit_config |  | ||||||
|  *	Queue length limit for N2H node. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_queue_limit_config { |  | ||||||
| 	uint32_t qlimit;	/**< Queue length size. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_host_back_pressure |  | ||||||
|  *	Host back pressure configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_host_back_pressure { |  | ||||||
| 	uint32_t enable;		/**< Enable host back pressure. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_msg |  | ||||||
|  *	Data for sending and receiving N2H messages. |  | ||||||
|  */ |  | ||||||
| struct nss_n2h_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an N2H message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_n2h_stats_sync stats_sync; |  | ||||||
| 				/**< N2H statistics synchronization. */ |  | ||||||
| 		struct nss_n2h_rps rps_cfg; |  | ||||||
| 				/**< RPS configuration. */ |  | ||||||
| 		struct nss_n2h_rps_pri_map rps_pri_map; |  | ||||||
| 				/**< RPS priority map. */ |  | ||||||
| 		struct nss_n2h_empty_pool_buf empty_pool_buf_cfg; |  | ||||||
| 				/**< Empty pool buffer configuration. */ |  | ||||||
| 		struct nss_n2h_empty_pool_buf empty_paged_pool_buf_cfg; |  | ||||||
| 				/**< Empty paged pool buffer configuration. */ |  | ||||||
| 		struct nss_n2h_flush_payloads flush_payloads; |  | ||||||
| 				/**< Flush payloads present in the NSS. */ |  | ||||||
| 		struct nss_n2h_mitigation mitigation_cfg; |  | ||||||
| 				/**< Mitigation configuration. */ |  | ||||||
| 		struct nss_n2h_buf_pool buf_pool; |  | ||||||
| 				/**< Pool buffer coniguration. */ |  | ||||||
| 		struct nss_n2h_water_mark wm; |  | ||||||
| 				/**< Sets low and high watermarks. */ |  | ||||||
| 		struct nss_n2h_water_mark wm_paged; |  | ||||||
| 				/**< Sets low and high watermarks for paged pool. */ |  | ||||||
| 		struct nss_n2h_payload_info payload_info; |  | ||||||
| 				/**< Gets the payload information. */ |  | ||||||
| 		struct nss_n2h_payload_info paged_payload_info; |  | ||||||
| 				/**< Gets the paged payload information. */ |  | ||||||
| 		struct nss_n2h_wifi_payloads wp; |  | ||||||
| 				/**< Sets the number of Wi-Fi payloads. */ |  | ||||||
| 		struct nss_mmu_ddr_info mmu; |  | ||||||
| 				/**< Gets the DDR size and start address to configure the MMU. */ |  | ||||||
| 		struct nss_n2h_pnode_queue_config pn_q_cfg; |  | ||||||
| 				/**< Pnode queueing configuration. */ |  | ||||||
| 		struct nss_n2h_queue_limit_config ql_cfg; |  | ||||||
| 				/**< Queue limit configuration. */ |  | ||||||
| 		struct nss_n2h_paged_buffer_pool_init paged_buffer_pool_init; |  | ||||||
| 				/**< Paged buffer pool initialization. */ |  | ||||||
| 		struct nss_n2h_host_back_pressure host_bp_cfg; |  | ||||||
| 				/**< Host back pressure configuration. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving N2H messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_n2h_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the N2H message. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_n2h_msg_callback_t)(void *app_data, struct nss_n2h_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_tx_msg |  | ||||||
|  *	Sends messages to the N2H package. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_n2h_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] nnm      Pointer to the N2H message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_n2h_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_n2h_msg *nnm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_single_core_register_sysctl |  | ||||||
|  *	Registers the N2H sysctl entry to the sysctl tree for a single-core system. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_n2h_single_core_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_multi_core_register_sysctl |  | ||||||
|  *	Registers the N2H sysctl entry to the sysctl tree for a multi-core system. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_n2h_multi_core_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_unregister_sysctl |  | ||||||
|  *	Deregisters the N2H sysctl entry from the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_n2h_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_flush_payloads |  | ||||||
|  *	Sends flush payloads message to NSS |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_n2h_flush_payloads(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_msg_init |  | ||||||
|  *	Initializes messages from the host to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_n2h_msg \n |  | ||||||
|  * nss_n2h_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nim       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_n2h_msg_init(struct nss_n2h_msg *nim, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 			nss_n2h_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_update_queue_config_sync |  | ||||||
|  *	Synchrounous method to update pnode queue configuration to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] mq_en    Enable multiple pnode queues. |  | ||||||
|  * @param[in] qlimits  Maximum number of packets in each queues. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the configuration update operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_n2h_update_queue_config_sync(struct nss_ctx_instance *nss_ctx, bool mq_en, uint16_t *qlimits); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_update_queue_config_async |  | ||||||
|  *	Asynchrounous method to update pnode queue configuration to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] mq_en    Enable multiple pnode queues. |  | ||||||
|  * @param[in] qlimits  Maximum number of packets in each queues. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the configuration update operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_n2h_update_queue_config_async(struct nss_ctx_instance *nss_ctx, bool mq_en, uint16_t *qlimits); |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_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_n2h_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_n2h_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_n2h_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_N2H_H */ |  | ||||||
| @@ -1,145 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-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_oam.h |  | ||||||
|  *	NSS OAM - Operations, Administration and Maintenance Service |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_OAM_H |  | ||||||
| #define __NSS_OAM_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_oam_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_OAM_FW_VERSION_LEN	132	/**< Size of the OAM firmware version. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_msg_types |  | ||||||
|  *	OAM command types. |  | ||||||
|  * |  | ||||||
|  * The OAM proxy sends these command messages to the NSS OAM server via the OAM adapter. |  | ||||||
|  */ |  | ||||||
| enum nss_oam_msg_types { |  | ||||||
| 	NSS_OAM_MSG_TYPE_NONE, |  | ||||||
| 	NSS_OAM_MSG_TYPE_GET_FW_VER, |  | ||||||
| 	NSS_OAM_MSG_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_error |  | ||||||
|  *	OAM error responses. |  | ||||||
|  */ |  | ||||||
| enum nss_oam_error { |  | ||||||
| 	NSS_OAM_ERROR_NONE, |  | ||||||
| 	NSS_OAM_ERROR_INVAL_MSG_TYPE, |  | ||||||
| 	NSS_OAM_ERROR_INVAL_MSG_LEN, |  | ||||||
| 	NSS_OAM_ERROR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_fw_ver |  | ||||||
|  *	OAM firmware version. |  | ||||||
|  */ |  | ||||||
| struct nss_oam_fw_ver { |  | ||||||
| 	uint8_t string[NSS_OAM_FW_VERSION_LEN];	/**< OAM firmware version. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_msg |  | ||||||
|  *	Data for sending and receiving OAM messages. |  | ||||||
|  */ |  | ||||||
| struct nss_oam_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an OAM message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_oam_fw_ver fw_ver; |  | ||||||
| 				/**< Firmware version. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving OAM messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_oam_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_oam_msg_callback_t)(void *app_data, struct nss_oam_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_tx_msg |  | ||||||
|  *	Transmits an OAM message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_oam_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_oam_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_oam_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_notify_register |  | ||||||
|  *	Registers a notifier callback with the NSS for sending and receiving OAM messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_oam_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_oam_notify_register(nss_oam_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_oam_notify_unregister |  | ||||||
|  *	Deregisters an OAM message notifier callback from the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_oam_notify_unregister(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_oam_if |  | ||||||
|  *	Registers the OAM interface handler with the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_number  Interface number of the OAM interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Boolean status of handler registration |  | ||||||
|  */ |  | ||||||
| extern bool nss_register_oam_if(uint16_t if_number); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_OAM_H */ |  | ||||||
| @@ -1,67 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_phy_if.h.h |  | ||||||
|  *	NSS physical interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PHY_IF_H |  | ||||||
| #define __NSS_PHY_IF_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_driver_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_phys_if_reset_nexthop |  | ||||||
|  *	De-configure nexthop for an interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   Network physical interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_phys_if_reset_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_phys_if_set_nexthop |  | ||||||
|  *	Configure nexthop for an interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   Network physical interface number. |  | ||||||
|  * @param[in] nexthop   Network physical or virtual interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /*  __NSS_PHY_IF_H */ |  | ||||||
| @@ -1,114 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2013-2019, 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_pm.h |  | ||||||
|  *	NSS power management definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PM_H |  | ||||||
| #define __NSS_PM_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_pm_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_client |  | ||||||
|  *	Power management (PM) clients. |  | ||||||
|  * |  | ||||||
|  * These clients can query for bus or clock performance levels. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_pm_client { |  | ||||||
| 	NSS_PM_CLIENT_GMAC, |  | ||||||
| 	NSS_PM_CLIENT_CRYPTO, |  | ||||||
| 	NSS_PM_CLIENT_NETAP, |  | ||||||
| 	NSS_PM_MAX_CLIENTS, |  | ||||||
| } nss_pm_client_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_perf_level |  | ||||||
|  *	Performance levels. |  | ||||||
|  * |  | ||||||
|  * This enumeration is passed as a parameter to NSS PM performance-level |  | ||||||
|  * requests. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_pm_perf_level { |  | ||||||
| 	NSS_PM_PERF_LEVEL_SUSPEND = 0, |  | ||||||
| 	NSS_PM_PERF_LEVEL_IDLE, |  | ||||||
| 	NSS_PM_PERF_LEVEL_NOMINAL, |  | ||||||
| 	NSS_PM_PERF_LEVEL_TURBO, |  | ||||||
| 	NSS_PM_PERF_MAX_LEVELS, |  | ||||||
| } nss_pm_perf_level_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_interface_status_t |  | ||||||
|  *	Status of the PM client interface. |  | ||||||
|  */ |  | ||||||
| typedef enum { |  | ||||||
| 	NSS_PM_API_SUCCESS = 0, |  | ||||||
| 	NSS_PM_API_FAILED, |  | ||||||
| } nss_pm_interface_status_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_client_register |  | ||||||
|  *	Registers a power management driver client. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pm_client_t |  | ||||||
|  * |  | ||||||
|  * @param[in] client_id  ID of the client driver. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void *nss_pm_client_register(nss_pm_client_t client_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_client_unregister |  | ||||||
|  *	Deregisters a power management driver client. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pm_client_t |  | ||||||
|  * |  | ||||||
|  * @param[in] client_id  ID of the client driver. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| int nss_pm_client_unregister(nss_pm_client_t client_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pm_set_perf_level |  | ||||||
|  *	Updates the bus bandwidth level for a client. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pm_perf_level_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Handle of the client. |  | ||||||
|  * @param[in,out] lvl     Performance level. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern nss_pm_interface_status_t nss_pm_set_perf_level(void *handle, nss_pm_perf_level_t lvl); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_PM_H */ |  | ||||||
| @@ -1,284 +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_portid.h |  | ||||||
|  *	NSS Port ID interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PORTID_H |  | ||||||
| #define __NSS_PORTID_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_portid_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of ports on the S17c switch chip. |  | ||||||
|  * |  | ||||||
|  * If a new switch has more ports than S17c, this value must be updated. |  | ||||||
|  */ |  | ||||||
| #define NSS_PORTID_MAX_SWITCH_PORT 7 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_msg_types |  | ||||||
|  *	Message types for port ID requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_portid_msg_types { |  | ||||||
| 	NSS_PORTID_CONFIGURE_MSG, |  | ||||||
| 	NSS_PORTID_UNCONFIGURE_MSG, |  | ||||||
| 	NSS_PORTID_STATS_SYNC_MSG, |  | ||||||
| 	NSS_PORTID_MAX_MSG_TYPE |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_configure_msg |  | ||||||
|  *	Message information for configuring a port ID. |  | ||||||
|  */ |  | ||||||
| struct nss_portid_configure_msg { |  | ||||||
| 	uint32_t port_if_num; |  | ||||||
| 			/**< Interface number corresponding to the port ID of the device. */ |  | ||||||
| 	uint8_t port_id;		/**< ID of the mapped switch port. */ |  | ||||||
| 	uint8_t gmac_id;		/**< ID of the mapped GMAC interface. */ |  | ||||||
| 	uint8_t reserved[2];		/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_unconfigure_msg |  | ||||||
|  *	Message information for deleting a port ID. |  | ||||||
|  */ |  | ||||||
| struct nss_portid_unconfigure_msg { |  | ||||||
| 	uint32_t port_if_num; |  | ||||||
| 			/**< Interface number corresponding to the port ID of the device. */ |  | ||||||
| 	uint8_t port_id;		/**< ID of the mapped switch port. */ |  | ||||||
| 	uint8_t reserved[3];		/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_stats_sync_msg |  | ||||||
|  *	Message information for port ID synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_portid_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t rx_invalid_header;		/**< Rx with an invalid header. */ |  | ||||||
| 	uint8_t port_id;			/**< ID of the mapped switch port. */ |  | ||||||
| 	uint8_t reserved[3];			/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_msg |  | ||||||
|  *	Data for sending and receiving port ID messages. |  | ||||||
|  */ |  | ||||||
| struct nss_portid_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a port ID message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_portid_configure_msg configure; |  | ||||||
| 				/**< Port ID configuration information. */ |  | ||||||
| 		struct nss_portid_unconfigure_msg unconfigure; |  | ||||||
| 				/**< Port ID de-configuration information. */ |  | ||||||
| 		struct nss_portid_stats_sync_msg stats_sync; |  | ||||||
| 				/**< Synchronization statistics for the port ID. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving port ID messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_portid_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] npm       Pointer to the NSS Profiler message. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_portid_msg_callback_t)(void *app_data, struct nss_portid_msg *npm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving port ID interface 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_portid_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_get_stats |  | ||||||
|  *	Gets statistics from a port interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * rtnl_link_stats64 |  | ||||||
|  * |  | ||||||
|  * @param[in]  if_num  NSS interface number. |  | ||||||
|  * @param[out] stats   Container for the statistic counters. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  */ |  | ||||||
| bool nss_portid_get_stats(uint32_t if_num, struct rtnl_link_stats64 *stats); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_msg_init |  | ||||||
|  *	Initializes a port ID message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_portid_msg \n |  | ||||||
|  * nss_portid_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] npm       Pointer to the NSS port ID 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_portid_msg_init(struct nss_portid_msg *npm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 							nss_portid_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_if_tx_data |  | ||||||
|  *	Transmits a data packet to the NSS port ID interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS data buffer. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_portid_if_tx_data(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_tx_msg |  | ||||||
|  *	Sends a port ID message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_portid_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_portid_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_portid_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_tx_msg_sync |  | ||||||
|  *	Sends a port ID message to the NSS and waits for a response. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_portid_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_portid_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_portid_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_register_port_if |  | ||||||
|  *	Registers the port interface with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_portid_buf_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * @param[in] port_id  Physical port ID of this interface. |  | ||||||
|  * @param[in] ndev     Pointer to the associated network device. |  | ||||||
|  * @param[in] buf_cb   Callback for the data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_portid_register_port_if(uint32_t if_num, uint32_t port_id, struct net_device *ndev, nss_portid_buf_callback_t buf_cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_unregister_port_if |  | ||||||
|  *	Deregisters the port interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern bool nss_portid_unregister_port_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_tx_configure_port_if_msg |  | ||||||
|  *	Sends a port interface configuration message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx      Pointer to the NSS context. |  | ||||||
|  * @param[in] port_if_num  Interface number of the port node. |  | ||||||
|  * @param[in] port_id      ID of the mapped switch port. |  | ||||||
|  * @param[in] gmac_id      ID of the mapped GMAC interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_portid_tx_configure_port_if_msg(struct nss_ctx_instance *nss_ctx, uint32_t port_if_num, uint8_t port_id, uint8_t gmac_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_portid_tx_unconfigure_port_if_msg |  | ||||||
|  *	Sends a port interface de-configuration message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx      Pointer to the NSS context. |  | ||||||
|  * @param[in] port_if_num  Interface number of the port node. |  | ||||||
|  * @param[in] port_id      ID of the mapped switch port. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously configured. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_portid_tx_unconfigure_port_if_msg(struct nss_ctx_instance *nss_ctx, uint32_t port_if_num, uint8_t port_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_PORTID_H */ |  | ||||||
| @@ -1,91 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2018, 2020-2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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.h |  | ||||||
|  *	NSS PPE interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_PPE_H_ |  | ||||||
| #define _NSS_PPE_H_ |  | ||||||
|  |  | ||||||
| typedef int32_t nss_ppe_port_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_ppe_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * NSS PORT defines |  | ||||||
|  */ |  | ||||||
| #define NSS_PPE_NUM_PHY_PORTS_MAX		8 |  | ||||||
| 		/**< Maximum number of PPE physical ports. */ |  | ||||||
| #define NSS_PPE_PORT_IPSEC			7 |  | ||||||
| 		/**< Port number of PPE inline IPsec port. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_ppe_sc_type |  | ||||||
|  *	PPE service code types. |  | ||||||
|  */ |  | ||||||
| enum nss_ppe_sc_type { |  | ||||||
| 	NSS_PPE_SC_NONE,		/**< Normal PPE processing. */ |  | ||||||
| 	NSS_PPE_SC_BYPASS_ALL,		/**< Bypasses all stages in PPE. */ |  | ||||||
| 	NSS_PPE_SC_ADV_QOS_BRIDGED,	/**< Advance QoS redirection for bridged flow. */ |  | ||||||
| 	NSS_PPE_SC_BR_QOS,		/**< Bridge QoS redirection. */ |  | ||||||
| 	NSS_PPE_SC_BNC_0,		/**< QoS bounce. */ |  | ||||||
| 	NSS_PPE_SC_BNC_CMPL_0,		/**< QoS bounce complete. */ |  | ||||||
| 	NSS_PPE_SC_ADV_QOS_ROUTED,	/**< Advance QoS redirection for routed flow. */ |  | ||||||
| 	NSS_PPE_SC_IPSEC_PPE2EIP,	/**< Inline IPsec redirection from PPE-to-EIP. */ |  | ||||||
| 	NSS_PPE_SC_IPSEC_EIP2PPE,	/**< Inline IPsec redirection from EIP-to-PPE. */ |  | ||||||
| 	NSS_PPE_SC_PTP,			/**< Service code for PTP packets. */ |  | ||||||
| 	NSS_PPE_SC_VLAN_FILTER_BYPASS,	/**< VLAN filter bypass for bridge flows between 2 different VSIs. */ |  | ||||||
| 	NSS_PPE_SC_L3_EXCEPT,		/**< Indicate exception post tunnel/TAP operation. */ |  | ||||||
| 	NSS_PPE_SC_SPF_BYPASS,		/**< Source port filtering bypass in PPE. */ |  | ||||||
| 	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 */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_PPE_H_ */ |  | ||||||
| @@ -1,79 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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,384 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_pppoe.h |  | ||||||
|  * 	NSS PPPoE interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PPPOE_H |  | ||||||
| #define __NSS_PPPOE_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_pppoe_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported PPPoE sessions. |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_PPPOE_DYNAMIC_INTERFACES 8 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_metadata_types |  | ||||||
|  *	Message types for PPPoE requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_metadata_types { |  | ||||||
| 	NSS_PPPOE_MSG_SESSION_CREATE, |  | ||||||
| 	NSS_PPPOE_MSG_SESSION_DESTROY, |  | ||||||
| 	NSS_PPPOE_MSG_SYNC_STATS, |  | ||||||
| 	NSS_PPPOE_MSG_BR_ACCEL_CFG, |  | ||||||
| 	NSS_PPPOE_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_session_exception_events |  | ||||||
|  *	Session exception events from the PPPoE handler. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_session_exception_events { |  | ||||||
| 	NSS_PPPOE_SESSION_EXCEPTION_EVENT_WRONG_VERSION_OR_TYPE, |  | ||||||
| 	NSS_PPPOE_SESSION_EXCEPTION_EVENT_WRONG_CODE, |  | ||||||
| 	NSS_PPPOE_SESSION_EXCEPTION_EVENT_UNSUPPORTED_PPP_PROTOCOL, |  | ||||||
| 	NSS_PPPOE_SESSION_EXCEPTION_EVENT_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * pppoe_base_exception_events |  | ||||||
|  * 	Base node exception events from the PPPoE handler. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_base_exception_events { |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_SHORT_PPPOE_HDR_LENGTH, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_SHORT_PACKET_LENGTH, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_WRONG_VERSION_OR_TYPE, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_WRONG_CODE, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_UNSUPPORTED_PPP_PROTOCOL, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_DISABLED_BRIDGE_PACKET, |  | ||||||
| 	NSS_PPPOE_BASE_EXCEPTION_EVENT_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_br_accel_mode |  | ||||||
|  *	PPPoE bridge acceleration modes. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_br_accel_modes { |  | ||||||
| 	NSS_PPPOE_BR_ACCEL_MODE_DIS, |  | ||||||
| 	NSS_PPPOE_BR_ACCEL_MODE_EN_5T, |  | ||||||
| 	NSS_PPPOE_BR_ACCEL_MODE_EN_3T, |  | ||||||
| 	NSS_PPPOE_BR_ACCEL_MODE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_base_stats |  | ||||||
|  * 	PPPoE base node synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_base_stats { |  | ||||||
| 	struct nss_cmn_node_stats node;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t exception[NSS_PPPOE_BASE_EXCEPTION_EVENT_MAX]; |  | ||||||
| 						/**< PPPoE base node exception events. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_session_stats |  | ||||||
|  * 	PPPoE synchronization statistics per session. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_session_stats { |  | ||||||
| 	struct nss_cmn_node_stats node;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t exception[NSS_PPPOE_SESSION_EXCEPTION_EVENT_MAX]; |  | ||||||
| 						/**< PPPoE session exception events. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_stats_session |  | ||||||
|  *	PPPoE session statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_stats_session { |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_RX_PACKETS, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_RX_BYTES, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_TX_PACKETS, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_TX_BYTES, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_WRONG_VERSION_OR_TYPE, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_WRONG_CODE, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_UNSUPPORTED_PPP_PROTOCOL, |  | ||||||
| 	NSS_PPPOE_STATS_SESSION_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_stats_base |  | ||||||
|  *	PPPoE base node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_pppoe_stats_base { |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_PACKETS, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_BYTES, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_TX_PACKETS, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_TX_BYTES, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_QUEUE_0_DROPPED, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_QUEUE_1_DROPPED, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_QUEUE_2_DROPPED, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_RX_QUEUE_3_DROPPED, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_SHORT_PPPOE_HDR_LENGTH, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_SHORT_PACKET_LENGTH, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_WRONG_VERSION_OR_TYPE, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_WRONG_CODE, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_UNSUPPORTED_PPP_PROTOCOL, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_DISABLED_BRIDGE_PACKET, |  | ||||||
| 	NSS_PPPOE_STATS_BASE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_stats_notification |  | ||||||
|  *	PPPoE statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_stats_notification { |  | ||||||
| 	uint32_t core_id;					/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;					/**< Interface number. */ |  | ||||||
| 	uint64_t session_stats[NSS_PPPOE_STATS_SESSION_MAX];	/**< PPPoE statistics. */ |  | ||||||
| 	uint64_t base_stats[NSS_PPPOE_STATS_BASE_MAX];		/**< PPPoE base node statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #ifdef __KERNEL__ /* only kernel will use. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_sync_stats_msg |  | ||||||
|  *	PPPoE synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_sync_stats_msg { |  | ||||||
| 	struct nss_pppoe_session_stats session_stats;	/**< Session statistics. */ |  | ||||||
| 	struct nss_pppoe_base_stats base_stats;		/**< Base node statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_destroy_msg |  | ||||||
|  *	PPPoE session destroy message. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_destroy_msg { |  | ||||||
| 	uint16_t session_id;		/**< PPPoE session identification number. */ |  | ||||||
| 	uint8_t server_mac[ETH_ALEN];	/**< PPPoE server MAC address. */ |  | ||||||
| 	uint8_t local_mac[ETH_ALEN];	/**< Local physical interface MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_create_msg |  | ||||||
|  *	PPPoE session create message. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_create_msg { |  | ||||||
| 	int32_t base_if_num;		/**< Base NSS interface number which PPPoE session created on. */ |  | ||||||
| 	uint32_t mtu;			/**< PPPoE interface MTU value. */ |  | ||||||
| 	uint8_t server_mac[ETH_ALEN];	/**< PPPoE server MAC address. */ |  | ||||||
| 	uint8_t local_mac[ETH_ALEN];	/**< Local physical interface MAC address. */ |  | ||||||
| 	uint16_t session_id;		/**< PPPoE session identification number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_br_accel_cfg_msg |  | ||||||
|  *	PPPoE bridge acceleration configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_br_accel_cfg_msg { |  | ||||||
| 	uint32_t br_accel_cfg;		/**< PPPoE bridge acceleration configuration. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_msg |  | ||||||
|  *	Data for sending and receiving PPPoE messages. |  | ||||||
|  */ |  | ||||||
| struct nss_pppoe_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a PPPoE message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_pppoe_create_msg create; |  | ||||||
| 					/**< Session create message. */ |  | ||||||
| 		struct nss_pppoe_destroy_msg destroy; |  | ||||||
| 					/**< Session destroy message. */ |  | ||||||
| 		struct nss_pppoe_sync_stats_msg sync_stats; |  | ||||||
| 					/**< Session statistics message. */ |  | ||||||
| 		struct nss_pppoe_br_accel_cfg_msg br_accel; |  | ||||||
| 					/**< PPPoE bridge acceleration configuration message. */ |  | ||||||
| 	} msg;				/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving PPPoE messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pppoe_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_pppoe_msg_callback_t)(void *app_data, struct nss_pppoe_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_tx_msg_sync |  | ||||||
|  *	Sends a PPPoE message synchronously to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_pppoe_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pppoe_tx_msg_sync(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 						struct nss_pppoe_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_pppoe_session_if |  | ||||||
|  *	Registers the PPPoE session interface with the NSS for sending and |  | ||||||
|  *	receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pppoe_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num                 NSS interface number. |  | ||||||
|  * @param[in] notification_callback  Callback for the message. |  | ||||||
|  * @param[in] netdev                 Pointer to the associated network device. |  | ||||||
|  * @param[in] features               Socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx                Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_register_pppoe_session_if(uint32_t if_num, |  | ||||||
| 						       nss_pppoe_msg_callback_t notification_callback, |  | ||||||
| 						       struct net_device *netdev, uint32_t features, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_pppoe_session_if |  | ||||||
|  *	Deregisters the PPPoE session interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
| . * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_pppoe_session_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_get_context |  | ||||||
|  *	Gets the PPPoE context used in PPPoE transmit message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_pppoe_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_debug_stats_get |  | ||||||
|  *	Gets NSS session debug statistics. |  | ||||||
|  * |  | ||||||
|  * @param[out] stats_mem  Pointer to the memory address, which must be large |  | ||||||
|  *                         enough to hold all the statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pppoe_debug_stats_get(void *stats_mem); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_get_bridge_accel_mode |  | ||||||
|  *	Gets the PPPoE bridge acceleration mode. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Current PPPoE bridge acceleration mode. |  | ||||||
|  */ |  | ||||||
| extern enum nss_pppoe_br_accel_modes nss_pppoe_get_br_accel_mode(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_register_sysctl |  | ||||||
|  *	Registers the PPPoE system control table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_pppoe_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_unregister_sysctl |  | ||||||
|  *	Deregisters the PPPoE system control table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control table must have been previously registered. |  | ||||||
|  */ |  | ||||||
| void nss_pppoe_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_msg_init |  | ||||||
|  *	Initializes a PPPoE message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pppoe_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    Interface number |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pppoe_msg_init(struct nss_pppoe_msg *ncm, |  | ||||||
| 				uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 				void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_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_pppoe_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pppoe_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_pppoe_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| #endif /*__KERNEL__ */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_PPPOE_H */ |  | ||||||
| @@ -1,345 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2015-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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_pptp.h |  | ||||||
|  *	NSS PPTP interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_PPTP_H_ |  | ||||||
| #define _NSS_PPTP_H_ |  | ||||||
|  |  | ||||||
| #include "nss_dynamic_interface.h" |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_pptp_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported PPTP sessions is 4. |  | ||||||
|  * Number of dynamic intefaces per session is 3. |  | ||||||
|  * Total 4 * 3 = 12 |  | ||||||
|  */ |  | ||||||
| #define NSS_MAX_PPTP_DYNAMIC_INTERFACES 12 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_metadata_types |  | ||||||
|  *	Message types for PPTP requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_pptp_metadata_types { |  | ||||||
| 	NSS_PPTP_MSG_SESSION_CONFIGURE, |  | ||||||
| 	NSS_PPTP_MSG_SESSION_DECONFIGURE, |  | ||||||
| 	NSS_PPTP_MSG_SYNC_STATS, |  | ||||||
| 	NSS_PPTP_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_exception_events |  | ||||||
|  *	Exception events for PPTP encapsulation and decapsulation packets. |  | ||||||
|  */ |  | ||||||
| enum nss_pptp_exception_events { |  | ||||||
| 	PPTP_EXCEPTION_EVENT_ENCAP_HEADROOM_ERR, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_ENCAP_SMALL_SIZE, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_ENCAP_PNODE_ENQUEUE_FAIL, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_NO_SEQ_NOR_ACK, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_INVAL_GRE_FLAGS, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_INVAL_GRE_PROTO, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_WRONG_SEQ, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_INVAL_PPP_HDR, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_PPP_LCP, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_UNSUPPORTED_PPP_PROTO, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_DECAP_PNODE_ENQUEUE_FAIL, |  | ||||||
| 	PPTP_EXCEPTION_EVENT_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_stats_session |  | ||||||
|  * 	PPTP debug statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_pptp_stats_session { |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_PACKETS, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_BYTES, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_TX_PACKETS, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_TX_BYTES, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_QUEUE_0_DROP, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_QUEUE_1_DROP, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_QUEUE_2_DROP, |  | ||||||
| 	NSS_PPTP_STATS_ENCAP_RX_QUEUE_3_DROP, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_PACKETS, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_BYTES, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_TX_PACKETS, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_TX_BYTES, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_QUEUE_0_DROP, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_QUEUE_1_DROP, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_QUEUE_2_DROP, |  | ||||||
| 	NSS_PPTP_STATS_DECAP_RX_QUEUE_3_DROP, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_ENCAP_HEADROOM_ERR, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_ENCAP_SMALL_SIZE, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_ENCAP_PNODE_ENQUEUE_FAIL, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_NO_SEQ_NOR_ACK, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_INVAL_GRE_FLAGS, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_INVAL_GRE_PROTO, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_WRONG_SEQ, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_INVAL_PPP_HDR, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_PPP_LCP, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_UNSUPPORTED_PPP_PROTO, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_DECAP_PNODE_ENQUEUE_FAIL, |  | ||||||
| 	NSS_PPTP_STATS_SESSION_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_stats_notification |  | ||||||
|  *	PPTP statistics structure. |  | ||||||
|  */ |  | ||||||
| struct nss_pptp_stats_notification { |  | ||||||
| 	uint32_t core_id;				/**< Core ID. */ |  | ||||||
| 	uint32_t if_num;				/**< Interface number. */ |  | ||||||
| 	enum nss_dynamic_interface_type if_type;	/**< Dynamic interface type. */ |  | ||||||
| 	uint64_t stats[NSS_PPTP_STATS_SESSION_MAX];	/**< PPTP statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_session_configure_msg |  | ||||||
|  *	Message information for configuring a PPTP session. |  | ||||||
|  */ |  | ||||||
| struct nss_pptp_session_configure_msg { |  | ||||||
| 	uint16_t src_call_id;		/**< Local call ID for caller or callee. */ |  | ||||||
| 	uint16_t dst_call_id;		/**< Peer call ID for caller or callee. */ |  | ||||||
| 	uint32_t sip;			/**< Local tunnel endpoint. */ |  | ||||||
| 	uint32_t dip;			/**< Remote tunnel endpoint. */ |  | ||||||
| 	uint32_t sibling_ifnum_pri;	/**< Primary sibling interface. */ |  | ||||||
| 	uint32_t sibling_ifnum_aux;	/**< Auxiliary sibling interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_session_deconfigure_msg |  | ||||||
|  *	Message information for deleting a PPTP session. |  | ||||||
|  */ |  | ||||||
| struct nss_pptp_session_deconfigure_msg { |  | ||||||
| 	uint16_t src_call_id;		/**< Local call ID */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_sync_session_stats_msg |  | ||||||
|  *	Message information for PPTP synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_pptp_sync_session_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats; |  | ||||||
| 			/**< Common node statistics for the encapsulation direction. */ |  | ||||||
| 	uint32_t exception_events[PPTP_EXCEPTION_EVENT_MAX]; |  | ||||||
| 			/**< Statistics of events which casued packets to exception to host. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_msg |  | ||||||
|  *	Data for sending and receiving PPTP messages. |  | ||||||
|  */ |  | ||||||
| struct nss_pptp_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a PPTP message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_pptp_session_configure_msg session_configure_msg; |  | ||||||
| 				/**< Session configuration message. */ |  | ||||||
| 		struct nss_pptp_session_deconfigure_msg session_deconfigure_msg; |  | ||||||
| 				/**< Session de-configuration message. */ |  | ||||||
| 		struct nss_pptp_sync_session_stats_msg stats; |  | ||||||
| 				/**< Session statistics message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving PPTP messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pptp_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_pptp_msg_callback_t)(void *app_data, struct nss_pptp_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_tx_msg_sync |  | ||||||
|  *	Sends a PPTP message synchronously to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_pptp_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pptp_tx_msg_sync(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 					    struct nss_pptp_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_tx_buf |  | ||||||
|  *	Sends a data packet to the firmware. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     skb      Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pptp_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_get_context |  | ||||||
|  *	Gets the PPTP context used in nss_pptp_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_pptp_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving PPTP tunnel 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_pptp_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_pptp_if |  | ||||||
|  *	Registers the PPTP tunnel interface with the NSS for sending and |  | ||||||
|  *	receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pptp_callback_t \n |  | ||||||
|  * nss_pptp_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num                 NSS interface number. |  | ||||||
|  * @param[in] type                   Dynamic interface type. |  | ||||||
|  * @param[in] pptp_data_callback     Callback for the data. |  | ||||||
|  * @param[in] notification_callback  Callback for the message. |  | ||||||
|  * @param[in] netdev                 Pointer to the associated network device. |  | ||||||
|  * @param[in] features               Socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx                Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_register_pptp_if(uint32_t if_num, uint32_t type, nss_pptp_callback_t pptp_data_callback, |  | ||||||
| 					nss_pptp_msg_callback_t notification_callback, struct net_device *netdev, uint32_t features, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_pptp_if |  | ||||||
|  *	Deregisters the PPTP tunnel interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
| . * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_pptp_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_msg_init |  | ||||||
|  *	Initializes a PPTP message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pptp_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    Interface number |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pptp_msg_init(struct nss_pptp_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_register_handler |  | ||||||
|  *	Registers the PPTP interface with the NSS debug statistics handler. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pptp_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_session_debug_stats_get |  | ||||||
|  *	Gets NSS session debug statistics. |  | ||||||
|  * |  | ||||||
|  * @param[out] stats_mem  Pointer to the memory address, which must be large |  | ||||||
|  *                         enough to hold all the statistics. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pptp_session_debug_stats_get(void *stats_mem); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_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_pptp_stats_register_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pptp_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_pptp_stats_unregister_notifier(struct notifier_block *nb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_PPTP_H_ */ |  | ||||||
| @@ -1,406 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2015, 2017, 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_profiler.h |  | ||||||
|  *	NSS Profiler APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PROFILER_H |  | ||||||
| #define __NSS_PROFILER_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_profiler_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Length of the counter name. |  | ||||||
|  * |  | ||||||
|  * This value allows all counter values to fit in a single 1400-byte UDP packet. |  | ||||||
|  */ |  | ||||||
| #define PROFILE_COUNTER_NAME_LENGTH 20 |  | ||||||
|  |  | ||||||
| #define PROFILE_MAX_APP_COUNTERS 24	/**< Maximum number of application counters. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_counter |  | ||||||
|  *	Counter statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_profile_counter { |  | ||||||
| 	char name[PROFILE_COUNTER_NAME_LENGTH];		/**< Counter name. */ |  | ||||||
| 	uint32_t value;					/**< Current value. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_message_types |  | ||||||
|  *	Message types for the Profiler. |  | ||||||
|  * |  | ||||||
|  * Do not alter this enumeration. However, adding more types is allowed. |  | ||||||
|  */ |  | ||||||
| enum nss_profiler_message_types { |  | ||||||
| 	NSS_PROFILER_CHANGE_SAMPLING_RATE_MSG,	/**< Host-to-NSS: ask to do a rate change. */ |  | ||||||
| 	NSS_PROFILER_START_MSG,			/**< Host-to-NSS: start the NSS Profiler. */ |  | ||||||
| 	NSS_PROFILER_STOP_MSG,			/**< Host-to-NSS: stop the NSS Profiler. */ |  | ||||||
| 	NSS_PROFILER_FLOWCTRL_MSG,		/**< Host-to-NSS: do flow control on sampling. */ |  | ||||||
| 	NSS_PROFILER_DEBUG_RD_MSG,		/**< Host-to-NSS: debug the output. */ |  | ||||||
| 	NSS_PROFILER_DEBUG_WR_MSG,		/**< Host-to-NSS: debug the input. */ |  | ||||||
| 	NSS_PROFILER_DEBUG_REPLY_MSG,		/**< NSS-to-host: debug response. */ |  | ||||||
| 	NSS_PROFILER_REPLY_MSG,			/**< Check the response. */ |  | ||||||
| 	NSS_PROFILER_FIXED_INFO_MSG,		/**< NSS-to-host: constant data. */ |  | ||||||
| 	NSS_PROFILER_COUNTERS_MSG,		/**< NSS-to-host: counter information. */ |  | ||||||
| 	NSS_PROFILER_SAMPLES_MSG,		/**< NSS-to-host: main sample data. */ |  | ||||||
| 	NSS_PROFILER_START_CAL,			/**< Not for the host to use. */ |  | ||||||
| 	NSS_PROFILER_GET_SYS_STAT_EVENT,	/**< Get the system status event. */ |  | ||||||
| 	NSS_PROFILER_SET_SYS_STAT_EVENT,	/**< Set the system status event. */ |  | ||||||
| 	NSS_PROFILER_MAX_MSG_TYPES,		/**< Maximum number of message types. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_errors |  | ||||||
|  *	Profiler error types returned from the NSS. |  | ||||||
|  */ |  | ||||||
| enum nss_profile_errors { |  | ||||||
| 	PROFILE_ERROR_NO_PROF_INIT = 1, |  | ||||||
| 	PROFILE_ERROR_EMEM, |  | ||||||
| 	PROFILE_ERROR_BAD_PKT, |  | ||||||
| 	PROFILE_ERROR_UNKNOWN_CMD, |  | ||||||
| 	PROFILE_ERROR_NO_DMA, |  | ||||||
| 	PROFILE_ERROR_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_cmd_param |  | ||||||
|  *	Parameter information for the Profiler. |  | ||||||
|  * |  | ||||||
|  * Use this structure for per-session commands: START, STOP, FLOWCTRL, RATE. |  | ||||||
|  */ |  | ||||||
| struct nss_profiler_cmd_param { |  | ||||||
| 	uint32_t hd_magic;		/**< Common overlay in all headers. */ |  | ||||||
| 	uint32_t num_counters; |  | ||||||
| 			/**< Number of registered performance (application) counters. */ |  | ||||||
| 	uint32_t ocm_size;		/**< Size of the on-chip-memory. */ |  | ||||||
| 	uint32_t sram_start;		/**< DDR starting address. */ |  | ||||||
| 	uint32_t rate;			/**< Sampling rate. */ |  | ||||||
| 	uint32_t cpu_id;		/**< ID of the chip register. */ |  | ||||||
| 	uint32_t cpu_freq;		/**< Chip clock frequency. */ |  | ||||||
| 	uint32_t ddr_freq;		/**< DDR memory speed. */ |  | ||||||
|  |  | ||||||
| 	struct nss_profile_counter counters[PROFILE_MAX_APP_COUNTERS]; |  | ||||||
| 			/**< Application profiling counters. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_data_msg |  | ||||||
|  *	Message information for the Profiler. |  | ||||||
|  */ |  | ||||||
| struct nss_profiler_data_msg { |  | ||||||
| 	uint32_t hd_magic;		/**< Magic header for verification. */ |  | ||||||
| 	uint32_t msg_data[1];		/**< Variable length private data. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_debug_msg |  | ||||||
|  *	Message information for Profiler debugging. |  | ||||||
|  */ |  | ||||||
| struct nss_profiler_debug_msg { |  | ||||||
| 	uint32_t hd_magic;		/**< Magic header for verification. */ |  | ||||||
| 	uint32_t debug_data[256];	/**< Fixed length debug data. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_msg |  | ||||||
|  *	Data for sending and receiving Profiler messages. |  | ||||||
|  */ |  | ||||||
| struct nss_profiler_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a Profiler message. |  | ||||||
| 	 */ |  | ||||||
| 	union npm_body { |  | ||||||
| 		struct nss_profiler_cmd_param pcmdp;	/**< Command parameters. */ |  | ||||||
| 		struct nss_profiler_debug_msg pdm;	/**< Debug packet. */ |  | ||||||
| 		struct nss_profiler_data_msg msg;	/**< Sampling data. */ |  | ||||||
| 	} payload;	/**< Message payload. The data length is set in common message header. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_sdma_producer |  | ||||||
|  *	DMA descriptor of producer. |  | ||||||
|  */ |  | ||||||
| struct nss_profile_sdma_producer { |  | ||||||
| 	uint32_t intr_num;	/**< Interrupt number. */ |  | ||||||
| 	uint32_t pkg_id;	/**< Package ID that registered this entry. */ |  | ||||||
| 	uint32_t buf_size;	/**< DMA buffer size. */ |  | ||||||
| 	uint32_t num_bufs;	/**< Number of ring buffers. */ |  | ||||||
| 	uint32_t desc_ring;	/**< Ring address (physical 32-bit). */ |  | ||||||
| 	uint32_t pad3w[3];	/**< Pad 32-byte alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_u64_32_data |  | ||||||
|  *	64-bit union for both 32/64 bits data aligned at 64-bit boundary. |  | ||||||
|  */ |  | ||||||
| union nss_u64_32_data { |  | ||||||
| 	uint64_t d64;	/**< 64-bit space holder: may not be used. */ |  | ||||||
| 	uint32_t d32;	/**< 32-bit direct data. */ |  | ||||||
| 	void *kp;	/**< Kernel data pointer either 32 or 64 bits. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_u64_32_func |  | ||||||
|  *	64-bit union for both 32/64 bits function aligned at 64-bit boundary. |  | ||||||
|  */ |  | ||||||
| union nss_u64_32_func { |  | ||||||
| 	uint64_t f64;		/**< 64-bit space holder: do not use. */ |  | ||||||
| 	void (*fp)(void*);	/**< Function pointer: either 32 or 64 bits. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_sdma_consumer |  | ||||||
|  *	DMA descriptor of consumer. |  | ||||||
|  */ |  | ||||||
| struct nss_profile_sdma_consumer { |  | ||||||
| 	union nss_u64_32_data arg;	/**< Dispatch function argument. */ |  | ||||||
| 	union nss_u64_32_func dispatch;	/**< Dispatch function pointer. */ |  | ||||||
| 	union nss_u64_32_data ring;	/**< DMA descriptor ring kernel address. */ |  | ||||||
| 	int64_t unused_lw;		/**< Extra room in a Ubi32 cache line. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #define	ARM_CACHE_LINE_SIZE	128	/**< ARM CPU cache line size in bytes. */ |  | ||||||
| #define	NSS_CACHE_LINE_WORDS	8	/**< Ubi32 CPU cache line size in words. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Number of DMA per control block. |  | ||||||
|  */ |  | ||||||
| #define	NSS_PROFILE_MAX_DMA_DESCRIPTORS	(ARM_CACHE_LINE_SIZE / sizeof(struct nss_profile_sdma_producer) - 1) |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_sdma_ctrl |  | ||||||
|  *	Soft DMA control block. |  | ||||||
|  */ |  | ||||||
| struct nss_profile_sdma_ctrl { |  | ||||||
| 	int32_t num_rings;	/**< Number of descriptor rings allocated, maximum is 3. */ |  | ||||||
| 	int32_t cur_ring;	/**< Which ring is in use: Default 0. */ |  | ||||||
| 	int32_t pidx[NSS_PROFILE_MAX_DMA_DESCRIPTORS];	/**< Producer index. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Pad for the first Ubi32 cache line in the first ARM cache line: Unused. |  | ||||||
| 	 */ |  | ||||||
| 	int32_t pad_for_1st_cl_in_1st_arm_cl[NSS_CACHE_LINE_WORDS - 2 - NSS_PROFILE_MAX_DMA_DESCRIPTORS]; |  | ||||||
| 	struct nss_profile_sdma_producer producer[NSS_PROFILE_MAX_DMA_DESCRIPTORS]; /**< DMA producer structure. */ |  | ||||||
|  |  | ||||||
| 	int32_t cidx[NSS_PROFILE_MAX_DMA_DESCRIPTORS];	/**< Consumer index. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Pad for the first Ubi32 cache line in the second ARM cache line: Unused. |  | ||||||
| 	 */ |  | ||||||
| 	int32_t pad_for_1st_cl_in_2nd_arm_cl[NSS_CACHE_LINE_WORDS - NSS_PROFILE_MAX_DMA_DESCRIPTORS]; |  | ||||||
| 	struct nss_profile_sdma_consumer consumer[NSS_PROFILE_MAX_DMA_DESCRIPTORS]; /**< DMA consumer structure. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving Profiler messages. |  | ||||||
|  * |  | ||||||
|  * @note: Memory (buffer) pointed by npm is owned by caller, that is, NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_profiler_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the context of the NSS process (core). |  | ||||||
|  * @param[in] npm  Pointer to the NSS Profiler message. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_profiler_callback_t)(void *ctx, struct nss_profiler_msg *npm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_notify_register |  | ||||||
|  *	Registers the Profiler interface with the NSS driver for sending and receiving messages. |  | ||||||
|  * |  | ||||||
|  * This function must be called once for each core. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_core_id_t \n |  | ||||||
|  * nss_profiler_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] profiler_callback  Callback for the data. |  | ||||||
|  * @param[in] core_id            NSS core ID. |  | ||||||
|  * @param[in] ctx                Pointer to the context of the NSS core. The context is |  | ||||||
|                                  provided to caller in the registered callback function. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The caller must provide the valid core ID that is being profiled. |  | ||||||
|  */ |  | ||||||
| extern void *nss_profiler_notify_register(nss_core_id_t core_id, nss_profiler_callback_t profiler_callback, void *ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_notify_unregister |  | ||||||
|  *	Deregisters the Profiler interface from the NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_core_id_t |  | ||||||
|  * |  | ||||||
|  * @param[in] core_id  NSS core ID. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_profiler_notify_unregister(nss_core_id_t core_id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_if_tx_buf |  | ||||||
|  *	Sends a Profiler command to the NSS firmware. |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] buf       Buffer to send to NSS firmware. |  | ||||||
|  * @param[in] len       Length of the buffer. |  | ||||||
|  * @param[in] cb        Pointer to the message callback. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * A valid context must be provided (for the right core). |  | ||||||
|  * This context was returned during registration. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_profiler_if_tx_buf(void *nss_ctx, |  | ||||||
| 		void *buf, uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_alloc_dma |  | ||||||
|  *	Allocate profiler DMA for transmitting samples. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_profile_sdma_producer |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   Pointer to the NSS context. |  | ||||||
|  * @param[in] dma_p     Pointer to return DMA control. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Buffer adddress. |  | ||||||
|  */ |  | ||||||
| extern void *nss_profiler_alloc_dma(struct nss_ctx_instance *nss_ctx, struct nss_profile_sdma_producer **dma_p); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_release_dma() |  | ||||||
|  *      Free profiler DMA. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_profiler_release_dma(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_profile_dma_register_cb |  | ||||||
|  *      Register a handler for profile DMA. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] id       DMA ID; typical value is 0. |  | ||||||
|  * @param[in] cb       Callback function pointer. |  | ||||||
|  * @param[in] arg      Callback function argument pointer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True on success; or false on failure. |  | ||||||
|  */ |  | ||||||
| extern bool nss_profile_dma_register_cb(struct nss_ctx_instance *nss_ctx, int id, |  | ||||||
| 				void (*cb)(void*), void *arg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_dma_deregister_cb() |  | ||||||
|  *      Deregister callback for profile DMA. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] id       DMA ID; typical value is 0. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True on success; or false on failure. |  | ||||||
|  */ |  | ||||||
| extern bool nss_profile_dma_deregister_cb(struct nss_ctx_instance *nss_ctx, int id); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profile_dma_get_ctrl() |  | ||||||
|  *      API to get profile DMA control. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * DMA controller. |  | ||||||
|  */ |  | ||||||
| extern struct nss_profile_sdma_ctrl *nss_profile_dma_get_ctrl(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * profile_register_performance_counter |  | ||||||
|  *	Registers a Linux counter with the profiler for any variables. |  | ||||||
|  * |  | ||||||
|  * @param[in] counter	Pointer to the variable address. |  | ||||||
|  * @param[in] name	Pointer to the variable name: if name is longer than |  | ||||||
| 			23 characters, then only the first 23 bytes are used. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * 0	if counter array is full -- too many registered counters. |  | ||||||
|  * 1	on success |  | ||||||
|  */ |  | ||||||
| extern int profile_register_performance_counter(volatile unsigned int *counter, char *name); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_profiler_msg_init |  | ||||||
|  *	Initializes a Profiler-specific message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_profiler_msg \n |  | ||||||
|  * nss_profiler_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] npm       Pointer to the NSS Profiler message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the message. |  | ||||||
|  * @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_profiler_msg_init(struct nss_profiler_msg *npm, uint16_t if_num, |  | ||||||
| 				uint32_t type, uint32_t len, |  | ||||||
| 				nss_profiler_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -1,176 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_project.h |  | ||||||
|  *	NSS project interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PROJECT_H |  | ||||||
| #define __NSS_PROJECT_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_project_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
|  /** |  | ||||||
|   * Maximum number of IRQs for which a message will have statistics. |  | ||||||
|   * |  | ||||||
|   * Must be defined on firmware and host such that NSS_PROJECT_IRQS_PER_MESSAGE * |  | ||||||
|   * sizeof(struct nss_project_irq_stats) + 8 + sizeof(struct nss_cmn_msg) is smaller |  | ||||||
|   * than the maximum payload size of an sk_buff (1792), 8 being the number of |  | ||||||
|   * bytes needed to store the thread number and number of statistics written. |  | ||||||
|   */ |  | ||||||
| #define NSS_PROJECT_IRQS_PER_MESSAGE 32 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_message_types |  | ||||||
|  *	Project message types. |  | ||||||
|  */ |  | ||||||
| enum nss_project_message_types { |  | ||||||
| 	NSS_PROJECT_MSG_WT_STATS_ENABLE, |  | ||||||
| 			/**< Message to enable or disable worker thread statistics. */ |  | ||||||
| 	NSS_PROJECT_MSG_WT_STATS_NOTIFY, |  | ||||||
| 			/**< NSS to HLOS message containing worker thread statistics. */ |  | ||||||
| 	NSS_PROJECT_MSG_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_error_types |  | ||||||
|  *	Project error types. |  | ||||||
|  */ |  | ||||||
| enum nss_project_error_types { |  | ||||||
| 	NSS_PROJECT_ERROR_UNKNOWN_MSG, |  | ||||||
| 			/**< Unrecognized message type. */ |  | ||||||
| 	NSS_PROJECT_ERROR_WT_STATS_UNSUPPORTED, |  | ||||||
| 			/**< The firmware does not support worker thread statistics. */ |  | ||||||
| 	NSS_PROJECT_ERROR_WT_STATS_REDUNDANT_ENABLE, |  | ||||||
| 			/**< The firmware received a redundant request to enable worker thread statistics. */ |  | ||||||
| 	NSS_PROJECT_ERROR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_msg_wt_stats_enable |  | ||||||
|  *	Enables or disables worker thread statistics collection. |  | ||||||
|  */ |  | ||||||
| struct nss_project_msg_wt_stats_enable { |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * NSS to HLOS |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t worker_thread_count; |  | ||||||
| 			/**< Number of worker threads supported by this core. */ |  | ||||||
| 	uint32_t irq_count; |  | ||||||
| 			/**< Number of IRQs supported by this core. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * HLOS to NSS |  | ||||||
| 	 */ |  | ||||||
| 	bool enable;	/**< True to enable, false to disable. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_irq_stats |  | ||||||
|  *	Statistics for an individual IRQ on a worker thread. |  | ||||||
|  */ |  | ||||||
| struct nss_project_irq_stats { |  | ||||||
| 	uint64_t count;		/**< Number of times callback has been executed */ |  | ||||||
| 	uint32_t callback;	/**< Address of the callback function */ |  | ||||||
| 	uint32_t irq;		/**< IRQ number to which callback function is bound */ |  | ||||||
| 	uint32_t ticks_min;	/**< Fewest ticks taken in callback function */ |  | ||||||
| 	uint32_t ticks_avg;	/**< Exponential moving average of ticks */ |  | ||||||
| 	uint32_t ticks_max;	/**< Maximum ticks */ |  | ||||||
| 	uint32_t insn_min;	/**< Fewest instructions executed in callback function */ |  | ||||||
| 	uint32_t insn_avg;	/**< Exponential moving average of instruction count */ |  | ||||||
| 	uint32_t insn_max;	/**< Maximum instructions */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_msg_wt_stats_notify |  | ||||||
|  *	Message containing statistics for active worker_thread IRQs. |  | ||||||
|  */ |  | ||||||
| struct nss_project_msg_wt_stats_notify { |  | ||||||
| 	uint32_t threadno;	/**< The thread whose stats are contained. */ |  | ||||||
| 	uint32_t stats_written;	/**< The number of statistics written to the array. */ |  | ||||||
| 	struct nss_project_irq_stats stats[NSS_PROJECT_IRQS_PER_MESSAGE]; |  | ||||||
| 				/**< The per-IRQ statistics for the worker thread */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_msg |  | ||||||
|  *	General message structure for project messages. |  | ||||||
|  */ |  | ||||||
| struct nss_project_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a message to or from the project code. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_project_msg_wt_stats_enable wt_stats_enable; |  | ||||||
| 				/**< Enable or disable worker thread statistics. */ |  | ||||||
| 		struct nss_project_msg_wt_stats_notify wt_stats_notify; |  | ||||||
| 				/**< One-way worker thread statistics message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving project messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_project_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the project message. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_project_msg_callback_t)(void *app_data, struct nss_project_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_register_sysctl |  | ||||||
|  *	Registers the project sysctl table to the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_project_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_unregister_sysctl |  | ||||||
|  *	De-registers the project sysctl table from the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control must have been previously registered. |  | ||||||
|  */ |  | ||||||
| void nss_project_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_project_register_handler |  | ||||||
|  *	Registers the project message handler. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_project_register_handler(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_PROJECT_H */ |  | ||||||
| @@ -1,371 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_pvxlan.h |  | ||||||
|  *	NSS proxy VxLAN interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_PVXLAN_H |  | ||||||
| #define __NSS_PVXLAN_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_pvxlan_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Size of the headroom required for proxy VxLAN packets. |  | ||||||
|  */ |  | ||||||
| #define NSS_PVXLAN_HEADROOM 256 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported proxy VxLAN tunnel sessions. |  | ||||||
|  */ |  | ||||||
| #define NSS_PVXLAN_MAX_INTERFACES 32 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Proxy VxLAN Rule configure message flags |  | ||||||
|  */ |  | ||||||
| #define NSS_PVXLAN_TUNNEL_IPV4 0x0001		/**< IPv4 tunnel. */ |  | ||||||
| #define NSS_PVXLAN_TUNNEL_IPV6 0x0002		/**< IPv6 tunnel. */ |  | ||||||
| #define NSS_PVXLAN_TUNNEL_UDP 0x0010		/**< UDP tunnel. */ |  | ||||||
| #define NSS_PVXLAN_TUNNEL_UDPLite 0x0020	/**< UDPLite tunnel. */ |  | ||||||
| #define NSS_PVXLAN_TUNNEL_ENCAP_UDPLITE_HDR_CSUM 0x0100 |  | ||||||
| 	/**< Generate only UDPLite header checksum. Otherwise whole UDPLite payload. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_msg_type |  | ||||||
|  *	Proxy VxLAN message types. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_pvxlan_msg_type { |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_SYNC_STATS,		/**< Statistics synchronization message. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_TUNNEL_CREATE_RULE,	/**< Creating tunnel rule. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_TUNNEL_DESTROY_RULE, |  | ||||||
| 						/**< Destroying tunnel rule. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_TUNNEL_ENABLE,	/**< Enable the tunnel. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_TUNNEL_DISABLE,	/**< Disable the tunnel. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_MAC_ADD,		/**< Add MAC rule to the database. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_MAC_DEL,		/**< Remove MAC rule from the database. */ |  | ||||||
| 	NSS_PVXLAN_MSG_TYPE_MAX,		/**< Maximum message type. */ |  | ||||||
| } nss_pvxlan_msg_type_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_error_response_types |  | ||||||
|  *	Error types for proxy VxLAN responses to messages from the host. |  | ||||||
|  */ |  | ||||||
| typedef enum nss_pvxlan_error_response_types { |  | ||||||
| 	NSS_PVXLAN_ERROR_UNKNOWN_TYPE = 1,	/**< Unknown type error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_INVALID_L3_PROTO,	/**< L3 Protocol is invalid error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_INVALID_UDP_PROTO,	/**< UDP Protocol is invalid error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_TUNNEL_DISABLED,	/**< Tunnel is already disabled error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_TUNNEL_ENABLED,	/**< Tunnel is already enabled error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_TUNNEL_ENTRY_EXIST, |  | ||||||
| 						/**< Tunnel is already exist error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_TUNNEL_TABLE_FULL, |  | ||||||
| 						/**< Tunnel table is full error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_INVALID_TUNNEL_ID,	/**< Tunnel ID is invalid error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAC_TABLE_FULL,	/**< MAC table is full error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAC_EXIST,		/**< MAC does already exist in the table error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAC_NOT_EXIST,		/**< MAC does not exist in the table error. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAC_ENTRY_UNHASHED, |  | ||||||
| 						/**< MAC entry is not hashed in table. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAC_ENTRY_INSERT_FAILED, |  | ||||||
| 						/**< Insertion to MAC table is failed. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_UDP_ENCAP_TUNNEL_ID_IN_USE, |  | ||||||
| 						/**< Given tunnel ID is currently used. */ |  | ||||||
| 	PVXLAN_ERROR_MSG_TUNNEL_ADD_FAILED,	/**< Tunnel add information failed. */ |  | ||||||
| 	PVXLAN_ERROR_MSG_MAC_ENTRY_ALLOC_FAILED, |  | ||||||
| 						/**< MAC entry allocation failed. */ |  | ||||||
| 	PVXLAN_ERROR_MSG_MAC_ENTRY_DELETE_FAILED, |  | ||||||
| 						/**< MAC entry deletion failed. */ |  | ||||||
| 	NSS_PVXLAN_ERROR_MAX,			/**< Maximum error type. */ |  | ||||||
| } nss_pvxlan_error_response_t; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_stats_msg |  | ||||||
|  *	Per-tunnel statistics messages from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common firmware statistics. */ |  | ||||||
| 	uint32_t mac_db_lookup_failed;		/**< MAC Database look up failed. */ |  | ||||||
| 	uint32_t udp_encap_lookup_failed;	/**< MAC Database look up failed. */ |  | ||||||
| 	uint32_t dropped_malformed;		/**< Packet is malformed. */ |  | ||||||
| 	uint32_t dropped_next_node_queue_full;	/**< Next node dropped the packet. */ |  | ||||||
| 	uint32_t dropped_hroom;			/**< Transmit dropped due to insufficent headroom. */ |  | ||||||
| 	uint32_t dropped_ver_mis;		/**< Transmit dropped due to version mismatch. */ |  | ||||||
| 	uint32_t dropped_zero_sized_packet;	/**< Transmit dropped due to zero sized packet. */ |  | ||||||
| 	uint32_t dropped_pbuf_alloc_failed;	/**< Receive side pbuf allocation failed. */ |  | ||||||
| 	uint32_t dropped_linear_failed;		/**< Receive side linearization failed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_ip |  | ||||||
|  *	IP versions. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_ip { |  | ||||||
| 	/** |  | ||||||
| 	 * Union of IPv4 and IPv6 IP addresses. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		uint32_t ipv4;		/**< IPv4 address. */ |  | ||||||
| 		uint32_t ipv6[4];	/**< IPv6 address. */ |  | ||||||
| 	} ip;		/**< Union of IPv4 and IPv6 IP addresses. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_encap_rule |  | ||||||
|  *	Encapsulation information for a proxy VxLAN tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_encap_rule { |  | ||||||
| 	struct  nss_pvxlan_ip src;	/**< Source IP. */ |  | ||||||
| 	uint32_t src_port;		/**< Source port. */ |  | ||||||
| 	struct nss_pvxlan_ip dest;	/**< Destination IP. */ |  | ||||||
| 	uint32_t dest_port;		/**< Destination port. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_rule_msg |  | ||||||
|  *	Proxy VxLAN rule message. |  | ||||||
|  * |  | ||||||
|  * The same rule structure applies for both encapsulation and decapsulation |  | ||||||
|  * in a tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_rule_msg { |  | ||||||
| 	struct nss_pvxlan_encap_rule encap;	/**< Encapsulation portion of the rule. */ |  | ||||||
| 	uint32_t tunnel_id;			/**< Tunnel ID. */ |  | ||||||
| 	uint16_t flags;				/**< Tunnel type flags. */ |  | ||||||
| 	int8_t rps; |  | ||||||
| 			/**< Receive packet steering number. Set -1 to let NSS firmware decide. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_tunnel_state_msg |  | ||||||
|  *	To enable/disable the tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_tunnel_state_msg { |  | ||||||
| 	uint32_t sibling_if_num;		/**< Sibling interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_mac_msg |  | ||||||
|  *	Proxy VxLAN MAC message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_mac_msg { |  | ||||||
| 	uint16_t mac_addr[3];			/**< MAC address. */ |  | ||||||
| 	uint16_t flags;				/**< Flags. */ |  | ||||||
| 	uint32_t vnet_id;			/**< Virtual net ID. */ |  | ||||||
| 	uint32_t tunnel_id;			/**< Tunnel ID. */ |  | ||||||
| 	uint16_t policy_id;			/**< Policy ID. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_msg |  | ||||||
|  *	Data for sending and receiving proxy VxLAN messages. |  | ||||||
|  */ |  | ||||||
| struct nss_pvxlan_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a proxy VxLAN common message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_pvxlan_stats_msg stats; |  | ||||||
| 				/**< Proxy VxLAN statistics. */ |  | ||||||
| 		struct nss_pvxlan_rule_msg rule_cfg; |  | ||||||
| 				/**< Rule information. */ |  | ||||||
| 		struct nss_pvxlan_rule_msg rule_uncfg; |  | ||||||
| 				/**< Rule information. */ |  | ||||||
| 		struct nss_pvxlan_tunnel_state_msg enable; |  | ||||||
| 				/**< Enable the tunnel. */ |  | ||||||
| 		struct nss_pvxlan_mac_msg mac_add; |  | ||||||
| 				/**< MAC rule add message. */ |  | ||||||
| 		struct nss_pvxlan_mac_msg mac_del; |  | ||||||
| 				/**< MAC rule delete message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving proxy VxLAN tunnel 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_pvxlan_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving proxy VxLAN tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pvxlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_pvxlan_msg_callback_t)(void *app_data, struct nss_pvxlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_tx_msg |  | ||||||
|  *	Sends proxy VxLAN tunnel messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_pvxlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pvxlan_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_pvxlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_tx_msg_sync |  | ||||||
|  *	Sends proxy VxLAN tunnel messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_pvxlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in,out] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pvxlan_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_pvxlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_tx_buf |  | ||||||
|  *	Sends a proxy VXLAN tunnel data buffer to the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] buf   Pointer to the data buffer. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_pvxlan_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *buf, uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_unregister |  | ||||||
|  *	Deregisters the proxy VxLAN tunnel interface from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern bool nss_pvxlan_unregister(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_register |  | ||||||
|  *	Registers the proxy VxLAN tunnel interface with the NSS for sending and |  | ||||||
|  *	receiving tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pvxlan_msg_callback_t \n |  | ||||||
|  * nss_pvxlan_buf_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num           NSS interface number. |  | ||||||
|  * @param[in] data_cb          Data callback for the proxy VXLAN tunnel data. |  | ||||||
|  * @param[in] notify_cb        Notify callback for the proxy VXLAN tunnel data. |  | ||||||
|  * @param[in] netdev           Pointer to the associated network device. |  | ||||||
|  * @param[in] features         Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_pvxlan_register(uint32_t if_num, nss_pvxlan_buf_callback_t data_cb, |  | ||||||
| 			nss_pvxlan_msg_callback_t notify_cb, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_get_ctx |  | ||||||
|  *	Gets the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_pvxlan_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_ifnum_with_core_id |  | ||||||
|  *	Gets the proxy VxLAN interface number with the core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int nss_pvxlan_ifnum_with_core_id(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_init |  | ||||||
|  *	Initializes the proxy VXLAN interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_pvxlan_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_pvxlan_msg_init |  | ||||||
|  *	Initializes a proxy VxLAN message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_pvxlan_msg \n |  | ||||||
|  * nss_pvxlan_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the 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_pvxlan_msg_init(struct nss_pvxlan_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 								nss_pvxlan_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_PVXLAN_H */ |  | ||||||
| @@ -1,193 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2018, 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_qrfs.h |  | ||||||
|  *	NSS QRFS interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_QRFS_H |  | ||||||
| #define __NSS_QRFS_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_qrfs_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_msg_types |  | ||||||
|  *	Message types for the NSS QRFS. |  | ||||||
|  */ |  | ||||||
| enum nss_qrfs_msg_types { |  | ||||||
| 	NSS_QRFS_MSG_FLOW_ADD, |  | ||||||
| 	NSS_QRFS_MSG_FLOW_DELETE, |  | ||||||
| 	NSS_QRFS_MSG_MAC_ADD, |  | ||||||
| 	NSS_QRFS_MSG_MAC_DELETE, |  | ||||||
| 	NSS_QRFS_MSG_STATS_SYNC, |  | ||||||
| 	NSS_QRFS_MSG_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_error_types |  | ||||||
|  *	Error types for the NSS QRFS. |  | ||||||
|  */ |  | ||||||
| enum nss_qrfs_error_types { |  | ||||||
| 	NSS_QRFS_ERROR_INVALID_MSG_TYPE, |  | ||||||
| 	NSS_QRFS_ERROR_INVALID_MSG_SIZE, |  | ||||||
| 	NSS_QRFS_ERROR_INVALID_IP_VERSION, |  | ||||||
| 	NSS_QRFS_ERROR_V4_FLOW_TABLE_FULL, |  | ||||||
| 	NSS_QRFS_ERROR_V6_FLOW_TABLE_FULL, |  | ||||||
| 	NSS_QRFS_ERROR_MAC_TABLE_FULL, |  | ||||||
| 	NSS_QRFS_ERROR_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_flow_rule_msg |  | ||||||
|  *	Information for the NSS QRFS flow rule message. |  | ||||||
|  */ |  | ||||||
| struct nss_qrfs_flow_rule_msg { |  | ||||||
| 	uint16_t src_port;		/**< Source port. */ |  | ||||||
| 	uint16_t dst_port;		/**< Destination port. */ |  | ||||||
| 	uint32_t ip_version;		/**< IPv4:4 IPv6:6. */ |  | ||||||
| 	uint32_t src_addr[4];		/**< Source IP address. */ |  | ||||||
| 	uint32_t dst_addr[4];		/**< Destination IP address. */ |  | ||||||
| 	uint16_t protocol;		/**< IP protocol. */ |  | ||||||
| 	uint16_t cpu;			/**< CPU core ID. */ |  | ||||||
| 	uint32_t if_num;		/**< Physical interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_mac_rule_msg |  | ||||||
|  *	Information for the NSS QRFS MAC rule message. |  | ||||||
|  */ |  | ||||||
| struct nss_qrfs_mac_rule_msg { |  | ||||||
| 	uint8_t mac[ETH_ALEN];	/**< Ethernet address. */ |  | ||||||
| 	uint16_t cpu;		/**< CPU core ID. */ |  | ||||||
| 	uint32_t if_num;	/**< Physical interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_stats_sync_msg |  | ||||||
|  *	Information for the NSS QRFS statistics message. |  | ||||||
|  */ |  | ||||||
| struct nss_qrfs_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common pnode statistics. */ |  | ||||||
| 	uint32_t invalid_offset;		/**< Packets with invalid offset. */ |  | ||||||
| 	uint32_t unknown_protocol;		/**< Protocol other than TCP, UDP. */ |  | ||||||
| 	uint32_t ipv4_flow_rule_hits;		/**< Number of IPv4 flow rule hits. */ |  | ||||||
| 	uint32_t ipv6_flow_rule_hits;		/**< Number of IPv6 flow rule hits. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_msg |  | ||||||
|  *	Data for sending and receiving NSS QRFS rule or statistics messages. |  | ||||||
|  */ |  | ||||||
| struct nss_qrfs_msg { |  | ||||||
| 	struct nss_cmn_msg cm;	/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a NSS QRFS rule or statistics message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_qrfs_flow_rule_msg flow_add;		/**< Add flow rule. */ |  | ||||||
| 		struct nss_qrfs_flow_rule_msg flow_delete;	/**< Delete flow rule. */ |  | ||||||
| 		struct nss_qrfs_mac_rule_msg mac_add;		/**< Add MAC rule. */ |  | ||||||
| 		struct nss_qrfs_mac_rule_msg mac_delete;	/**< Delete MAC rule. */ |  | ||||||
| 		struct nss_qrfs_stats_sync_msg stats_sync;	/**< Synchronize statistics. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving QRFS messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_qrfs_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_qrfs_msg_callback_t)(void *app_data, struct nss_qrfs_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_register_handler |  | ||||||
|  *	Registers the QRFS interface with the NSS for sending and receiving |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_qrfs_register_handler(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_notify_register |  | ||||||
|  *	Registers a notifier callback for QRFS messages with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_qrfs_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] core      NSS core number index to the notifier callback table. |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_qrfs_notify_register(int core, nss_qrfs_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_notify_unregister |  | ||||||
|  *	Deregisters a QRFS message notifier callback from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] core  NSS core number index to the notifier callback table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_qrfs_notify_unregister(int core); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_set_flow_rule |  | ||||||
|  *	Sends a QRFS message to the NSS core to set the flow rule. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] skb     Pointer to the SKB buffer. |  | ||||||
|  * @param[in] cpu     CPU number to set in the flow table. |  | ||||||
|  * @param[in] action  Action to perform on the flow table. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_qrfs_set_flow_rule(struct sk_buff *skb, uint32_t cpu, uint32_t action); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qrfs_init |  | ||||||
|  *	Initializes the QRFS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_qrfs_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_QRFS_H */ |  | ||||||
| @@ -1,522 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 2021, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_qvpn.h |  | ||||||
|  *	NSS QVPN interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_QVPN_H_ |  | ||||||
| #define _NSS_QVPN_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_qvpn_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #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_TAIL_SIZE_MAX 32	/**< Maximum size of QVPN tail. */ |  | ||||||
| #define NSS_QVPN_IV_SIZE_MAX 16			/**< Maximum size of IV supported. */ |  | ||||||
| #define NSS_QVPN_SESS_ID_SIZE_MAX 8		/**< Maximum size of session ID. */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * QVPN L3/L4 header flags. |  | ||||||
|  */ |  | ||||||
| #define NSS_QVPN_HDR_FLAG_IPV6   0x0001		/**< Outer L3 header is IPv6. */ |  | ||||||
| #define NSS_QVPN_HDR_FLAG_L4_UDP 0x0002		/**< L4 is UDP. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_msg_type |  | ||||||
|  *	Message types for QVPN NSS firmware. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_msg_type { |  | ||||||
| 	NSS_QVPN_MSG_TYPE_TUNNEL_CONFIGURE,	/**< Configure QVPN tunnel instance. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_TUNNEL_DECONFIGURE,	/**< Deconfigure QVPN tunnel instance. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_CRYPTO_KEY_ADD,	/**< Add a new crypto key. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_CRYPTO_KEY_DEL,	/**< Delete crypto key. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_CRYPTO_KEY_ACTIVATE,	/**< Activate crypto key. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_CRYPTO_KEY_DEACTIVATE,/**< Deactivate crypto key. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_SYNC_STATS,		/**< Statistics synchronization. */ |  | ||||||
| 	NSS_QVPN_MSG_TYPE_MAX			/**< Maximum QVPN message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_cmds_type |  | ||||||
|  *	Processing commands for QVPN. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_cmds_type { |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_NONE,		/**< Add VPN header to packet. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_ADD_VPN_HDR,		/**< Add VPN header to packet. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_REMOVE_VPN_HDR,	/**< Remove VPN header from packet. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_ADD_L3_L4_HDR,	/**< Add L3/L4 header to packet. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_REMOVE_L3_L4_HDR,	/**< Remove L3/L4 header from packet. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_ENCRYPT,		/**< Send packet for encryption. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_DECRYPT,		/**< Send packet for decryption. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_ANTI_REPLAY,		/**< Sequence number processing. */ |  | ||||||
| 	NSS_QVPN_CMDS_TYPE_MAX			/**< Maximum command supported. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_profile |  | ||||||
|  *	QVPN profiles supported. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_profile { |  | ||||||
| 	NSS_QVPN_PROFILE_NONE,		/**< No profile supported. */ |  | ||||||
| 	NSS_QVPN_PROFILE_CRYPTO_ENCAP,	/**< Encapsulation profile with crypto enabled. */ |  | ||||||
| 	NSS_QVPN_PROFILE_CRYPTO_DECAP,	/**< Decapsulation profile with crypto enabled. */ |  | ||||||
| 	NSS_QVPN_PROFILE_ENCAP,		/**< Encapsulation Profile with crypto disabled. */ |  | ||||||
| 	NSS_QVPN_PROFILE_DECAP,		/**< Decapsulation Profile with crypto disabled. */ |  | ||||||
| 	NSS_QVPN_PROFILE_MAX,		/**< Maximum profile. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_pkt_drop_event |  | ||||||
|  *	Packets drop statistics from QVPN node. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_pkt_drop_event { |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_NO_TAILROOM,		/**< Packet tail room not enough to copy HMAC to tail. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_NO_HEADROOM,		/**< Packet head room not enough to add QVPN headers. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_CBUF_ALLOC_FAIL,	/**< Received packet dropped as crypto buffer allocation failed. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_PBUF_ALLOC_FAIL,	/**< Received packet dropped as associated pbuf allocation failed. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_SYNC_ALLOC_FAIL,	/**< Pbuf dropped while doing statistics synchronization. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_PBUF_UNALIGN,		/**< Received packet dropped as unaligned buffer. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_CRYPTO_ENQ_FAIL,	/**< Received packet dropped as crypto enqueue failed. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_LINEAR_COPY_FAIL,	/**< Received packet dropped as scatter-gather linear copy failed. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_FWD_ENQ_FAIL,		/**< Received packet dropped as enqueue to next node failed. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_POST_CRYPTO_Q_FULL,	/**< Post crypto queue is full dropping pbuf. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_NODE_INACTIVE,		/**< Node is inactive dropping crypto processed packet. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_NON_CRYPTO_PB,		/**< Non crypto processed packet enqueued to post crypto queue. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_PAD_INVALID,		/**< Packet received with invalid padding. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_BLK_UNALIGNED,		/**< Received pbuf length is not cipher block aligned. */ |  | ||||||
| 	NSS_QVPN_PKT_DROP_EVENT_MAX			/**< End of packet drop event list. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_exception_event |  | ||||||
|  *	Exception events from QVPN node. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_exception_event { |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_RX_CONTROL_PKT,	/**< QVPN control packet received. */ |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_RX_TAIL_NOSUPP,	/**< Protocol with tail not supported. */ |  | ||||||
| 	QVPN_TUN_EXCEPTION_EVENT_RX__HR_INSUFF,		/**< Insufficient headroom. */ |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_RX_SESS_ID_INVALID,	/**< Invalid session ID. */ |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_RX_DATA_PKT,		/**< Data packets exceptioned to host. */ |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_RX_MALFORMED,		/**< Malformed packet received. */ |  | ||||||
| 	NSS_QVPN_EXCEPTION_EVENT_MAX			/**< End of exception event list. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_error_type |  | ||||||
|  *	Error types for the QVPN interface. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_error_type { |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_NONE,			/**< No error. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_UNKNOWN_MSG,		/**< Unknown message. */ |  | ||||||
| 	NSS_QVPN_ERROR_TUN_ALREADY_CONFIGURED,		/**< Tunnel already configured. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_IF_INVALID,			/**< Invalid interface. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_SIBLING_IF,			/**< Invalid sibling interface number. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_IV_SIZE_INVALID,		/**< Invalid IV size. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_HMAC_SIZE_INVALID,		/**< Invalid HMAC size. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_CRYPTO_BLK_SIZE_INVALID,	/**< Invalid crypto block size. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_SESSION_IDX_SIZE_INVALID,	/**< Invalid session index size. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_CMD_NOT_SUPPORTED,		/**< Command not supported. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_L4_PROTO_INVALID,		/**< L4 protocol encapsulation is not supported. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_SIBLING_IF_TYPE,		/**< Invalid sibling interface type. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_CMDS_COUNT_INVALID,		/**< Total number of commands is invalid. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_ENTRY_NOT_FOUND,		/**< Entry not found. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_ENTRY_NOT_ACTIVE,		/**< Entry not active. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_ENTRY_ALREADY_ACTIVE,	/**< Entry already active. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_CRYPTO_IDX_MISMATCH,	/**< Invalid crypto index. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_KI_ALLOC_FAIL,		/**< Key information allocation failure. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_PROFILE_INVALID,		/**< Invalid command profile. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_RX_TAIL_NOSUPP,		/**< VPN with tail not supported. */ |  | ||||||
| 	NSS_QVPN_ERROR_TYPE_MAX				/**< End of error list. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_iv_type |  | ||||||
|  *	IV type for generating and copying in packet. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_iv_type { |  | ||||||
| 	NSS_QVPN_IV_TYPE_NONE,		/**< No IV. */ |  | ||||||
| 	NSS_QVPN_IV_TYPE_STATIC,	/**< Use static IV configured. */ |  | ||||||
| 	NSS_QVPN_IV_TYPE_DYNAMIC_RAND,	/**< Generate IV randomly. */ |  | ||||||
| 	NSS_QVPN_IV_TYPE_MAX		/**< End of IV type list. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_pad_type |  | ||||||
|  *	Pad type for generating and copying in packet. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_pad_type { |  | ||||||
| 	NSS_QVPN_PAD_TYPE_NONE,		/**< No padding. */ |  | ||||||
| 	NSS_QVPN_PAD_TYPE_PKCS7,	/**< Generate pad buffer using PKCS7. */ |  | ||||||
| 	NSS_QVPN_PAD_TYPE_INC,		/**< Generate pad buffer monotonically increasing sequence. */ |  | ||||||
| 	NSS_QVPN_PAD_TYPE_MAX		/**< End of pad type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_anti_replay_alg |  | ||||||
|  *	Anti-replay algorithms supported. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_anti_replay_alg { |  | ||||||
| 	NSS_QVPN_ANTI_REPLAY_ALG_NONE,			/**< No anti-replay. */ |  | ||||||
| 	NSS_QVPN_ANTI_REPLAY_ALG_REPLAY_WINDOW,		/**< Generate pad buffer monotonically increasing sequence. */ |  | ||||||
| 	NSS_QVPN_ANTI_REPLAY_ALG_MAX			/**< End of anti-replay algorithm. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_crypto_mode |  | ||||||
|  *	Crypto modes supported. |  | ||||||
|  */ |  | ||||||
| enum nss_qvpn_crypto_mode { |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_NONE,		/**< NULL cipher and NULL authentication. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_ENC,		/**< Encryption only. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_DEC,		/**< Decryption only. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_AUTH,		/**< Authentication only. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_ENC_AUTH,		/**< Encryption and then authentication. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_AUTH_DEC,		/**< Authentication and then decryption. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_AUTH_ENC,		/**< Authentication and then encryption. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_DEC_AUTH,		/**< Decryption and then authentication. */ |  | ||||||
| 	NSS_QVPN_CRYPTO_MODE_MAX		/**< End of crypto mode. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_hdr_configure_msg |  | ||||||
|  *	QVPN header configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_hdr_configure_msg { |  | ||||||
| 	uint32_t src_ip[4];					/**< Source IP address. */ |  | ||||||
| 	uint32_t dst_ip[4];					/**< Destination IP address. */ |  | ||||||
| 	uint16_t src_port;					/**< Source port. */ |  | ||||||
| 	uint16_t dst_port;					/**< Destination port. */ |  | ||||||
| 	uint16_t hdr_flags;					/**< Header flags. */ |  | ||||||
| 	uint16_t seqnum_size;					/**< Size of sequence number. */ |  | ||||||
| 	uint16_t seqnum_offset;					/**< Sequence number offset. */ |  | ||||||
| 	uint16_t anti_replay_alg;				/**< Anti-replay algorithm. */ |  | ||||||
| 	uint16_t session_id_size;				/**< Session ID size. */ |  | ||||||
| 	uint16_t session_id_offset;				/**< Session ID offset. */ |  | ||||||
| 	uint16_t vpn_hdr_head_size;				/**< VPN header size. */ |  | ||||||
| 	uint16_t vpn_hdr_head_offset;				/**< VPN header offset. */ |  | ||||||
| 	uint16_t vpn_hdr_tail_size;				/**< Size of tail. */ |  | ||||||
| 	uint16_t res;						/**< Reserved for alignment. */ |  | ||||||
| 	uint8_t vpn_hdr_head[NSS_QVPN_VPN_HDR_HEAD_SIZE_MAX];	/**< Content of VPN header. */ |  | ||||||
| 	uint8_t vpn_hdr_tail[NSS_QVPN_VPN_HDR_TAIL_SIZE_MAX];	/**< VPN header tail content. */ |  | ||||||
| 	uint8_t hop_limit;					/**< TTL or hop limit. */ |  | ||||||
| 	uint8_t res1[3];					/**< Reserved for alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_crypto_configure_msg |  | ||||||
|  *	QVPN crypto configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_crypto_configure_msg { |  | ||||||
| 	uint16_t hmac_len;			/**< Length of HMAC to copy. */ |  | ||||||
| 	uint16_t hmac_offset;			/**< Offset to copy HMAC. */ |  | ||||||
| 	uint16_t auth_offset;			/**< Data offset to start authentication. */ |  | ||||||
| 	uint16_t cipher_op_offset;		/**< Start of cipher data. */ |  | ||||||
| 	uint16_t cipher_blk_size;		/**< Cipher block size. */ |  | ||||||
| 	uint16_t pad_type;			/**< Pad algorithm. */ |  | ||||||
| 	uint16_t crypto_mode;			/**< Crypto mode. */ |  | ||||||
| 	uint16_t iv_len;			/**< Length of IV. */ |  | ||||||
| 	uint16_t iv_offset;			/**< IV offset. */ |  | ||||||
| 	uint16_t iv_type;			/**< IV generation algorithm. */ |  | ||||||
| 	uint8_t iv_val[NSS_QVPN_IV_SIZE_MAX];	/**< IV to be used. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_crypto_key_add_msg |  | ||||||
|  *	QVPN key add message. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_crypto_key_add_msg { |  | ||||||
| 	uint32_t crypto_idx;				/**< Crypto session ID. */ |  | ||||||
| 	uint8_t session_id[NSS_QVPN_SESS_ID_SIZE_MAX];	/**< Session ID. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_crypto_key_del_msg |  | ||||||
|  *	Delete/Deactivate key message. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_crypto_key_del_msg { |  | ||||||
| 	uint32_t crypto_idx;	/**< Crypto index to delete/deactivate. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_tunnel_config_msg |  | ||||||
|  *	QVPN tunnel configure message. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_tunnel_config_msg { |  | ||||||
| 	uint32_t sibling_if;					/**< Sibling interface number. */ |  | ||||||
| 	uint16_t total_cmds;					/**< Total number of commands. */ |  | ||||||
| 	uint16_t cmd_profile;					/**< Command processing profile. */ |  | ||||||
| 	uint16_t cmd[NSS_QVPN_CMDS_MAX];			/**< Commands to execute. */ |  | ||||||
| 	struct nss_qvpn_crypto_key_add_msg crypto_key;		/**< Initial crypto key. */ |  | ||||||
| 	struct nss_qvpn_hdr_configure_msg hdr_cfg;		/**< VPN header configuration. */ |  | ||||||
| 	struct nss_qvpn_crypto_configure_msg crypto_cfg;	/**< Crypto configuration. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_crypto_key_activate_msg |  | ||||||
|  *	Activate key message. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_crypto_key_activate_msg { |  | ||||||
| 	uint32_t crypto_idx;					/**< Crypto session ID. */ |  | ||||||
| 	uint8_t vpn_hdr_head[NSS_QVPN_VPN_HDR_HEAD_SIZE_MAX];	/**< Content of VPN header. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_stats_sync_msg |  | ||||||
|  *	Message information for QVPN synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;				/**< Common node statistics. */ |  | ||||||
| 	uint32_t crypto_resp_error[NSS_CRYPTO_CMN_RESP_ERROR_MAX];	/**< Crypto response errors. */ |  | ||||||
| 	uint32_t pkt_drop_event[NSS_QVPN_PKT_DROP_EVENT_MAX];		/**< Packet drop 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 |  | ||||||
|  *	QVPN message structure for configuration and statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_qvpn_msg { |  | ||||||
| 	struct nss_cmn_msg cm;							/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/**< QVPN configuration messages. */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_qvpn_tunnel_config_msg tunnel_config;		/**< QVPN tunnel configure message. */ |  | ||||||
| 		struct nss_qvpn_crypto_key_add_msg key_add;			/**< Crypto key add message. */ |  | ||||||
| 		struct nss_qvpn_crypto_key_del_msg key_del;			/**< Crypto key delete message. */ |  | ||||||
| 		struct nss_qvpn_crypto_key_activate_msg key_activate;		/**< Crypto key active message. */ |  | ||||||
| 		struct nss_qvpn_stats_sync_msg stats;				/**< QVPN statistics synchronization message. */ |  | ||||||
| 	} msg;	/**< QVPN configuration message. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_tx_msg |  | ||||||
|  *	Sends an QVPN message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_qvpn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_qvpn_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_qvpn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_tx_msg_sync |  | ||||||
|  *	Sends an QVPN message to the NSS synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_qvpn_msg \n |  | ||||||
|  * nss_qvpn_msg_type \n |  | ||||||
|  * nss_qvpn_error_type |  | ||||||
|  * |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     nvm      Pointer to the message data. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     type     Type of message. |  | ||||||
|  * @param[in]     len      Size of the payload. |  | ||||||
|  * @param[in,out] resp     Response for the configuration. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_qvpn_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_qvpn_msg *nvm, |  | ||||||
| 		uint32_t if_num, enum nss_qvpn_msg_type type, uint16_t len, |  | ||||||
| 		enum nss_qvpn_error_type *resp); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_tx_buf |  | ||||||
|  *	Sends data packet for QVPN encapsulation/decapsulation. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] if_num   NSS interface number. |  | ||||||
|  * @param[in] skb      Pointer to sk_buff. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_qvpn_tx_buf(struct nss_ctx_instance *nss_ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_msg_init |  | ||||||
|  *	Initializes an QVPN message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_qvpn_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_qvpn_msg_init(struct nss_qvpn_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_get_context |  | ||||||
|  *	Gets the QVPN context used in nss_qvpn_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_qvpn_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback when QVPN data is received. |  | ||||||
|  * |  | ||||||
|  * @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_qvpn_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback to receive QVPN 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_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 |  | ||||||
|  *	Register to send/receive QVPN messages to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_qvpn_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num               NSS interface number. |  | ||||||
|  * @param[in] qvpn_data_callback   Callback for the data. |  | ||||||
|  * @param[in] qvpn_event_callback  Callback for receiving events. |  | ||||||
|  * @param[in] netdev               Pointer to the associated network device. |  | ||||||
|  * @param[in] features             Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx              Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_qvpn_register_if(uint32_t if_num, nss_qvpn_callback_t qvpn_data_callback, |  | ||||||
| 			nss_qvpn_msg_callback_t qvpn_event_callback, struct net_device *netdev, |  | ||||||
| 			uint32_t features, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_ifnum_with_core_id |  | ||||||
|  *	Gets the QVPN interface number with the core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| int nss_qvpn_ifnum_with_core_id(int if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_register_handler |  | ||||||
|  *	Registers the QVPN handler with the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_qvpn_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_qvpn_ifmap_get |  | ||||||
|  *	Returns active QVPN interfaces. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to interface map. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_QVPN_H_ */ |  | ||||||
| @@ -1,392 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for any |  | ||||||
|  * purpose with or without fee is hereby granted, provided that the above |  | ||||||
|  * copyright notice and this permission notice appear in all copies. |  | ||||||
|  * |  | ||||||
|  * 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_rmnet_rx.h |  | ||||||
|  *	NSS RMNET interface message Structure and APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_RMNET_RX_H |  | ||||||
| #define __NSS_RMNET_RX_H |  | ||||||
|  |  | ||||||
| #include "nss_if.h" |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_rmnet_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of DMA channel. |  | ||||||
|  */ |  | ||||||
| #define NSS_RMNET_RX_CHANNEL_MAX 12 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_dp_type |  | ||||||
|  *	Interface datapath types. NSS-to-host path will be seen by ECM for rules. |  | ||||||
|  */ |  | ||||||
| enum nss_rmnet_rx_dp_type { |  | ||||||
| 	NSS_RMNET_RX_DP_N2H,	/**< Interface on NSS-to-host path has zero value. */ |  | ||||||
| 	NSS_RMNET_RX_DP_H2N,	/**< Interface on host-to-NSS path has non-zero value. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_msg_types |  | ||||||
|  *	Message types for interface requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_rmnet_rx_msg_types { |  | ||||||
| 	NSS_RMNET_RX_TX_CONFIG_MSG = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 					/**< Configuration message. */ |  | ||||||
| 	NSS_RMNET_RX_STATS_SYNC_MSG,	/**< Statistic synchronization message. */ |  | ||||||
| 	NSS_RMNET_RX_MAX_MSG_TYPES,	/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_error_types |  | ||||||
|  *	Error types for the RMNET interface. |  | ||||||
|  */ |  | ||||||
| enum nss_rmnet_rx_error_types { |  | ||||||
| 	NSS_RMNET_RX_SUCCESS,				/**< No error. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_MSG_UNKNOWN,		/**< Unknown message type. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_ALREADY_CONFIGURED,	/**< Tunnel is already configured. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_SIBLING_NOTFOUND,	/**< Sibling interface is not found. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_NEXTHOP_NOTFOUND,	/**< Next hop is not found. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_SIBLING_MISMATCH,	/**< Sibling interface type mismatches. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_DMA_CHANNEL_FAIL,	/**< DMA Channel allocation failed. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_RMNET_INVALID,		/**< Interface type is invalid. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_TYPE_SHAPER_INVALID,		/**< Shaper is invalid. */ |  | ||||||
| 	NSS_RMNET_RX_REG_FAILURE,			/**< Registration failed. */ |  | ||||||
| 	NSS_RMNET_RX_ALLOC_FAILURE,			/**< Memory allocation failed. */ |  | ||||||
| 	NSS_RMNET_RX_ERROR_MAX,				/**< Maximum error type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_pvt |  | ||||||
|  *	Private data information for the interface. |  | ||||||
|  */ |  | ||||||
| struct nss_rmnet_rx_pvt { |  | ||||||
| 	struct semaphore sem; |  | ||||||
| 			/**< Semaphore to ensure that only one instance of a message is sent to the NSS. */ |  | ||||||
| 	struct completion complete; |  | ||||||
| 			/**< Waits for message completion or time out. */ |  | ||||||
| 	int response;		/**< Message process response from the NSS firmware. */ |  | ||||||
| 	int sem_init_done;	/**< Semaphore initialization is done. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_config_msg |  | ||||||
|  *	Message information for configuring the interface. |  | ||||||
|  */ |  | ||||||
| struct nss_rmnet_rx_config_msg { |  | ||||||
| 	uint32_t flags;			/**< Interface flags. */ |  | ||||||
| 	uint32_t sibling;		/**< Sibling interface number. */ |  | ||||||
| 	uint32_t nexthop;		/**< Next hop interface number. */ |  | ||||||
| 	uint32_t no_channel;		/**< Number of channels. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_stats |  | ||||||
|  *	Interface statistics received from the NSS. |  | ||||||
|  */ |  | ||||||
| struct nss_rmnet_rx_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats; |  | ||||||
| 					/**< Common statistics. */ |  | ||||||
| 	uint32_t enqueue_failed;	/**< Enqueue to next node is failed. */ |  | ||||||
| 	uint32_t no_avail_channel;	/**< No available DMA channel. */ |  | ||||||
| 	uint32_t num_linear_pbuf;	/**< Number of linear pbufs. */ |  | ||||||
| 	uint32_t no_pbuf_to_linear;	/**< No pbuf to linearize. */ |  | ||||||
| 	uint32_t no_enough_room;	/**< Not enough headroom to linearize the pbuf. */ |  | ||||||
| 	uint32_t using_channel[NSS_RMNET_RX_CHANNEL_MAX]; |  | ||||||
| 					/**< How many times a channel is used. */ |  | ||||||
| 	uint32_t dma_failed;		/**< DMA copy call failed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_msg |  | ||||||
|  *	Data for sending and receiving interface messages. |  | ||||||
|  */ |  | ||||||
| struct nss_rmnet_rx_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an RMNET interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_rmnet_rx_config_msg if_config; |  | ||||||
| 				/**< Rule for creating an RMNET interface. */ |  | ||||||
| 		struct nss_rmnet_rx_stats stats; |  | ||||||
| 				/**< RMNET interface statistics. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback to transmit interface data received from NSS |  | ||||||
|  * to the transmit path of the RMNET interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] skb     Pointer to the data socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_rmnet_rx_xmit_callback_t)(struct net_device *netdev, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for interface 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_rmnet_rx_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for interface 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_rmnet_rx_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_handle |  | ||||||
|  *	Context information for NSS communication. |  | ||||||
|  */ |  | ||||||
| struct nss_rmnet_rx_handle { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx;	/**< NSS context. */ |  | ||||||
| 	int32_t if_num_n2h;			/**< Redirect interface number on NSS-to-host path. */ |  | ||||||
| 	int32_t if_num_h2n;			/**< Redirect interface number on host-to-NSS path. */ |  | ||||||
| 	struct net_device *ndev;		/**< Associated network device. */ |  | ||||||
| 	struct nss_rmnet_rx_pvt *pvt;		/**< Private data structure. */ |  | ||||||
| 	uint64_t *stats_n2h;			/**< RMNET interface statistics from NSS-to-host. */ |  | ||||||
| 	uint64_t *stats_h2n;			/**< RMNET interface statistics from host-to-NSS. */ |  | ||||||
| 	atomic_t refcnt;			/**< Reference count. */ |  | ||||||
| 	nss_rmnet_rx_msg_callback_t cb;		/**< Message callback. */ |  | ||||||
| 	void *app_data;		/**< Application data to be passed to the callback. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_destroy_sync |  | ||||||
|  *	Destroys the RMNET interface synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the RMNET interface handle (provided during |  | ||||||
|  *                        dynamic interface allocation). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously created. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_rmnet_rx_destroy_sync(struct nss_rmnet_rx_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_create_sync_nexthop |  | ||||||
|  *	Creates an RMNET interface synchronously with specified nexthops. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev       Pointer to the associated network device. |  | ||||||
|  * @param[in] nexthop_n2h  Nexthop interface number of NSS-to-host dynamic interface. |  | ||||||
|  * @param[in] nexthop_h2n  Nexthop interface number of host-to-NSS dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 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 |  | ||||||
|  *	Forwards RMNET interface packets to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the RMNET interface handle (provided during |  | ||||||
|  *                        registration). |  | ||||||
|  * @param[in]    skb     Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_rmnet_rx_tx_buf(struct nss_rmnet_rx_handle *handle, |  | ||||||
| 						struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_tx_msg |  | ||||||
|  *	Sends a message to the RMNET interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_rmnet_rx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context (provided during registration). |  | ||||||
|  * @param[in] nvim     Pointer to the RMNET interface message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Command Tx status. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_rmnet_rx_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_rmnet_rx_msg *nvim); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_xmit_callback_unregister |  | ||||||
|  *	Deregisters the transmit callback from the RMNET interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the RMNET interface handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_rmnet_rx_xmit_callback_unregister(struct nss_rmnet_rx_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_xmit_callback_register |  | ||||||
|  *	Registers a transmit callback to an RMNET interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle \n |  | ||||||
|  * nss_rmnet_rx_xmit_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle        Pointer to the RMNET interface handle (provided during |  | ||||||
|  *                              dynamic interface allocation). |  | ||||||
|  * @param[in]    cb             Callback handler for RMNET data packets. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_rmnet_rx_xmit_callback_register(struct nss_rmnet_rx_handle *handle, |  | ||||||
| 				nss_rmnet_rx_xmit_callback_t cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_unregister |  | ||||||
|  *	Deregisters an RMNET interface from the NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the RMNET interface handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_rmnet_rx_unregister(struct nss_rmnet_rx_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_register |  | ||||||
|  *	Registers an RMNET Interface with NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle \n |  | ||||||
|  * nss_rmnet_rx_data_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle        Pointer to the RMNET interface handle (provided during |  | ||||||
|  *                              dynamic interface allocation). |  | ||||||
|  * @param[in]    data_callback  Callback handler for RMNET data packets. |  | ||||||
|  * @param[in]    netdev         Pointer to the associated network device. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern void nss_rmnet_rx_register(struct nss_rmnet_rx_handle *handle, |  | ||||||
| 					nss_rmnet_rx_data_callback_t data_callback, |  | ||||||
| 					struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_get_ifnum_with_coreid |  | ||||||
|  *	Returns the interface number with the core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_rmnet_rx_get_ifnum_with_core_id(int32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_get_ifnum |  | ||||||
|  *	Returns the interface number with appending core ID. |  | ||||||
|  * |  | ||||||
|  * @param[in] dev Net device |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Interface number with the core ID. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_rmnet_rx_get_ifnum(struct net_device *dev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_get_interface_num |  | ||||||
|  *	Returns the RMNET interface number associated with the handle. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_rmnet_rx_handle |  | ||||||
|  * |  | ||||||
|  * @param[in] handle  Pointer to the RMNET interface handle (provided during |  | ||||||
| 		      dynamic interface allocation). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * RMNET interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_rmnet_rx_get_interface_num(struct nss_rmnet_rx_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rmnet_rx_get_context |  | ||||||
|  *	Gets the RMNET interface context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_rmnet_rx_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_RMNET_RX_H */ |  | ||||||
| @@ -1,55 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2013-2018, 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_rps.h |  | ||||||
|  *	RPS related definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_RPS_H |  | ||||||
| #define __NSS_RPS_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_rps_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rps_register_sysctl |  | ||||||
|  *	Registers the RPS sysctl entries to the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_rps_register_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_rps_unregister_sysctl |  | ||||||
|  *	Deregisters the RPS sysctl entries from the sysctl tree. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The system control must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_rps_unregister_sysctl(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_RPS_H */ |  | ||||||
| @@ -1,901 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014, 2017-2018 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_shaper.h |  | ||||||
|  *	NSS Shaper definitions |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_SHAPER_H |  | ||||||
| #define __NSS_SHAPER_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_shaper_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_types |  | ||||||
|  *	Types of shaper nodes that are exported to the HLOS. |  | ||||||
|   */ |  | ||||||
| enum nss_shaper_node_types { |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_CODEL = 1, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_PRIO = 3, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_FIFO = 4, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_TBL = 5, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_BF = 6, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_BF_GROUP = 7, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_WRR = 9, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_WRR_GROUP = 10, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_HTB = 11, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_HTB_GROUP = 12, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_WRED = 13, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_PPE_SN = 14, |  | ||||||
| 	NSS_SHAPER_NODE_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_shaper_node_types nss_shaper_node_type_t; |  | ||||||
| 		/**< Types of shaper nodes that are exported to the HLOS. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_types |  | ||||||
|  *	Types of shaper configuration messages. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_config_types { |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_ALLOC_SHAPER_NODE, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_FREE_SHAPER_NODE, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SET_DEFAULT, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SET_ROOT, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_BASIC_STATS_GET, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_HYBRID_MODE_ENABLE, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_HYBRID_MODE_DISABLE, |  | ||||||
| 	NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_MEM_REQ, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_shaper_config_types nss_shaper_config_type_t; |  | ||||||
| 		/**< Types of shaper configuration messages. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_response_types |  | ||||||
|  *	Types of shaper configuration responses. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_response_types { |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_SUCCESS, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_NO_SHAPER_NODE, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_NO_SHAPER_NODES, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_OLD, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_UNRECOGNISED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_BAD_DEFAULT_CHOICE, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_DUPLICATE_QOS_TAG, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_TBL_CIR_RATE_AND_BURST_REQUIRED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_TBL_CIR_BURST_LESS_THAN_MTU, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CODEL_ALL_PARAMS_REQUIRED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_BF_GROUP_RATE_AND_BURST_REQUIRED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_BF_GROUP_BURST_LESS_THAN_MTU, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_NOT_BF_GROUP, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_WRR_GROUP_INVALID_QUANTUM, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_NOT_WRR_GROUP, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_WRR_INVALID_OPERATION_MODE, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_HTB_GROUP_BURST_LESS_THAN_MTU, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_HTB_GROUP_PRIORITY_OUT_OF_RANGE, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILDREN_BELONG_TO_MIXED_TYPES, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_ALREADY_PRESENT, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_MISMATCH, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_UNSUPPORTED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CHILD_NOT_FOUND, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_ATTACH_FAIL, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_WRED_WEIGHT_MODE_INVALID, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_UCAST_BASE_OFFSET_INVALID, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_MCAST_BASE_OFFSET_INVALID, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_UCAST_QUEUE_ALLOC_FAILED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_MCAST_QUEUE_ALLOC_FAILED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_INVALID_LIMIT, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_UCAST_QUEUE_CHANGED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_PPE_SN_MCAST_QUEUE_CHANGED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CODEL_FQ_MEM_INSUFFICIENT, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CODEL_FQ_COUNT_CHANGE_NOT_ALLOWED, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CODEL_FQ_COUNT_INVALID, |  | ||||||
| 	NSS_SHAPER_RESPONSE_TYPE_CODEL_MODE_CHANGE_NOT_ALLOWED, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_shaper_response_types nss_shaper_response_type_t; |  | ||||||
| 		/**< Types of shaper configuration responses. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_alloc_shaper_node |  | ||||||
|  *	Message information for allocating a shaper node for a NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_alloc_shaper_node { |  | ||||||
| 	nss_shaper_node_type_t node_type;	/**< Type of shaper node. */ |  | ||||||
| 	uint32_t qos_tag;			/**< QoS tag of the node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_free_shaper_node |  | ||||||
|  *	Message information for freeing a shaper node from a NSS interface. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_free_shaper_node { |  | ||||||
| 	uint32_t qos_tag;	/**< QoS tag of the node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_set_root_node |  | ||||||
|  *	Message information for setting a shaper node as the root. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_set_root_node { |  | ||||||
| 	uint32_t qos_tag;	/**< QoS tag of the node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_set_default_node |  | ||||||
|  *	Message information for setting a shaper node as the default node for enqueueing. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_set_default_node { |  | ||||||
| 	uint32_t qos_tag;	/**< QoS tag of the node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_set_hybrid_mode |  | ||||||
|  *	Message information for setting a shaper to operate in hybrid mode. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_set_hybrid_mode { |  | ||||||
| 	uint32_t offset;	/**< Queue offset for packets sent to the hardware. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_prio_attach |  | ||||||
|  *	Message information for attaching a shaper node to a PRIO shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_prio_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| 	uint32_t priority;	/**< Priority of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_prio_detach |  | ||||||
|  *	Message information for detaching a shaper node from a PRIO shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_prio_detach { |  | ||||||
| 	uint32_t priority;	/**< Priority of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_codel_alg_param |  | ||||||
|  *	Message information for configuring a CoDel algorithm. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_codel_alg_param { |  | ||||||
| 	uint16_t interval;	/**< Buffer time to smooth a state transition. */ |  | ||||||
| 	uint16_t target;	/**< Acceptable delay associated with a queue. */ |  | ||||||
| 	uint16_t mtu;		/**< MTU for the associated interface. */ |  | ||||||
| 	uint16_t reserved;	/**< Alignment padding. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_codel_param |  | ||||||
|  *	Message information for configuring a CoDel shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_codel_param { |  | ||||||
| 	int32_t qlen_max;	/**< Maximum number of packets that can be enqueued. */ |  | ||||||
| 	struct nss_shaper_config_codel_alg_param cap; |  | ||||||
| 				/**< Configuration for the CoDel algorithm. */ |  | ||||||
| 	uint32_t flows;		/**< Number of flow hash buckets. */ |  | ||||||
| 	uint32_t flows_mem;	/**< Host allocated memory for flow queues. */ |  | ||||||
| 	uint32_t flows_mem_sz;	/**< Memory size allocated for flow queues. */ |  | ||||||
| 	uint32_t quantum;	/**< Quantum (in bytes) to round-robin the flow buckets. */ |  | ||||||
| 	uint32_t ecn;		/**< 0 - ECN disabled, 1 - ECN enabled. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_codel_mem_req |  | ||||||
|  *	Message to get CoDel memory requirement per flow queue (needed for fq_codel). |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_codel_mem_req { |  | ||||||
| 	uint32_t mem_req;	/**< Memory needed per flow queue (in bytes). */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_rate_param |  | ||||||
|  *	Message information for configuring the rate limiter algorithm. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_rate_param { |  | ||||||
| 	uint32_t rate; |  | ||||||
| 			/**< Allowed traffic rate measured in bytes per second. */ |  | ||||||
| 	uint32_t burst; |  | ||||||
| 			/**< Maximum bytes that can be sent in a burst. */ |  | ||||||
| 	uint32_t max_size; |  | ||||||
| 			/**< Maximum size of the supported packets (in bytes). */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Specifies whether the rate limiter will be bypassed (short circuited). |  | ||||||
| 	 */ |  | ||||||
| 	bool short_circuit; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_configure_tbl_attach |  | ||||||
|  *	Message information for attaching a shaper node to a TBL shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_tbl_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_configure_tbl_param |  | ||||||
|  *	Message information for detaching a shaper node from a TBL shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_tbl_param { |  | ||||||
| 	struct nss_shaper_config_rate_param lap_cir; |  | ||||||
| 		/**< Configuration parameters for the committed information rate. */ |  | ||||||
| 	struct nss_shaper_config_rate_param lap_pir; |  | ||||||
| 		/**< Configuration parameters for the peak information rate. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_bf_attach |  | ||||||
|  *	Message information for attaching a shaper node to a BF shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_bf_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_bf_detach |  | ||||||
|  *	Message information for detaching a shaper node from a BF shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_bf_detach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_bf_group_attach |  | ||||||
|  *	Message information for attaching a shaper node to a BF group shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_bf_group_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_bf_group_param |  | ||||||
|  *	Configuration parameters for a BF group shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_bf_group_param { |  | ||||||
| 	uint32_t quantum; |  | ||||||
| 		/**< Smallest increment value for the DRRs. */ |  | ||||||
| 	struct nss_shaper_config_rate_param lap; |  | ||||||
| 		/**< Configuration of the rate control algorithm. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_fifo_limit_set |  | ||||||
|  *	Drop modes for the FIFO shaper in the NSS interface. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_config_fifo_drop_modes { |  | ||||||
| 	NSS_SHAPER_FIFO_DROP_MODE_HEAD = 0, |  | ||||||
| 	NSS_SHAPER_FIFO_DROP_MODE_TAIL, |  | ||||||
| 	NSS_SHAPER_FIFO_DROP_MODES, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_shaper_config_fifo_drop_modes nss_shaper_config_fifo_drop_mode_t; |  | ||||||
| 		/**< Drop modes for the FIFO shaper in the NSS interface. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_fifo_param |  | ||||||
|  *	Message information for configuring a FIFO shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_fifo_param { |  | ||||||
| 	uint32_t limit;		/**< Queue limit in packets. */ |  | ||||||
| 	nss_shaper_config_fifo_drop_mode_t drop_mode; |  | ||||||
| 				/**< FIFO drop mode when a queue is full. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wred_weight_modes |  | ||||||
|  *	Supported weight modes. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_config_wred_weight_modes { |  | ||||||
| 	NSS_SHAPER_WRED_WEIGHT_MODE_DSCP = 0, |  | ||||||
| 	NSS_SHAPER_WRED_WEIGHT_MODES, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| typedef enum nss_shaper_config_wred_weight_modes nss_shaper_config_wred_weight_mode_t; |  | ||||||
| 		/**< Supported weight modes. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_red_alg_param |  | ||||||
|  *	Message information for configuring the RED algorithm. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_red_alg_param { |  | ||||||
| 	uint32_t min;			/**< Minimum size of the queue. */ |  | ||||||
| 	uint32_t max;			/**< Maximum size of the queue. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Probability of dropped packets when the average queue size (qlen_avg) = max. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t probability; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Exponential weight factor to calculate the average queue size. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t exp_weight_factor; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wred_param |  | ||||||
|  *	Message information for configuring the WRED algorithm. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wred_param { |  | ||||||
| 	uint32_t limit;			/**< Queue limit in bytes. */ |  | ||||||
| 	nss_shaper_config_wred_weight_mode_t weight_mode; |  | ||||||
| 					/**< WRED weight mode. */ |  | ||||||
| 	uint32_t traffic_classes;	/**< Number of traffic classes (drop probability). */ |  | ||||||
| 	uint32_t def_traffic_class;	/**< Default traffic class used when there is no match. */ |  | ||||||
| 	uint32_t traffic_id;		/**< Traffic class to configure. */ |  | ||||||
| 	uint32_t weight_mode_value;	/**< Value to match the selected header field against. */ |  | ||||||
| 	struct nss_shaper_red_alg_param rap; |  | ||||||
| 					/**< Configuration parameters for the RED algorithm. */ |  | ||||||
| 	uint8_t ecn;			/**< Mark an ECN bit or drop packet. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wrr_attach |  | ||||||
|  *	Message information for attaching a shaper node to a WRR shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wrr_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wrr_detach |  | ||||||
|  *	Message information for detaching a child node from a WRR shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wrr_detach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wrr_group_attach |  | ||||||
|  *	Message information for attaching a shaper node to a WRR group. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wrr_group_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_wrr_operation_modes |  | ||||||
|  *	Modes of WRR operation. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_wrr_operation_modes { |  | ||||||
| 	NSS_SHAPER_WRR_MODE_ROUND_ROBIN = 0, |  | ||||||
| 	NSS_SHAPER_WRR_MODE_FAIR_QUEUEING = 1, |  | ||||||
| 	NSS_SHAPER_WRR_MODE_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wrr_param |  | ||||||
|  *	Message information for configuring the operation mode of a WRR shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wrr_param { |  | ||||||
| 	uint32_t operation_mode;	/**< Mode in which to operate. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_wrr_group_param |  | ||||||
|  *	Message information for configuring a quantum value of a WRR group shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_wrr_group_param { |  | ||||||
| 	uint32_t quantum;	/**< Smallest increment value for the DRRs. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_htb_attach |  | ||||||
|  *	Message information for attaching a shaper node to an HTB shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_htb_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_htb_group_attach |  | ||||||
|  *	Message information for attaching a shaper node to an HTB group. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_htb_group_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_htb_group_detach |  | ||||||
|  *	Message information for detaching a shaper node from an HTB group. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_htb_group_detach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_htb_group_param |  | ||||||
|  *	Message information for configuring an HTB group shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_htb_group_param { |  | ||||||
| 	uint32_t quantum;	/**< Smallest increment value for the DRRs. */ |  | ||||||
| 	uint32_t priority;	/**< Value of the priority for this group. */ |  | ||||||
| 	uint32_t overhead;	/**< Overhead in bytes to be added per packet. */ |  | ||||||
| 	struct nss_shaper_config_rate_param rate_police; |  | ||||||
| 		/**< Configuration parameters for the policing rate. */ |  | ||||||
| 	struct nss_shaper_config_rate_param rate_ceil; |  | ||||||
| 		/**< Configuration parameters for the ceiling rate. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_ppe_sn_attach |  | ||||||
|  *	Message information for attaching a shaper node to a PPE shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_ppe_sn_attach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_ppe_sn_detach |  | ||||||
|  *	Message information for detaching a shaper node from a PPE shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_ppe_sn_detach { |  | ||||||
| 	uint32_t child_qos_tag;	/**< QoS tag of the child shaper node. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_ppe_sn_type |  | ||||||
|  *	Types of PPE shaper nodes. |  | ||||||
|  */ |  | ||||||
| enum nss_shaper_config_ppe_sn_type { |  | ||||||
| 	/* |  | ||||||
| 	 * Scheduler types. |  | ||||||
| 	 */ |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_HTB, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_HTB_GROUP, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_TBL, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_WRR, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_WRR_GROUP, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_PRIO, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_SCH_MAX = 0xFF, |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Queue types. |  | ||||||
| 	 */ |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_FIFO, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_RED, |  | ||||||
| 	NSS_SHAPER_CONFIG_PPE_SN_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_ppe_sn_param |  | ||||||
|  *	Message information for configuring a PPE shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_config_ppe_sn_param { |  | ||||||
| 	enum nss_shaper_config_ppe_sn_type type; |  | ||||||
| 				/**< Type of PPE shaper node. */ |  | ||||||
| 	uint16_t ucast_base;	/**< Resource ID of the base hardware for unicast queue. */ |  | ||||||
| 	uint16_t ucast_offset;	/**< Offset from the base resource ID for unicast queue. */ |  | ||||||
| 	uint16_t mcast_base;	/**< Resource ID of the base hardware for multicast queue. */ |  | ||||||
| 	uint16_t mcast_offset;	/**< Offset from the base resource ID for multicast queue. */ |  | ||||||
| 	uint8_t port;		/**< PPE port on which this shaper node is configured. */ |  | ||||||
| 	uint8_t reserved;	/**< Reserved for padding. */ |  | ||||||
| 	uint16_t limit;		/**< Limit of the queue. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_shaper_node_config |  | ||||||
|  *	Configuration messages for all types of shaper nodes. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_config { |  | ||||||
| 	uint32_t qos_tag;	/**< ID of the shaper node to be configured. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Configuration messages for all types of shaper nodes. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_shaper_config_prio_attach prio_attach; |  | ||||||
| 			/**< Attach a shaper node to a PRIO shaper node. */ |  | ||||||
| 		struct nss_shaper_config_prio_detach prio_detach; |  | ||||||
| 			/**< Detach a shaper node from a PRIO shaper node. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_codel_param codel_param; |  | ||||||
| 			/**< Configure a CoDel shaper node. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_codel_mem_req codel_mem_req; |  | ||||||
| 			/**< Get CoDel memory requirement. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_tbl_attach tbl_attach; |  | ||||||
| 			/**< Attach a shaper node to a TBL shaper node. */ |  | ||||||
| 		struct nss_shaper_config_tbl_param tbl_param; |  | ||||||
| 			/**< Configuration parameters for a TBL shaper node. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_bf_attach bf_attach; |  | ||||||
| 			/**< Attach a shaper node to a BF shaper node. */ |  | ||||||
| 		struct nss_shaper_config_bf_detach bf_detach; |  | ||||||
| 			/**< Detach a child shaper node from BF shaper node. */ |  | ||||||
| 		struct nss_shaper_config_bf_group_attach bf_group_attach; |  | ||||||
| 			/**< Attach a shaper node to a BF group shaper node. */ |  | ||||||
| 		struct nss_shaper_config_bf_group_param bf_group_param; |  | ||||||
| 			/**< Configure parameters for a BF group shaper node. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_fifo_param fifo_param; |  | ||||||
| 			/**< Configure a FIFO shaper node. */ |  | ||||||
|  |  | ||||||
| 		struct nss_shaper_config_wrr_attach wrr_attach; |  | ||||||
| 			/**< Attach a shaper node to a WRR shaper node. */ |  | ||||||
| 		struct nss_shaper_config_wrr_detach wrr_detach; |  | ||||||
| 			/**< Detach a shaper node from a WRR shaper node. */ |  | ||||||
| 		struct nss_shaper_config_wrr_param wrr_param; |  | ||||||
| 			/**< Configuration parameters for a WRR shaper node . */ |  | ||||||
| 		struct nss_shaper_config_wrr_group_attach wrr_group_attach; |  | ||||||
| 			/**< Attach a shaper node to a WRR group shaper node. */ |  | ||||||
| 		struct nss_shaper_config_wrr_group_param wrr_group_param; |  | ||||||
| 			/**< Configure a WRR group shaper node with a quantum value. */ |  | ||||||
| 		struct nss_shaper_config_htb_attach htb_attach; |  | ||||||
| 			/**< Attach a shaper node to an HTB shaper node. */ |  | ||||||
| 		struct nss_shaper_config_htb_group_attach htb_group_attach; |  | ||||||
| 			/**< Attach a shaper node to an HTB group shaper node. */ |  | ||||||
| 		struct nss_shaper_config_htb_group_detach htb_group_detach; |  | ||||||
| 			/**< Detach a shaper node from an HTB group shaper node. */ |  | ||||||
| 		struct nss_shaper_config_htb_group_param htb_group_param; |  | ||||||
| 			/**< Configuration parameters for an HTB group shaper node. */ |  | ||||||
| 		struct nss_shaper_config_wred_param wred_param; |  | ||||||
| 			/**< Configuration parameters for a WRED shaper node. */ |  | ||||||
| 		struct nss_shaper_config_ppe_sn_attach ppe_sn_attach; |  | ||||||
| 			/**< Attach a shaper node to a PPE shaper node. */ |  | ||||||
| 		struct nss_shaper_config_ppe_sn_detach ppe_sn_detach; |  | ||||||
| 			/**< Detach a shaper node from a PPE shaper node. */ |  | ||||||
| 		struct nss_shaper_config_ppe_sn_param ppe_sn_param; |  | ||||||
| 			/**< Configuration parameters for a PPE shaper node. */ |  | ||||||
| 	} snc;	/**< Types of shaper node configuration messages. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_codel_fq_stats_delta |  | ||||||
|  *	CoDel flow queue mode statistics sent as deltas. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_codel_fq_stats_delta { |  | ||||||
| 	uint32_t new_flow_cnt;		/**< Total number of new flows seen. */ |  | ||||||
| 	uint32_t ecn_mark_cnt;		/**< Number of packets marked with ECN. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_codel_fq_stats |  | ||||||
|  *      CoDel flow queue mode statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_codel_fq_stats { |  | ||||||
| 	struct nss_shaper_node_codel_fq_stats_delta delta; |  | ||||||
| 					/**< CoDel flow queue statistics sent as deltas. */ |  | ||||||
| 	uint32_t new_flows_len;		/**< Current number of new flows. */ |  | ||||||
| 	uint32_t old_flows_len;		/**< Current number of old flows. */ |  | ||||||
| 	uint32_t maxpacket;		/**< Largest packet seen so far. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_codel_sq_stats |  | ||||||
|  *      CoDel single queue mode statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_codel_sq_stats { |  | ||||||
| 	/** |  | ||||||
| 	 * Maximum amount of time (in milliseconds) that a packet was in this shaper |  | ||||||
| 	 * node before being dequeued. |  | ||||||
| 	 */ |  | ||||||
|         uint32_t packet_latency_peak_msec_dequeued; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Maximum amount of time (in milliseconds) that a packet was in this shaper |  | ||||||
| 	 * node before being dropped. |  | ||||||
| 	 */ |  | ||||||
|         uint32_t packet_latency_peak_msec_dropped; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_codel_stats |  | ||||||
|  *      CoDel shaper node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_codel_stats { |  | ||||||
|         struct nss_shaper_node_codel_sq_stats sq;   /**< Single queue mode statistics. */ |  | ||||||
|         struct nss_shaper_node_codel_fq_stats fq;   /**< Flow queue mode statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_stats_delta |  | ||||||
|  *	Statistics that are sent as deltas. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_stats_delta { |  | ||||||
| 	uint32_t enqueued_bytes;	/**< Bytes enqueued successfully. */ |  | ||||||
| 	uint32_t enqueued_packets;	/**< Packets enqueued successfully. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Bytes dropped during an enqueue operation because of node limits. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t enqueued_bytes_dropped; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Packets dropped during an enqueue operation because of node limits. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t enqueued_packets_dropped; |  | ||||||
|  |  | ||||||
| 	uint32_t dequeued_bytes; |  | ||||||
| 			/**< Bytes dequeued successfully from a shaper node. */ |  | ||||||
| 	uint32_t dequeued_packets; |  | ||||||
| 			/**< Packets dequeued successfully from a shaper node. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Bytes dropped by this node during dequeuing (some nodes drop packets during |  | ||||||
| 	 * dequeuing rather than enqueuing). |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t dequeued_bytes_dropped; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Packets dropped by this node during dequeuing (some nodes drop packets during |  | ||||||
| 	 * dequeuing rather than enqueuing). |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t dequeued_packets_dropped; |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Number of times any queue limit was overrun, leading to packet drops. |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t queue_overrun; |  | ||||||
|  |  | ||||||
| 	uint32_t unused[4];		/**< Reserved for future statistics expansion. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_stats |  | ||||||
|  *	Common shaper node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_stats { |  | ||||||
| 	uint32_t qlen_bytes;	/**< Total size of packets waiting in the queue. */ |  | ||||||
| 	uint32_t qlen_packets;	/**< Number of packets waiting in the queue. */ |  | ||||||
| 	uint32_t unused[4];	/**< Reserved for future statistics expansion. */ |  | ||||||
| 	struct nss_shaper_node_stats_delta delta; |  | ||||||
| 				/**< Statistics that are sent as deltas. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_stats_response |  | ||||||
|  *	Statistics response for shaper nodes. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_stats_response { |  | ||||||
| 	struct nss_shaper_node_stats sn_stats;	/**< Common shaper node statistics. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * All shaper nodes that need to maintain unique statistics need |  | ||||||
| 	 * to add their statistics structure here. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_shaper_node_codel_stats codel; |  | ||||||
| 						/**< CoDel specific statistics. */ |  | ||||||
| 	} per_sn_stats;				/**< Shaper specific statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_node_stats_get |  | ||||||
|  *	Statistics of a shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_node_stats_get { |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Request |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t qos_tag;	/**< QoS tag of the shaper node. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Response |  | ||||||
| 	 */ |  | ||||||
| 	struct nss_shaper_node_stats_response response; |  | ||||||
| 				/**< Shaper node statistics response */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_configure |  | ||||||
|  *	Configuration message for a shaper node. |  | ||||||
|  */ |  | ||||||
| struct nss_shaper_configure { |  | ||||||
| 	nss_shaper_config_type_t request_type;		/**< Message is a request. */ |  | ||||||
| 	nss_shaper_response_type_t response_type;	/**< Message is a response. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Types of configuration messages for a shaper node. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_shaper_config_alloc_shaper_node alloc_shaper_node; |  | ||||||
| 				/**< Allocate a shaper node in the NSS interface. */ |  | ||||||
| 		struct nss_shaper_config_free_shaper_node free_shaper_node; |  | ||||||
| 				/**< Free a shaper node from the NSS interface. */ |  | ||||||
| 		struct nss_shaper_config_set_default_node set_default_node; |  | ||||||
| 				/**< Set a shaper node as the default node for a queue. */ |  | ||||||
| 		struct nss_shaper_config_set_root_node set_root_node; |  | ||||||
| 				/**< Set a shaper node as the root shaper nod. */ |  | ||||||
| 		struct nss_shaper_config_set_hybrid_mode set_hybrid_mode; |  | ||||||
| 				/**< Set a shaper to operate in Hybrid mode. */ |  | ||||||
| 		struct nss_shaper_node_config shaper_node_config; |  | ||||||
| 				/**< Configuration message for any type of shaper node. */ |  | ||||||
| 		struct nss_shaper_node_stats_get shaper_node_stats_get; |  | ||||||
| 				/**< Statistics for a shaper node. */ |  | ||||||
| 	} msg;			/**< Types of configuration messages. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Registrant callback to receive shaper bounced packets |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] skb       Pointer to the data socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_shaper_bounced_callback_t)(void *app_data, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_register_shaping |  | ||||||
|  *	Registers a shaper node with the NSS interface for basic shaping operations. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern void *nss_shaper_register_shaping(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_unregister_shaping |  | ||||||
|  *	Deregisters a shaper node from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The shaper node must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_shaper_unregister_shaping(void *ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_register_shaper_bounce_interface |  | ||||||
|  *	Registers a shaper bounce interface with the NSS interface for receiving |  | ||||||
|  *	shaper-bounced packets. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_shaper_bounced_callback_t \n |  | ||||||
|  * module |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the message. This callback is |  | ||||||
|  *                      invoked when the NSS returns a sk_buff after shaping. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  *                      This context is passed to the callback together with the |  | ||||||
|  *                      sk_buff to provide context to the registrant (state). |  | ||||||
|  * @param[in] owner     Pointer to the kernel module. The module is held until it deregisters. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern void *nss_shaper_register_shaper_bounce_interface(uint32_t if_num, nss_shaper_bounced_callback_t cb, void *app_data, struct module *owner); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_unregister_shaper_bounce_interface |  | ||||||
|  *	Deregisters a shaper bounce interface from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The shaper bounce interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_shaper_unregister_shaper_bounce_interface(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_register_shaper_bounce_bridge |  | ||||||
|  *	Registers a shaper bounce bridge with the NSS interface for receiving |  | ||||||
|  *	shaper-bounced packets. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_shaper_bounced_callback_t \n |  | ||||||
|  * module |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] cb        Callback function for the message. This callback is |  | ||||||
|  *                      invoked when the NSS returns a sk_buff after shaping. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  *                      This context is passed to the callback together with the |  | ||||||
|  *                      sk_buff to provide context to the registrant (state). |  | ||||||
|  * @param[in] owner     Pointer to the kernel module. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern void *nss_shaper_register_shaper_bounce_bridge(uint32_t if_num, nss_shaper_bounced_callback_t cb, void *app_data, struct module *owner); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_unregister_shaper_bounce_bridge |  | ||||||
|  *	Deregisters a shaper bounce bridge from the NSS interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The shaper bounce bridge must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_shaper_unregister_shaper_bounce_bridge(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_bounce_interface_packet |  | ||||||
|  *	Issues a packet for shaping via a bounce operation. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in]     ctx     Pointer to the NSS context provided during registration. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * @param[in]     skb     Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_shaper_bounce_interface_packet(void *ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_bounce_bridge_packet |  | ||||||
|  *	Issues a packet for shaping via a bounce bridge. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in]     ctx     Pointer to the NSS context provided during registration. |  | ||||||
|  * @param[in]     if_num  NSS interface number. |  | ||||||
|  * @param[in]     skb     Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Success or failure. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_shaper_bounce_bridge_packet(void *ctx, uint32_t if_num, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_config_send |  | ||||||
|  *	Sends a shaping configuration message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_shaper_configure |  | ||||||
|  * |  | ||||||
|  * @param[in]     ctx     Pointer to the NSS context. |  | ||||||
|  * @param[in]     config  Pointer to the configuration message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Indication if the configuration message was issued. |  | ||||||
|  * @par |  | ||||||
|  * This indication does not mean the configuration message was successfully |  | ||||||
|  * processed. Success or failure is provided in the response issued to the |  | ||||||
|  * given callback function as specified in nss_shaper_configure. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_shaper_config_send(void *ctx, struct nss_shaper_configure *config); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_shaper_get_device |  | ||||||
|  *	Gets the original device from probe. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the device. |  | ||||||
|  */ |  | ||||||
| extern struct device *nss_shaper_get_dev(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -1,154 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-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_sjack.h |  | ||||||
|  *	NSS SJACK interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_SJACK_H |  | ||||||
| #define __NSS_SJACK_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_sjack_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_msg_types |  | ||||||
|  *	Message types for SJACK requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_sjack_msg_types { |  | ||||||
| 	NSS_SJACK_CONFIGURE_MSG, |  | ||||||
| 	NSS_SJACK_UNCONFIGURE_MSG, |  | ||||||
| 	NSS_SJACK_STATS_SYNC_MSG, |  | ||||||
| 	NSS_SJACK_MAX_MSG_TYPE |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_configure_msg |  | ||||||
|  *	Message information for configuring the SJACK interface. |  | ||||||
|  */ |  | ||||||
| struct nss_sjack_configure_msg { |  | ||||||
| 	uint32_t ingress_if_num; |  | ||||||
| 			/**< Ingress interface number corresponding to the SJACK device. */ |  | ||||||
| 	uint32_t egress_if_num; |  | ||||||
| 			/**< Egress interface number corresponding to the SJACK device. */ |  | ||||||
| 	uint16_t tunnel_id;		/**< SJACK tunnel ID. */ |  | ||||||
| 	uint8_t ip_dscp;		/**< Differentiated services code point value. */ |  | ||||||
| 	uint8_t gre_prio;		/**< GRE priority information. */ |  | ||||||
| 	uint8_t gre_flags;		/**< GRE flags. */ |  | ||||||
| 	uint8_t use_ipsec_sa_pattern;	/**< IPsec security association pattern flag. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_unconfigure_msg |  | ||||||
|  *	Message information for de-configuring the SJACK interface. |  | ||||||
|  */ |  | ||||||
| struct nss_sjack_unconfigure_msg { |  | ||||||
| 	uint32_t ingress_if_num; |  | ||||||
| 			/**< Ingress interface number corresponding to the SJACK device. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_stats_sync_msg |  | ||||||
|  *	Message information for SJACK synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_sjack_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_msg |  | ||||||
|  *	Data for sending and receiving SJACK messages. |  | ||||||
|  */ |  | ||||||
| struct nss_sjack_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of an SJACK message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_sjack_configure_msg configure; |  | ||||||
| 				/**< Configure SJACK. */ |  | ||||||
| 		struct nss_sjack_unconfigure_msg unconfigure; |  | ||||||
| 				/**< De-configure SJACK. */ |  | ||||||
| 		struct nss_sjack_stats_sync_msg stats_sync; |  | ||||||
| 				/**< Synchronized statistics for SJACK. */ |  | ||||||
| 	} msg;			/**< Message payload for SJACK interface messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving SJACK 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_sjack_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_register_if |  | ||||||
|  *	Registers with the NSS for sending and receiving SJACK messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_sjack_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] dev             Pointer to the associated network device. |  | ||||||
|  * @param[in] if_num          NSS interface number. |  | ||||||
|  * @param[in] event_callback  Callback for the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_sjack_register_if(uint32_t if_num, struct net_device *dev, nss_sjack_msg_callback_t event_callback); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_unregister_if |  | ||||||
|  *	Deregisters the SJACK interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_sjack_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_sjack_tx_msg |  | ||||||
|  *	Send SJACK messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_sjack_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in]     msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_sjack_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_sjack_msg *msg); |  | ||||||
|  |  | ||||||
| /** @} */ /* end_addtogroup nss_sjack_subsystem */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_SJACK_H */ |  | ||||||
| @@ -1,131 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_stats_public.h |  | ||||||
|  *	NSS statistics Structure and APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_STATS_PUBLIC_H |  | ||||||
| #define __NSS_STATS_PUBLIC_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_stats_public_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum string length. |  | ||||||
|  * |  | ||||||
|  * This should be equal to maximum string size of any statistics |  | ||||||
|  * inclusive of statistics value. |  | ||||||
|  */ |  | ||||||
| #define NSS_STATS_MAX_STR_LENGTH 96 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_stats_node |  | ||||||
|  *	Node statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_stats_node { |  | ||||||
| 	NSS_STATS_NODE_RX_PKTS,			/**< Accelerated node Rx packets. */ |  | ||||||
| 	NSS_STATS_NODE_RX_BYTES,		/**< Accelerated node Rx bytes. */ |  | ||||||
| 	NSS_STATS_NODE_TX_PKTS,			/**< Accelerated node Tx packets. */ |  | ||||||
| 	NSS_STATS_NODE_TX_BYTES,		/**< Accelerated node Tx bytes. */ |  | ||||||
| 	NSS_STATS_NODE_RX_QUEUE_0_DROPPED,	/**< Accelerated node Rx Queue 0 dropped. */ |  | ||||||
| 	NSS_STATS_NODE_RX_QUEUE_1_DROPPED,	/**< Accelerated node Rx Queue 1 dropped. */ |  | ||||||
| 	NSS_STATS_NODE_RX_QUEUE_2_DROPPED,	/**< Accelerated node Rx Queue 2 dropped. */ |  | ||||||
| 	NSS_STATS_NODE_RX_QUEUE_3_DROPPED,	/**< Accelerated node Rx Queue 3 dropped. */ |  | ||||||
| 	NSS_STATS_NODE_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * WARNING: There is a 1:1 mapping between values of enum nss_stats_drv and corresponding |  | ||||||
|  * statistics string array in nss_drv_strings.c. |  | ||||||
|  */ |  | ||||||
| /** |  | ||||||
|  * nss_stats_drv |  | ||||||
|  *	HLOS driver statistics. |  | ||||||
|  */ |  | ||||||
| enum nss_stats_drv { |  | ||||||
| 	NSS_STATS_DRV_NBUF_ALLOC_FAILS = 0,	/**< Networking buffer allocation errors. */ |  | ||||||
| 	NSS_STATS_DRV_PAGED_BUF_ALLOC_FAILS,	/**< Paged buffer allocation errors. */ |  | ||||||
| 	NSS_STATS_DRV_TX_QUEUE_FULL_0,		/**< Tx queue full for Core 0. */ |  | ||||||
| 	NSS_STATS_DRV_TX_QUEUE_FULL_1,		/**< Tx queue full for Core 1. */ |  | ||||||
| 	NSS_STATS_DRV_TX_EMPTY,			/**< Host-to-network empty buffers. */ |  | ||||||
| 	NSS_STATS_DRV_PAGED_TX_EMPTY,		/**< Host-to-network paged empty buffers. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET,		/**< Host-to-network data packets. */ |  | ||||||
| 	NSS_STATS_DRV_TX_CMD_REQ,		/**< Host-to-network control packets. */ |  | ||||||
| 	NSS_STATS_DRV_TX_CRYPTO_REQ,		/**< Host-to-network crypto requests. */ |  | ||||||
| 	NSS_STATS_DRV_TX_BUFFER_REUSE,		/**< Host-to-network reuse buffer count. */ |  | ||||||
| 	NSS_STATS_DRV_RX_EMPTY,			/**< Network-to-host empty buffers. */ |  | ||||||
| 	NSS_STATS_DRV_RX_PACKET,		/**< Network-to-host data packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_CMD_RESP,		/**< Network-to-host command responses. */ |  | ||||||
| 	NSS_STATS_DRV_RX_STATUS,		/**< Network-to-host status packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_CRYPTO_RESP,		/**< Network-to-host crypto responses. */ |  | ||||||
| 	NSS_STATS_DRV_RX_VIRTUAL,		/**< Network-to-host virtual packets. */ |  | ||||||
| 	NSS_STATS_DRV_TX_SIMPLE,		/**< Host-to-network simple SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_TX_NR_FRAGS,		/**< Host-to-network number of fragmented SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_TX_FRAGLIST,		/**< Host-to-network fragmentation list of SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_SIMPLE,		/**< Network-to-host simple SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_NR_FRAGS,		/**< Network-to-host number of fragmented SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_SKB_FRAGLIST,		/**< Network-to-host fragmentation list of SKB packets. */ |  | ||||||
| 	NSS_STATS_DRV_RX_BAD_DESCRIPTOR,	/**< Network-to-host bad descriptor reads. */ |  | ||||||
| 	NSS_STATS_DRV_NSS_SKB_COUNT,		/**< NSS SKB pool count. */ |  | ||||||
| 	NSS_STATS_DRV_CHAIN_SEG_PROCESSED,	/**< Network-to-host SKB chain processed count. */ |  | ||||||
| 	NSS_STATS_DRV_FRAG_SEG_PROCESSED,	/**< Network-to-host fragments processed count. */ |  | ||||||
| 	NSS_STATS_DRV_TX_CMD_QUEUE_FULL,	/**< Tx host-to-network control packets fail due to queue full. */ |  | ||||||
| #ifdef NSS_MULTI_H2N_DATA_RING_SUPPORT |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_0,	/**< Host-to-network data packets on queue0. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_1,	/**< Host-to-network data packets on queue1. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_2,	/**< Host-to-network data packets on queue2. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_3,	/**< Host-to-network data packets on queue3. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_4,	/**< Host-to-network data packets on queue4. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_5,	/**< Host-to-network data packets on queue5. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_6,	/**< Host-to-network data packets on queue6. */ |  | ||||||
| 	NSS_STATS_DRV_TX_PACKET_QUEUE_7,	/**< Host-to-network data packets on queue7. */ |  | ||||||
| #endif |  | ||||||
| 	NSS_STATS_DRV_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_stats_types |  | ||||||
|  *	List of statistics categories. |  | ||||||
|  */ |  | ||||||
| enum nss_stats_types { |  | ||||||
| 	NSS_STATS_TYPE_COMMON,			/**< Common pnode statistics. */ |  | ||||||
| 	NSS_STATS_TYPE_DROP,			/**< Packet drop statistics. */ |  | ||||||
| 	NSS_STATS_TYPE_ERROR,			/**< Hardware or software errors different from drop or exception statistics. */ |  | ||||||
| 	NSS_STATS_TYPE_EXCEPTION,		/**< Packet exception (to host) statistics. */ |  | ||||||
| 	NSS_STATS_TYPE_SPECIAL,			/**< Statistics that do not fall into the above types. */ |  | ||||||
| 	NSS_STATS_TYPE_MAX			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_stats_notifier_action |  | ||||||
|  *	Statistics notification types. |  | ||||||
|  */ |  | ||||||
| enum nss_stats_notifier_action { |  | ||||||
| 	NSS_STATS_EVENT_NOTIFY, |  | ||||||
| 	NSS_STATS_EVENT_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_STATS_PUBLIC_H */ |  | ||||||
| @@ -1,469 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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 |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_tls.h |  | ||||||
|  *	NSS TLS common interface definitions, supports inner/outer interface split. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef _NSS_TLS_H_ |  | ||||||
| #define _NSS_TLS_H_ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_tls_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
| #define NSS_TLS_VER_TLS_1_1 0x0301			/**< TLS version 1.1, major and minor version. */ |  | ||||||
| #define NSS_TLS_VER_TLS_1_2 0x0302			/**< TLS version 1.2, major and minor version. */ |  | ||||||
| #define NSS_TLS_CLE_MAX 32				/**< Maximum classification error. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * tls_msg_types |  | ||||||
|  *	Message types for TLS requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_tls_msg_type { |  | ||||||
| 	NSS_TLS_MSG_TYPE_NODE_CONFIG,		/**< Configure TLS firmware node. */ |  | ||||||
| 	NSS_TLS_MSG_TYPE_NODE_SYNC,		/**< Node statistics. */ |  | ||||||
| 	NSS_TLS_MSG_TYPE_CTX_CONFIG,		/**< Send exception interface number. */ |  | ||||||
| 	NSS_TLS_MSG_TYPE_CTX_DECONFIG,		/**< Context deconfigure message. */ |  | ||||||
| 	NSS_TLS_MSG_TYPE_CTX_SYNC,		/**< Synchronize statistics. */ |  | ||||||
| 	NSS_TLS_MSG_TYPE_CIPHER_UPDATE,		/**< Context session update.  */ |  | ||||||
| 	NSS_TLS_MSG_MAX,			/**< Maximum message. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_error |  | ||||||
|  *	TLS error. |  | ||||||
|  */ |  | ||||||
| enum nss_tls_error { |  | ||||||
| 	NSS_TLS_ERROR_NONE = 0,             /**< No error. */ |  | ||||||
| 	NSS_TLS_ERROR_UNKNOWN_MSG,          /**< Unknown message. */ |  | ||||||
| 	NSS_TLS_ERROR_ALREADY_CONFIGURE,    /**< Node already configured. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_REG_INNER_CTX,   /**< Register inner context error. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_REG_OUTER_CTX,   /**< Register outer context error. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_REQ_POOL_ALLOC,  /**< Request pool allocation failed. */ |  | ||||||
| 	NSS_TLS_ERROR_INVALID_BLK_LEN,      /**< Invalid block length. */ |  | ||||||
| 	NSS_TLS_ERROR_INVALID_HASH_LEN,     /**< Invalid hash length. */ |  | ||||||
| 	NSS_TLS_ERROR_INVALID_VER,          /**< Invalid TLS version. */ |  | ||||||
| 	NSS_TLS_ERROR_INVALID_CTX_WORDS,    /**< Context words size mismatch with TLS. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_ALLOC_HWCTX,     /**< Failed to allocate hardware context. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_COPY_CTX,        /**< Failed to copy context. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_NOMEM,           /**< Failed memory allocation. */ |  | ||||||
| 	NSS_TLS_ERROR_FAIL_INVAL_ALGO,	    /**< Invalid algorithm. */ |  | ||||||
| 	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 |  | ||||||
|  *	TLS HW statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_hw_stats { |  | ||||||
| 	/* |  | ||||||
| 	 * Dont change the order below |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t hw_len_error;			/**< Length error. */ |  | ||||||
| 	uint32_t hw_token_error;		/**< Token error, unknown token command/instruction. */ |  | ||||||
| 	uint32_t hw_bypass_error;		/**< Token contains too much bypass data. */ |  | ||||||
| 	uint32_t hw_crypto_error;		/**< Cryptograhic block size error. */ |  | ||||||
| 	uint32_t hw_hash_error;			/**< Hash block size error. */ |  | ||||||
| 	uint32_t hw_config_error;		/**< Invalid command/algorithm/mode/combination. */ |  | ||||||
| 	uint32_t hw_algo_error;			/**< Unsupported algorithm. */ |  | ||||||
| 	uint32_t hw_hash_ovf_error;		/**< Hash input overflow. */ |  | ||||||
| 	uint32_t hw_auth_error;         	/**< Hash input overflow. */ |  | ||||||
| 	uint32_t hw_pad_verify_error;		/**< Pad verification error. */ |  | ||||||
| 	uint32_t hw_timeout_error;              /**< Data timed out. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_ctx_perf_stats |  | ||||||
|  *	TLS performance statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_ctx_perf_stats { |  | ||||||
| 	uint32_t no_desc_in;		/**< Ingress DMA descriptor not available. */ |  | ||||||
| 	uint32_t no_desc_out;		/**< Egress DMA descriptor not available. */ |  | ||||||
| 	uint32_t no_reqs;		/**< Not enough requests available for records. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_ctx_stats |  | ||||||
|  *	TLS session statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_ctx_stats { |  | ||||||
| 	struct nss_cmn_node_stats pkt;		/**< Common node statistics. */ |  | ||||||
| 	uint32_t single_rec;			/**< Number of Tx single record datagrams. */ |  | ||||||
| 	uint32_t multi_rec;			/**< Number of multiple Tx record datagrams. */ |  | ||||||
| 	uint32_t tx_inval_reqs;			/**< Number of Tx invalidation successfully requested. */ |  | ||||||
| 	uint32_t rx_ccs_rec;			/**< Number of change cipher spec records received. */ |  | ||||||
| 	uint32_t fail_ccs;			/**< Failed to switch to new crypto. */ |  | ||||||
| 	uint32_t eth_node_deactive;		/**< Ethernet node deactivated as no crypto available. */ |  | ||||||
| 	uint32_t crypto_alloc_success;		/**< Number of crypto allocation succeeded. */ |  | ||||||
| 	uint32_t crypto_free_req;		/**< Number of crypto free request. */ |  | ||||||
| 	uint32_t crypto_free_success;		/**< Number of crypto free succeeded. */ |  | ||||||
| 	uint32_t fail_crypto_alloc;		/**< Number of crypto allocation failed. */ |  | ||||||
| 	uint32_t fail_crypto_lookup;		/**< Failed to find active crypto session. */ |  | ||||||
| 	uint32_t fail_req_alloc;		/**< Failure to allocate request memory pool.  */ |  | ||||||
| 	uint32_t fail_pbuf_stats;		/**< Failure in pbuf allocation for statistics. */ |  | ||||||
| 	uint32_t fail_ctx_active;		/**< Failure in enqueue due to inactive context. */ |  | ||||||
|  |  | ||||||
| 	struct nss_tls_hw_stats fail_hw;	/**< Hardware failure. */ |  | ||||||
| 	struct nss_tls_ctx_perf_stats perf;	/**< Performance related statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_node_stats |  | ||||||
|  * 	TLS node statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_node_stats { |  | ||||||
| 	uint32_t fail_ctx_alloc;	/**< Failure in allocating a context. */ |  | ||||||
| 	uint32_t fail_ctx_free;		/**< Failure in freeing up the context. */ |  | ||||||
| 	uint32_t fail_pbuf_stats;	/**< Failure in pbuf allocation for statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_ctx_config |  | ||||||
|  *	TLS context configuration. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_ctx_config { |  | ||||||
| 	uint32_t except_ifnum; 		/**< Exception interface number. */ |  | ||||||
| 	uint32_t headroom;		/**< Headroom required for encapsulation. */ |  | ||||||
| 	uint32_t tailroom;		/**< Tailroom required for encapsulation. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_cipher_update |  | ||||||
|  *	TLS cipher update message. |  | ||||||
|  * |  | ||||||
|  */ |  | ||||||
| struct nss_tls_cipher_update { |  | ||||||
| 	uint32_t crypto_idx;    /**< Crypto index for cipher context. */ |  | ||||||
| 	uint16_t ver;           /**< Version (TLS minor and major versions). */ |  | ||||||
| 	uint8_t skip;		/**< Skip hardware processing. */ |  | ||||||
| 	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 |  | ||||||
|  *	Data for sending and receiving TLS messages. |  | ||||||
|  */ |  | ||||||
| struct nss_tls_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a TLS message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_tls_cipher_update cipher_update;	/**< Crypto configuration. */ |  | ||||||
| 		struct nss_tls_ctx_config ctx_cfg;	/**< Context configuration. */ |  | ||||||
| 		struct nss_tls_ctx_stats stats;		/**< Context statistics. */ |  | ||||||
| 		struct nss_tls_node_stats node_stats;	/**< Node statistics. */ |  | ||||||
| 	} msg;			/**< Message payload for TLS session messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving TLS 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_tls_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving TLS session 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_tls_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_tx_buf |  | ||||||
|  *	Sends a TLS data packet to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * sk_buff \n |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in]     os_buf   Pointer to the OS data buffer. |  | ||||||
|  * @param[in]     if_num   NSS interface number. |  | ||||||
|  * @param[in]     nss_ctx  Pointer to the NSS core context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of Tx buffer forwarded to NSS for TLS operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_tls_tx_buf(struct sk_buff *os_buf, uint32_t if_num, struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_tx_msg |  | ||||||
|  *	Sends an asynchronous IPsec message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_tls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_tls_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_tls_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_tx_msg_sync |  | ||||||
|  *	Sends a synchronous IPsec message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_tls_msg_type \n |  | ||||||
|  * nss_tls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in]  nss_ctx  Pointer to the NSS HLOS driver context. |  | ||||||
|  * @param[in]  if_num   NSS interface number. |  | ||||||
|  * @param[in]  type     Type of message. |  | ||||||
|  * @param[in]  len      Size of the payload. |  | ||||||
|  * @param[in]  ntcm     Pointer to the NSS IPsec message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_tls_tx_msg_sync(struct nss_ctx_instance *nss_ctx, uint32_t if_num, |  | ||||||
| 						enum nss_tls_msg_type type, uint16_t len, |  | ||||||
| 						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 |  | ||||||
|  *	Registers a TLS session interface with the NSS for sending and receiving |  | ||||||
|  *	messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tls_data_callback_t \n |  | ||||||
|  * nss_tls_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] data_cb   Callback function for the message. |  | ||||||
|  * @param[in] msg_cb    Callback for TLS tunnel message. |  | ||||||
|  * @param[in] netdev    Pointer to the associated network device. |  | ||||||
|  * @param[in] features  Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] type      Type of message. |  | ||||||
|  * @param[in] app_ctx   Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_tls_register_if(uint32_t if_num, |  | ||||||
| 							 nss_tls_data_callback_t data_cb, |  | ||||||
| 							 nss_tls_msg_callback_t msg_cb, |  | ||||||
| 							 struct net_device *netdev, |  | ||||||
| 							 uint32_t features, |  | ||||||
| 							 uint32_t type, |  | ||||||
| 							 void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_notify_unregister |  | ||||||
|  *	Deregisters an event callback. |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_tls_notify_unregister(uint32_t ifnum); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_notify_register |  | ||||||
|  *	Registers an event callback to handle notification from TLS firmware package. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tls_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] ifnum     NSS interface number. |  | ||||||
|  * @param[in] ev_cb     Callback for TLS tunnel message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_tls_notify_register(uint32_t ifnum, nss_tls_msg_callback_t ev_cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_msg_init |  | ||||||
|  *	Initializes a TLS message sent asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_tls_msg_init(struct nss_tls_msg *ncm, uint32_t if_num, uint32_t type, uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_msg_sync_init |  | ||||||
|  *	Initializes a TLS message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tls_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_tls_msg_sync_init(struct nss_tls_msg *ncm, uint32_t if_num, uint32_t type, uint32_t len); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_get_context |  | ||||||
|  *	Gets the NSS core context for the TLS session. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_tls_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tls_get_device |  | ||||||
|  *	Gets the original device from probe. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the device. |  | ||||||
|  */ |  | ||||||
| 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* _NSS_TLS_H_. */ |  | ||||||
| @@ -1,234 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2017, 2020 The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_trustsec_tx.h |  | ||||||
|  *	NSS TrustSec interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_TRUSTSEC_TX_H |  | ||||||
| #define __NSS_TRUSTSEC_TX_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_trustsec_tx_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_msg_types |  | ||||||
|  *	Message types for TrustSec Tx requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_trustsec_tx_msg_types { |  | ||||||
| 	NSS_TRUSTSEC_TX_MSG_CONFIGURE,		/** Configure the TrustSec node. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_MSG_UNCONFIGURE,	/** Unconfigure the TrustSec node. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_MSG_STATS_SYNC,		/** Statistics sychronization. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_MSG_UPDATE_NEXTHOP,	/** Update next hop. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_MSG_MAX			/** Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_error_types |  | ||||||
|  *	Error types for the TrustSec Tx interface. |  | ||||||
|  */ |  | ||||||
| enum nss_trustsec_tx_error_types { |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_NONE,		/** No error */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_INVAL_SRC_IF,	/** Source interface is invalid. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_RECONFIGURE_SRC_IF,	/** Source interface is already configured. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_DEST_IF_NOT_FOUND,	/** Destination interface is not found. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_NOT_CONFIGURED,	/** Source interface is not configured. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_SGT_MISMATCH,	/** SGT mismatches. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_UNKNOWN,		/** Error is unknown. */ |  | ||||||
| 	NSS_TRUSTSEC_TX_ERR_MAX,		/** Maximum error message. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_configure_msg |  | ||||||
|  *	Message information for configuring a TrustSec Tx interface. |  | ||||||
|  */ |  | ||||||
| struct nss_trustsec_tx_configure_msg { |  | ||||||
| 	uint32_t src;	/**< Interface number of the source tunnel. */ |  | ||||||
| 	uint32_t dest;	/**< Outgoing interface number. */ |  | ||||||
| 	uint16_t sgt;	/**< Security Group Tag value to embed in the TrustSec header. */ |  | ||||||
| 	uint8_t reserved[2];	/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_unconfigure_msg |  | ||||||
|  *	Message information for de-configuring a TrustSec Tx interface. |  | ||||||
|  */ |  | ||||||
| struct nss_trustsec_tx_unconfigure_msg { |  | ||||||
| 	uint32_t src;		/**< Interface number of the source tunnel. */ |  | ||||||
| 	uint16_t sgt;		/**< Security Group Tag value configured for this interface. */ |  | ||||||
| 	uint8_t reserved[2];	/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_stats_sync_msg |  | ||||||
|  *	Statistics synchronization message for the TrustSec Tx interface. |  | ||||||
|  */ |  | ||||||
| struct nss_trustsec_tx_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| 	uint32_t invalid_src;		/**< Received packets with an invalid source interface. */ |  | ||||||
| 	uint32_t unconfigured_src;	/**< Received packets with a de-configured source interface. */ |  | ||||||
| 	uint32_t headroom_not_enough;	/**< Not enough headroom to insert a TrustSec header. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_update_nexthop_msg |  | ||||||
|  *	Message information for updating the next hop for a TrustSec Tx interface. |  | ||||||
|  */ |  | ||||||
| struct nss_trustsec_tx_update_nexthop_msg { |  | ||||||
| 	uint32_t src;	/**< Interface number of the source tunnel. */ |  | ||||||
| 	uint32_t dest;	/**< Outgoing interface number. */ |  | ||||||
| 	uint16_t sgt;	/**< Security Group Tag value to embed in the TrustSec header. */ |  | ||||||
| 	uint8_t reserved[2];	/**< Reserved for word alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  *	Data for sending and receiving TrustSec Tx messages. |  | ||||||
|  */ |  | ||||||
| struct nss_trustsec_tx_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a TrustSec Tx message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_trustsec_tx_configure_msg configure; |  | ||||||
| 				/**< Configure TrustSec Tx. */ |  | ||||||
| 		struct nss_trustsec_tx_unconfigure_msg unconfigure; |  | ||||||
| 				/**< De-configure TrustSec Tx. */ |  | ||||||
| 		struct nss_trustsec_tx_stats_sync_msg stats_sync; |  | ||||||
| 				/**< Synchronize TrustSec Tx statistics. */ |  | ||||||
| 		struct nss_trustsec_tx_update_nexthop_msg upd_nexthop; |  | ||||||
| 				/**< Update next hop of TrustSec Tx. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving TrustSec Tx messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_trustsec_tx_msg_callback_t)(void *app_data, struct nss_trustsec_tx_msg *npm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_msg_init |  | ||||||
|  *	Initializes a TrustSec Tx message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] npm       Pointer to the NSS Profiler message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the message. |  | ||||||
|  * @param[in]     cb        Callback function for the message. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * TRUE or FALSE. |  | ||||||
|  */ |  | ||||||
| extern void nss_trustsec_tx_msg_init(struct nss_trustsec_tx_msg *npm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 							nss_trustsec_tx_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  *	Sends a TrustSec Tx message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_trustsec_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_trustsec_tx_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_msg_sync |  | ||||||
|  *	Sends a TrustSec Tx message to the NSS and waits for a response. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_trustsec_tx_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_trustsec_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_trustsec_tx_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_update_nexthop |  | ||||||
|  *	Updates the next hop of the TrustSec. |  | ||||||
|  * |  | ||||||
|  * @param[in] src   Source interface number. |  | ||||||
|  * @param[in] dest  Destination interface number. |  | ||||||
|  * @param[in] sgt   Security Group Tag value. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_trustsec_tx_update_nexthop(uint32_t src, uint32_t dest, uint16_t sgt); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_get_ctx |  | ||||||
|  *	Gets the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_trustsec_tx_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_configure_sgt |  | ||||||
|  *	Configures the Security Group Tag value for a source interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] src   Source interface number. |  | ||||||
|  * @param[in] dest  Destination interface number. |  | ||||||
|  * @param[in] sgt   Security Group Tag value. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_trustsec_tx_configure_sgt(uint32_t src, uint32_t dest, uint16_t sgt); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_trustsec_tx_unconfigure_sgt |  | ||||||
|  *	De-configures the Security Group Tag value for a source interface. |  | ||||||
|  * |  | ||||||
|  * @param[in] src  Source interface number. |  | ||||||
|  * @param[in] sgt  Security Group Tag value. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_trustsec_tx_unconfigure_sgt(uint32_t src, uint16_t sgt); |  | ||||||
|  |  | ||||||
| /** @} */ /* end_addtogroup nss_trustsec_tx_subsystem */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_TRUSTSEC_TX_H */ |  | ||||||
| @@ -1,125 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017, 2019 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_tstamp.h |  | ||||||
|  *	NSS to HLOS Tstamp interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_TSTAMP_H |  | ||||||
| #define __NSS_TSTAMP_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tstamp_msg_type |  | ||||||
|  *	Time stamp message types. |  | ||||||
|  */ |  | ||||||
| enum nss_tstamp_msg_type { |  | ||||||
| 	NSS_TSTAMP_MSG_TYPE_SYNC_STATS,	/**< Statistic synchronization message. */ |  | ||||||
| 	NSS_TSTAMP_MSG_TYPE_MAX,	/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  *  nss_tstamp_h2n_pre_hdr |  | ||||||
|  *	Metadata added by the time stamp HLOS driver. |  | ||||||
|  * |  | ||||||
|  * It is used while sending the packet to the NSS time stamp module. |  | ||||||
|  */ |  | ||||||
| struct nss_tstamp_h2n_pre_hdr { |  | ||||||
| 	uint32_t ts_ifnum;	/**< Time stamp interface number. */ |  | ||||||
| 	uint32_t ts_tx_hdr_sz;	/**< Total header size. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_tstamp_n2h_pre_hdr |  | ||||||
|  *	Metadata added by the NSS time stamp module. |  | ||||||
|  * |  | ||||||
|  * It is added before sending the packet to host. |  | ||||||
|  */ |  | ||||||
| struct nss_tstamp_n2h_pre_hdr { |  | ||||||
| 	uint32_t ts_ifnum;	/**< Time stamp interface number. */ |  | ||||||
| 	uint32_t ts_data_lo;	/**< Time stamp lower order bits. */ |  | ||||||
| 	uint32_t ts_data_hi;	/**< Time stamp higher order bits. */ |  | ||||||
|  |  | ||||||
| 	uint32_t ts_tx;		/**< Time stamp direction. */ |  | ||||||
| 	uint32_t ts_hdr_sz;	/**< Size of the header including the skb data alignment padding. */ |  | ||||||
| 	uint32_t reserved;	/**< Reserved for cache alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tstamp_stats_msg |  | ||||||
|  *	Statistics messages from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_tstamp_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats; |  | ||||||
| 					/**< Common node statistics for time stamp. */ |  | ||||||
| 	uint32_t boomeranged;		/**< Boomeranged packets. */ |  | ||||||
| 	uint32_t dropped_fail_enqueue;	/**< Enqueue failed. */ |  | ||||||
| 	uint32_t dropped_fail_alloc;	/**< Allocation for copy failed. */ |  | ||||||
| 	uint32_t dropped_fail_copy;	/**< Copy failed. */ |  | ||||||
| 	uint32_t dropped_no_interface;	/**< Next interface not found. */ |  | ||||||
| 	uint32_t dropped_no_headroom;	/**< Packet does not have enough headroom. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tstamp_msg |  | ||||||
|  *	Data for sending and receiving time stamp messages. |  | ||||||
|  */ |  | ||||||
| struct nss_tstamp_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a time stamp common message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_tstamp_stats_msg stats; |  | ||||||
| 				/**< Time stamp statistics. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving core-to-core transmissions messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tstamp_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_tstamp_msg_callback_t)(void *app_data, struct nss_tstamp_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tstamp_notify_register |  | ||||||
|  *	Registers a notifier callback for time stamp messages with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tstamp_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] cb        Callback function for the message. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_tstamp_notify_register(nss_tstamp_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @brief Transfer the packet to time stamp NSS module. |  | ||||||
|  * |  | ||||||
|  * @return nss_tx_status |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_tstamp_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *skb, uint32_t if_num); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_TSTAMP_H */ |  | ||||||
| @@ -1,198 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014, 2017-2019, 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_tun6rd.h |  | ||||||
|  *	NSS TUN6RD interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_TUN6RD_H |  | ||||||
| #define __NSS_TUN6RD_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_tun6rd_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_metadata_types |  | ||||||
|  *	Message types for 6RD (IPv6 in IPv4) tunnel requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_tun6rd_metadata_types { |  | ||||||
| 	NSS_TUN6RD_ATTACH_PNODE, |  | ||||||
| 	NSS_TUN6RD_RX_STATS_SYNC, |  | ||||||
| 	NSS_TUN6RD_ADD_UPDATE_PEER, |  | ||||||
| 	NSS_TUN6RD_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_attach_tunnel_msg |  | ||||||
|  *	Message information for configuring the 6RD tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_tun6rd_attach_tunnel_msg { |  | ||||||
| 	uint32_t saddr;			/**< Source address of the tunnel. */ |  | ||||||
| 	uint32_t daddr;			/**< Destination address of the tunnel. */ |  | ||||||
| 	uint8_t  tos;			/**< Type Of Service field added to the outer header. */ |  | ||||||
| 	uint8_t  ttl;			/**< Time-to-live value for the tunnel. */ |  | ||||||
| 	uint32_t sibling_if_num;	/**< Sibling interface number. */ |  | ||||||
| 	uint16_t reserved;		/**< Reserved field added for alignment. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_sync_stats_msg |  | ||||||
|  *	Message information for 6RD tunnel synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tun6rd_sync_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common node statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_set_peer_msg |  | ||||||
|  *	Message information for the 6RD tunnel peer address. |  | ||||||
|  */ |  | ||||||
| struct nss_tun6rd_set_peer_msg { |  | ||||||
| 	uint32_t ipv6_address[4];	/**< IPv6 address. */ |  | ||||||
| 	uint32_t dest;			/**< IPv4 address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_msg |  | ||||||
|  *	Data for sending and receiving 6RD tunnel messages. |  | ||||||
|  */ |  | ||||||
| struct nss_tun6rd_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a 6RD tunnel message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_tun6rd_attach_tunnel_msg tunnel; |  | ||||||
| 				/**< Attach a 6RD tunnel. */ |  | ||||||
| 		struct nss_tun6rd_sync_stats_msg stats; |  | ||||||
| 				/**< Synchronized statistics for the interface. */ |  | ||||||
| 		struct nss_tun6rd_set_peer_msg peer; |  | ||||||
| 				/**< Add or update the peer. */ |  | ||||||
| 	} msg;			/**< Message payload for 6RD tunnel messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving 6RD tunnel messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tun6rd_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_tun6rd_msg_callback_t)(void *app_data, struct nss_tun6rd_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_tx |  | ||||||
|  *	Sends a 6RD tunnel message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_tun6rd_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_tun6rd_tx(struct nss_ctx_instance *nss_ctx, struct nss_tun6rd_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_get_context |  | ||||||
|  *	Gets the TUN6RD context used in nss_tun6rd_tx(). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_tun6rd_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving 6RD tunnel 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_tun6rd_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_tun6rd_if |  | ||||||
|  *	Registers the TUN6RD interface with the NSS for sending and receiving messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tun6rd_callback_t \n |  | ||||||
|  * nss_tun6rd_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num           NSS interface number. |  | ||||||
|  * @param[in] type             NSS interface type. |  | ||||||
|  * @param[in] tun6rd_callback  Callback for the data. |  | ||||||
|  * @param[in] msg_callback     Callback for the message. |  | ||||||
|  * @param[in] netdev           Pointer to the associated network device. |  | ||||||
|  * @param[in] features         Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, uint32_t type, nss_tun6rd_callback_t tun6rd_callback, |  | ||||||
| 					nss_tun6rd_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_tun6rd_if |  | ||||||
|  *	Deregisters the TUN6RD interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
| . * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The 6RD tunnel interface must have been previously registered. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_tun6rd_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tun6rd_msg_init |  | ||||||
|  *	Initializes a TUN6RD message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tun6rd_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_tun6rd_msg_init(struct nss_tun6rd_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** @} */ /* end_addtogroup nss_tun6rd_subsystem */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_TUN6RD_H */ |  | ||||||
| @@ -1,293 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014, 2017-2018, 2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_tunipip6.h |  | ||||||
|  *	NSS TUNIPIP6 interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_TUNIPIP6_H |  | ||||||
| #define __NSS_TUNIPIP6_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported TUNIPIP6 tunnels. |  | ||||||
|  */ |  | ||||||
| #define NSS_TUNIPIP6_TUNNEL_MAX 32 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_tunipip6_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_map_rule |  | ||||||
|  *	Mapping rule (FMR/BMR) for forwarding traffic to the node in the same domain. |  | ||||||
|  */ |  | ||||||
| struct nss_tunipip6_map_rule { |  | ||||||
| 	uint32_t ip6_prefix[4];		/**< An IPv6 prefix assigned by a mapping rule. */ |  | ||||||
| 	uint32_t ip4_prefix;		/**< An IPv4 prefix assigned by a mapping rule. */ |  | ||||||
| 	uint32_t ip6_prefix_len;	/**< IPv6 prefix length. */ |  | ||||||
| 	uint32_t ip4_prefix_len;	/**< IPv4 prefix length. */ |  | ||||||
| 	uint32_t ip6_suffix[4];		/**< IPv6 suffix. */ |  | ||||||
| 	uint32_t ip6_suffix_len;	/**< IPv6 suffix length. */ |  | ||||||
| 	uint32_t ea_len;		/**< Embedded Address (EA) bits. */ |  | ||||||
| 	uint32_t psid_offset;		/**< PSID offset default 6. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_tunipip6_err_types |  | ||||||
|  * 	Error types for response to messages from the host. |  | ||||||
|  */ |  | ||||||
| enum nss_tunipip6_err_types { |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_MAX_TUNNELS,		/**< Maximum number of tunnel reached. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_TUNNEL_EXIST,		/**< Tunnel already exists. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_BAD_PARAM,	/**< Bad configuration. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_FMR_EXIST,	/**< FMR already exists. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_NO_FMR,		/**< No FMR configured.*/ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_FMR_FULL,	/**< FMR table is full. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_INVALID_FMR,	/**< Invalid FMR configured.*/ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_BMR_EXIST,	/**< BMR already exists. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_NO_BMR,		/**< No BMR configured. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_ENCAP_FMR_MEM_ALLOC_FAILED,	/**< Pool allocation for FMR failed. */ |  | ||||||
| 	NSS_TUNIPIP6_ERR_TYPE_UNKNOWN,		/**< Unknown message type. */ |  | ||||||
| 	NSS_TUNIPIP6_ERROR_MAX,			/**< Maximum number of errors. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_metadata_types |  | ||||||
|  *	Message types for TUNIPIP6 (IPv4 in IPv6) tunnel requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_tunipip6_metadata_types { |  | ||||||
| 	NSS_TUNIPIP6_TX_ENCAP_IF_CREATE, |  | ||||||
| 	NSS_TUNIPIP6_TX_DECAP_IF_CREATE, |  | ||||||
| 	NSS_TUNIPIP6_STATS_SYNC, |  | ||||||
| 	NSS_TUNIPIP6_FMR_RULE_ADD, |  | ||||||
| 	NSS_TUNIPIP6_FMR_RULE_DEL, |  | ||||||
| 	NSS_TUNIPIP6_FMR_RULE_FLUSH, |  | ||||||
| 	NSS_TUNIPIP6_BMR_RULE_ADD, |  | ||||||
| 	NSS_TUNIPIP6_BMR_RULE_DEL, |  | ||||||
| 	NSS_TUNIPIP6_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_create_msg |  | ||||||
|  *	Payload for configuring the TUNIPIP6 interface. |  | ||||||
|  */ |  | ||||||
| struct nss_tunipip6_create_msg { |  | ||||||
| 	uint32_t saddr[4];						/**< Tunnel source address. */ |  | ||||||
| 	uint32_t daddr[4];						/**< Tunnel destination address. */ |  | ||||||
| 	uint32_t flowlabel;						/**< Tunnel IPv6 flow label. */ |  | ||||||
| 	uint32_t flags;							/**< Tunnel additional flags. */ |  | ||||||
| 	uint32_t sibling_if_num;					/**< Sibling interface number. */ |  | ||||||
| 	uint8_t hop_limit;						/**< Tunnel IPv6 hop limit. */ |  | ||||||
| 	uint8_t draft03;						/**< Use MAP-E draft03 specification. */ |  | ||||||
| 	uint8_t ttl_inherit;						/**< Inherit IPv4 TTL to hoplimit. */ |  | ||||||
| 	uint8_t tos_inherit;						/**< Inherit IPv4 ToS. */ |  | ||||||
| 	uint8_t frag_id_update;						/**< Enable update of fragment identifier of IPv4. */ |  | ||||||
| 	uint8_t reserved[3];						/**< Reserved bytes. */ |  | ||||||
| 	uint32_t fmr_max;						/**< Maximum number of FMRs that can be configured. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_debug_stats |  | ||||||
|  * 	TUNIPIP6 debug statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tunipip6_debug_stats { |  | ||||||
| 	struct { |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t low_headroom;		/**< Low headroom for encapsulation. */ |  | ||||||
| 			uint32_t unhandled_proto;	/**< Unhandled protocol for encapsulation. */ |  | ||||||
| 		} exp; |  | ||||||
|  |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t enqueue_fail;		/**< Encapsulation enqueue fail. */ |  | ||||||
| 		} drop; |  | ||||||
|  |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t err_tunnel_cfg;	/**< Tunnel configuration error. */ |  | ||||||
| 			uint32_t total_fmr;		/**< Total number of existing FMRs. */ |  | ||||||
| 			uint32_t fmr_add_req;		/**< FMR add requests. */ |  | ||||||
| 			uint32_t fmr_del_req;		/**< FMR delete requests. */ |  | ||||||
| 			uint32_t fmr_flush_req;		/**< FMR flush requests. */ |  | ||||||
| 			uint32_t fmr_update_req;	/**< FMR update requests. */ |  | ||||||
| 			uint32_t fmr_add_fail;		/**< FMR addition failed. */ |  | ||||||
| 			uint32_t fmr_del_fail;		/**< FMR deletion failed. */ |  | ||||||
| 			uint32_t err_no_fmr;		/**< No FMR configured. */ |  | ||||||
| 			uint32_t bmr_add_req;		/**< BMR add requests. */ |  | ||||||
| 			uint32_t bmr_del_req;		/**< BMR delete requests. */ |  | ||||||
| 			uint32_t err_bmr_exist;		/**< BMR already configured. */ |  | ||||||
| 			uint32_t err_no_bmr;		/**< No BMR configured. */ |  | ||||||
| 		} cfg; |  | ||||||
| 	} encap; |  | ||||||
|  |  | ||||||
| 	struct { |  | ||||||
| 		struct { |  | ||||||
| 			uint32_t enqueue_fail;		/**< Decapsulation enqueue fail. */ |  | ||||||
| 		} drop; |  | ||||||
| 	} decap; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_stats_sync_msg |  | ||||||
|  *	Message information for TUNIPIP6 synchronization statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_tunipip6_stats_sync_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;		/**< Common node statistics. */ |  | ||||||
| 	struct nss_tunipip6_debug_stats tun_stats;	/**< TUNIPIP6 debug statistics. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_msg |  | ||||||
|  *	Data for sending and receiving TUNIPIP6 messages. |  | ||||||
|  */ |  | ||||||
| struct nss_tunipip6_msg { |  | ||||||
| 	struct nss_cmn_msg cm;			/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a TUNIPIP6 message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_tunipip6_create_msg tunipip6_create; |  | ||||||
| 				/**< Create a TUNIPIP6 tunnel. */ |  | ||||||
| 		struct nss_tunipip6_stats_sync_msg stats; |  | ||||||
| 				/**< Synchronized statistics for the TUNIPIP6 interface. */ |  | ||||||
| 		struct nss_tunipip6_map_rule map_rule; |  | ||||||
| 				/**< BMR/FMR rule to add/delete, new or existing rules. */ |  | ||||||
| 	} msg;			/**< Message payload for TUNIPIP6 messages exchanged with NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving TUNIPIP6 messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tunipip6_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_tunipip6_msg_callback_t)(void *app_data, struct nss_tunipip6_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_tx |  | ||||||
|  *	Sends a TUNIPIP6 message to NSS core. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_tunipip6_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_tunipip6_tx(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_tx_sync |  | ||||||
|  *	Sends a TUNIPIP6 message to NSS core synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_tunipip6_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_tunipip6_tx_sync(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving TUNIPIP6 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_tunipip6_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_tunipip6_if |  | ||||||
|  *	Registers the TUNIPIP6 interface with the NSS for sending and receiving |  | ||||||
|  *	TUNIPIP6 messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tunipip6_callback_t \n |  | ||||||
|  * nss_tunipip6_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num             NSS interface number. |  | ||||||
|  * @param[in] type               Dynamic interface type. |  | ||||||
|  * @param[in] tunipip6_callback  Callback for the data. |  | ||||||
|  * @param[in] event_callback     Callback for the message. |  | ||||||
|  * @param[in] netdev             Pointer to the associated network device. |  | ||||||
|  * @param[in] features           Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_register_tunipip6_if(uint32_t if_num, uint32_t type, nss_tunipip6_callback_t tunipip6_callback, |  | ||||||
| 					nss_tunipip6_msg_callback_t event_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_tunipip6_if |  | ||||||
|  *	Deregisters the TUNIPIP6 interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_unregister_tunipip6_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_msg_init |  | ||||||
|  *	Initializes a TUNIPIP6 message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_tunipip6_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ntm       Pointer to the IPIP6 tunnel message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the message. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_tunipip6_msg_init(struct nss_tunipip6_msg *ntm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_tunipip6_get_context() |  | ||||||
|  *	Get TUNIPIP6 context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_tunipip6_get_context(void); |  | ||||||
|  |  | ||||||
| /** @} */ /* end_addtogroup nss_tunipip6_subsystem */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_TUN6RD_H */ |  | ||||||
| @@ -1,284 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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,121 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2017-2019, 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_unaligned.h |  | ||||||
|  *	NSS unaligned interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_UNALIGNED_H |  | ||||||
| #define __NSS_UNALIGNED_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_unaligned_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #define NSS_UNALIGNED_OPS_PER_MSG 54 |  | ||||||
| 			/**< The number of operations whose statistics are included in a message. */ |  | ||||||
| #define NSS_UNALIGNED_EMULATED_OPS 64 |  | ||||||
| 			/**< The number of operations that are emulated. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_msg_types |  | ||||||
|  *	Unaligned message types. |  | ||||||
|  */ |  | ||||||
| enum nss_unaligned_msg_types { |  | ||||||
| 	NSS_UNALIGNED_MSG_STATS,	/**< Performance statistics message. */ |  | ||||||
| 	NSS_UNALIGNED_MSG_MAX,		/**< Maximum unaligned message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_stats_op |  | ||||||
|  *	Performance statistics for emulating a single operation. |  | ||||||
|  */ |  | ||||||
| struct nss_unaligned_stats_op { |  | ||||||
| 	uint32_t opcode_primary; |  | ||||||
| 		/**< Primary operation code. */ |  | ||||||
| 	uint32_t opcode_extension; |  | ||||||
| 		/**< Extension operation code, if applicable. */ |  | ||||||
| 	uint64_t count; |  | ||||||
| 		/**< Number of times operation was emulated. */ |  | ||||||
| 	uint32_t ticks_min; |  | ||||||
| 		/**< Minimum number of ticks spent emulating operation. */ |  | ||||||
| 	uint32_t ticks_avg; |  | ||||||
| 		/**< Average number of ticks spent emulating operation. */ |  | ||||||
| 	uint32_t ticks_max; |  | ||||||
| 		/**< Maximum number of ticks spent emulating operation. */ |  | ||||||
| 	uint32_t padding; |  | ||||||
| 		/**< Used for consistent alignment, can be re-used. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_stats |  | ||||||
|  *	Message containing all non-zero operation statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_unaligned_stats { |  | ||||||
| 	uint64_t trap_count; |  | ||||||
| 					/**< Number of unaligned traps encountered. */ |  | ||||||
| 	struct nss_unaligned_stats_op ops[NSS_UNALIGNED_EMULATED_OPS]; |  | ||||||
| 					/**< Statistics for each operation. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_stats_msg |  | ||||||
|  * 	Message containing all non-zero operation statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_unaligned_stats_msg { |  | ||||||
| 	uint64_t trap_count;		/**< Number of unaligned traps encountered. */ |  | ||||||
| 	struct nss_unaligned_stats_op ops[NSS_UNALIGNED_OPS_PER_MSG]; |  | ||||||
| 					/**< Statistics for each operation. */ |  | ||||||
| 	uint32_t current_iteration;	/**< Number of full statistics messages sent without reaching the end. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_msg |  | ||||||
|  *	Message from unaligned handler node. |  | ||||||
|  */ |  | ||||||
| struct nss_unaligned_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Unaligned message payload. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_unaligned_stats_msg stats_msg; |  | ||||||
| 					/**< Message containing statistics. */ |  | ||||||
| 	} msg;				/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unaligned_register_handler() |  | ||||||
|  *	Registers message handler on the NSS unaligned interface and |  | ||||||
|  *	statistics dentry. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_unaligned_register_handler(struct nss_ctx_instance *nss_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
| #endif |  | ||||||
| @@ -1,436 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2014-2017, 2019, 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_virt_if.h |  | ||||||
|  *	NSS Virtual interface message Structure and APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_VIRT_IF_H |  | ||||||
| #define __NSS_VIRT_IF_H |  | ||||||
|  |  | ||||||
| #include "nss_if.h" |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_virtual_if_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_msg_types |  | ||||||
|  *	Message types for virtual interface requests and responses. |  | ||||||
|  */ |  | ||||||
| enum nss_virt_if_msg_types { |  | ||||||
| 	NSS_VIRT_IF_OPEN = NSS_IF_OPEN, |  | ||||||
| 	NSS_VIRT_IF_CLOSE = NSS_IF_CLOSE, |  | ||||||
| 	NSS_VIRT_IF_LINK_STATE_NOTIFY = NSS_IF_LINK_STATE_NOTIFY, |  | ||||||
| 	NSS_VIRT_IF_MTU_CHANGE = NSS_IF_MTU_CHANGE, |  | ||||||
| 	NSS_VIRT_IF_MAC_ADDR_SET = NSS_IF_MAC_ADDR_SET, |  | ||||||
| 	NSS_VIRT_IF_STATS_SYNC = NSS_IF_STATS, |  | ||||||
| 	NSS_VIRT_IF_ISHAPER_ASSIGN = NSS_IF_ISHAPER_ASSIGN, |  | ||||||
| 	NSS_VIRT_IF_BSHAPER_ASSIGN = NSS_IF_BSHAPER_ASSIGN, |  | ||||||
| 	NSS_VIRT_IF_ISHAPER_UNASSIGN = NSS_IF_ISHAPER_UNASSIGN, |  | ||||||
| 	NSS_VIRT_IF_BSHAPER_UNASSIGN = NSS_IF_BSHAPER_UNASSIGN, |  | ||||||
| 	NSS_VIRT_IF_ISHAPER_CONFIG = NSS_IF_ISHAPER_CONFIG, |  | ||||||
| 	NSS_VIRT_IF_BSHAPER_CONFIG = NSS_IF_BSHAPER_CONFIG, |  | ||||||
| 	NSS_VIRT_IF_VSI_ASSIGN = NSS_IF_VSI_ASSIGN, |  | ||||||
| 	NSS_VIRT_IF_VSI_UNASSIGN = NSS_IF_VSI_UNASSIGN, |  | ||||||
| 	NSS_VIRT_IF_TX_CONFIG_MSG = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_VIRT_IF_STATS_SYNC_MSG, |  | ||||||
| 	NSS_VIRT_IF_MAX_MSG_TYPES, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_error_types |  | ||||||
|  *	Error types for the virtual interface. |  | ||||||
|  */ |  | ||||||
| enum nss_virt_if_error_types { |  | ||||||
| 	NSS_VIRT_IF_SUCCESS, |  | ||||||
| 	NSS_VIRT_IF_CORE_FAILURE, |  | ||||||
| 	NSS_VIRT_IF_ALLOC_FAILURE, |  | ||||||
| 	NSS_VIRT_IF_DYNAMIC_IF_FAILURE, |  | ||||||
| 	NSS_VIRT_IF_MSG_TX_FAILURE, |  | ||||||
| 	NSS_VIRT_IF_REG_FAILURE, |  | ||||||
| 	NSS_VIRT_IF_CORE_NOT_INITIALIZED, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_base_node_stats |  | ||||||
|  *	Virtual interface statistics of NSS base node. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_base_node_stats { |  | ||||||
| 	uint32_t active_interfaces;	/**< Number of active virtual interfaces. */ |  | ||||||
| 	uint32_t ocm_alloc_failed;	/**< Number of interface allocation failure on OCM. */ |  | ||||||
| 	uint32_t ddr_alloc_failed;	/**< Number of interface allocation failure on DDR. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_interface_stats |  | ||||||
|  *	Virtual interface statistics of each pair of interfaces. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_interface_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common statistics. */ |  | ||||||
| 	uint32_t tx_enqueue_failed;		/**< Tx enqueue failures in the firmware. */ |  | ||||||
| 	uint32_t shaper_enqueue_failed;		/**< Shaper enqueue failures in the firmware. */ |  | ||||||
| 	uint32_t ocm_alloc_failed;		/**< Number of allocation failure on OCM. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_stats |  | ||||||
|  *	Virtual interface statistics received from the NSS. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_stats { |  | ||||||
| 	struct nss_virt_if_base_node_stats base_stats; |  | ||||||
| 	struct nss_virt_if_interface_stats if_stats; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_config_msg |  | ||||||
|  *	Message information for configuring the virtual interface. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_config_msg { |  | ||||||
| 	uint32_t flags;			/**< Interface flags. */ |  | ||||||
| 	uint32_t sibling;		/**< Sibling interface number. */ |  | ||||||
| 	uint32_t nexthop;		/**< Next hop interface number. */ |  | ||||||
| 	uint8_t mac_addr[ETH_ALEN];	/**< MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_msg |  | ||||||
|  *	Data for sending and receiving virtual interface messages. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a virtual interface message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		union nss_if_msgs if_msgs; |  | ||||||
| 				/**< NSS interface base message. */ |  | ||||||
| 		struct nss_virt_if_config_msg if_config; |  | ||||||
| 				/**< Rule for creating a virtual interface. */ |  | ||||||
| 		struct nss_virt_if_stats stats; |  | ||||||
| 				/**< Virtual interface statistics. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_virt_if_pvt |  | ||||||
|  *	Private data information for the virtual interface. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_pvt { |  | ||||||
| 	struct semaphore sem; |  | ||||||
| 			/**< Semaphore to ensure that only one instance of a message is sent to the NSS. */ |  | ||||||
| 	struct completion complete; |  | ||||||
| 			/**< Waits for message completion or time out. */ |  | ||||||
| 	int response;		/**< Message process response from the NSS firmware. */ |  | ||||||
| 	int sem_init_done;	/**< Semaphore initialization is done. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback to transmit virtual interface data received from NSS |  | ||||||
|  * to the transmit path of the virtual interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * @param[in] skb     Pointer to the data socket buffer. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_virt_if_xmit_callback_t)(struct net_device *netdev, struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for virtual interface 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_virt_if_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for virtual interface 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_virt_if_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_handle |  | ||||||
|  *	Context information for WLAN-to-NSS communication. |  | ||||||
|  */ |  | ||||||
| struct nss_virt_if_handle { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx;	/**< NSS context. */ |  | ||||||
| 	int32_t if_num_n2h;			/**< Redirect interface number on NSS-to-host path. */ |  | ||||||
| 	int32_t if_num_h2n;			/**< Redirect interface number on host-to-NSS path. */ |  | ||||||
| 	struct net_device *ndev;		/**< Associated network device. */ |  | ||||||
| 	struct nss_virt_if_pvt *pvt;		/**< Private data structure. */ |  | ||||||
| 	struct nss_virt_if_stats stats;		/**< Virtual interface statistics. */ |  | ||||||
| 	atomic_t refcnt;			/**< Reference count. */ |  | ||||||
| 	nss_virt_if_msg_callback_t cb;		/**< Message callback. */ |  | ||||||
| 	void *app_data;		/**< Application data to be passed to the callback. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_dp_type |  | ||||||
|  *	Virtual interface datapath types. Redirect interface on NSS-to-host path will be seen by ECM for rules. |  | ||||||
|  */ |  | ||||||
| enum nss_virt_if_dp_type { |  | ||||||
| 	NSS_VIRT_IF_DP_REDIR_N2H,		/**< Redirect interface on NSS-to-host path has zero value. */ |  | ||||||
| 	NSS_VIRT_IF_DP_REDIR_H2N,		/**< Redirect interface on host-to-NSS path has non-zero value. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_create |  | ||||||
|  *	Creates a virtual interface asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_virt_if_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev    Pointer to the associated network device. |  | ||||||
|  * @param[in] cb        Callback function for the message. This callback is |  | ||||||
|                         invoked when the response from the firmware is received. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern int nss_virt_if_create(struct net_device *netdev, nss_virt_if_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_create_sync |  | ||||||
|  *	Creates a virtual interface synchronously with the default nexthop values |  | ||||||
|  *	NSS_N2H_INTERFACE and NSS_ETH_RX_INTERFACE. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to nss_virt_if_handle. |  | ||||||
|  */ |  | ||||||
| extern struct nss_virt_if_handle *nss_virt_if_create_sync(struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_create_sync_nexthop |  | ||||||
|  *	Creates a virtual interface synchronously with specified nexthops. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] netdev       Pointer to the associated network device. |  | ||||||
|  * @param[in] nexthop_n2h  Nexthop interface number of network-to-host dynamic interface. |  | ||||||
|  * @param[in] nexthop_h2n  Nexthop interface number of host-to-network dynamic interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to NSS virtual interface handle. |  | ||||||
|  */ |  | ||||||
| extern struct nss_virt_if_handle *nss_virt_if_create_sync_nexthop(struct net_device *netdev, uint32_t nexthop_n2h, uint32_t nexthop_h2n); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_destroy |  | ||||||
|  *	Destroys the virtual interface asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle \n |  | ||||||
|  * nss_virt_if_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle    Pointer to the virtual interface handle (provided during |  | ||||||
|  *                          dynamic interface allocation). |  | ||||||
|  * @param[in]     cb        Callback function for the message. This callback is |  | ||||||
|  *                          invoked when the response from the firmware is received. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously created. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_virt_if_destroy(struct nss_virt_if_handle *handle, nss_virt_if_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_destroy_sync |  | ||||||
|  *	Destroys the virtual interface synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the virtual interface handle (provided during |  | ||||||
|  *                        dynamic interface allocation). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The interface must have been previously created. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_virt_if_destroy_sync(struct nss_virt_if_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_tx_msg |  | ||||||
|  *	Sends a message to the virtual interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_virt_if_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context (provided during registration). |  | ||||||
|  * @param[in] nvim     Pointer to the virtual interface message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Command Tx status. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_virt_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_virt_if_msg *nvim); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_tx_buf |  | ||||||
|  *	Forwards virtual interface packets to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the virtual interface handle (provided during |  | ||||||
|  *                        registration). |  | ||||||
|  * @param[in]    skb     Pointer to the data socket buffer. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_virt_if_tx_buf(struct nss_virt_if_handle *handle, |  | ||||||
| 						struct sk_buff *skb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_xmit_callback_register |  | ||||||
|  *	Registers a transmit callback to a virtual interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle \n |  | ||||||
|  * nss_virt_if_xmit_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle        Pointer to the virtual interface handle (provided during |  | ||||||
|  *                              dynamic interface allocation). |  | ||||||
|  * @param[in]    cb             Callback handler for virtual data packets. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_virt_if_xmit_callback_register(struct nss_virt_if_handle *handle, |  | ||||||
| 				nss_virt_if_xmit_callback_t cb); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_xmit_callback_unregister |  | ||||||
|  *	Deregisters the transmit callback from the virtual interface. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the virtual interface handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_virt_if_xmit_callback_unregister(struct nss_virt_if_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_register |  | ||||||
|  *	Registers a virtual Interface with NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle \n |  | ||||||
|  * nss_virt_if_data_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle        Pointer to the virtual interface handle(provided during |  | ||||||
|  *                              dynamic interface allocation). |  | ||||||
|  * @param[in]    data_callback  Callback handler for virtual data packets |  | ||||||
|  * @param[in]    netdev         Pointer to the associated network device. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern void nss_virt_if_register(struct nss_virt_if_handle *handle, |  | ||||||
| 					nss_virt_if_data_callback_t data_callback, |  | ||||||
| 					struct net_device *netdev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_unregister |  | ||||||
|  *	Deregisters a virtual interface from the NSS driver. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle |  | ||||||
|  * |  | ||||||
|  * @param[in,out] handle  Pointer to the virtual interface handle. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_virt_if_unregister(struct nss_virt_if_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_get_interface_num |  | ||||||
|  *	Returns the virtual interface number associated with the handle. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_virt_if_handle |  | ||||||
|  * |  | ||||||
|  * @param[in] handle  Pointer to the virtual interface handle(provided during |  | ||||||
|                       dynamic interface allocation). |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Virtual interface number. |  | ||||||
|  */ |  | ||||||
| extern int32_t nss_virt_if_get_interface_num(struct nss_virt_if_handle *handle); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_verify_if_num |  | ||||||
|  *	Verifies if the interface is 802.3 redirect type. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Interface number to be verified. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if if_num is 802.3 redirect type. |  | ||||||
|  */ |  | ||||||
| bool nss_virt_if_verify_if_num(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_virt_if_get_context |  | ||||||
|  *	Gets the virtual interface context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_virt_if_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_VIRT_IF_H */ |  | ||||||
| @@ -1,265 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 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_vlan.h |  | ||||||
|  *	NSS VLAN interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_VLAN_H |  | ||||||
| #define __NSS_VLAN_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_vlan_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_msg_types |  | ||||||
|  *	VLAN message types. |  | ||||||
|  */ |  | ||||||
| enum nss_vlan_msg_types { |  | ||||||
| 	NSS_VLAN_MSG_ADD_TAG = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_VLAN_MSG_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_error_types |  | ||||||
|  *	VLAN error types |  | ||||||
|  */ |  | ||||||
| enum nss_vlan_error_types { |  | ||||||
| 	NSS_VLAN_ERROR_UNKNOWN_MSG = NSS_IF_ERROR_TYPE_MAX + 1, |  | ||||||
| 	NSS_VLAN_ERROR_TYPE_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| #define NSS_VLAN_TYPE_SINGLE 0	/**< Single VLAN tag in message. */ |  | ||||||
| #define NSS_VLAN_TYPE_DOUBLE 1	/**< Double VLAN tag in message. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_msg_add_tag |  | ||||||
|  *	VLAN message data for adding a VLAN tag. |  | ||||||
|  */ |  | ||||||
| struct nss_vlan_msg_add_tag { |  | ||||||
| 	uint32_t vlan_tag;	/**< VLAN tag information. */ |  | ||||||
| 	uint32_t next_hop;	/**< Parent interface. */ |  | ||||||
| 	uint32_t if_num;	/**< Actual physical interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_msg |  | ||||||
|  *	Data for sending and receiving VLAN messages. |  | ||||||
|  */ |  | ||||||
| struct nss_vlan_msg { |  | ||||||
| 	struct nss_cmn_msg cm;		/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a VLAN message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		union nss_if_msgs if_msg; |  | ||||||
| 				/**< NSS interface base messages. */ |  | ||||||
| 		struct nss_vlan_msg_add_tag add_tag; |  | ||||||
| 				/**< VLAN add-a-tag message. */ |  | ||||||
| 	} msg;			/**< Message payload. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_msg |  | ||||||
|  *	Sends a VLAN message to the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_vlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_vlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_msg_sync |  | ||||||
|  *	Sends a VLAN message to the NSS synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_vlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] msg      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_vlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Initializes a VLAN message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_vlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in,out] ncm       Pointer to the message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the payload. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_vlan_msg_init(struct nss_vlan_msg *ncm, uint16_t if_num, uint32_t type,  uint32_t len, void *cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_get_context |  | ||||||
|  *	Gets the VLAN context used in nss_vlan_tx. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_vlan_get_context(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback when VLAN data is received |  | ||||||
|  * |  | ||||||
|  * @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_vlan_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback to receive VLAN messages |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_vlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @param[in] msg       Pointer to the message data. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_vlan_msg_callback_t)(void *app_data, struct nss_vlan_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_vlan_if |  | ||||||
|  *	Register to send/receive VLAN messages to NSS |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_vlan_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num              NSS interface number. |  | ||||||
|  * @param[in] vlan_data_callback  Callback for the data. |  | ||||||
|  * @param[in] netdev              Pointer to the associated network device. |  | ||||||
|  * @param[in] features            Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] app_ctx             Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_register_vlan_if(uint32_t if_num, nss_vlan_callback_t vlan_data_callback, |  | ||||||
| 					      struct net_device *netdev, uint32_t features, void *app_ctx); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Deregisters the VLAN interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_unregister_vlan_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_set_mtu_msg |  | ||||||
|  *	Sends a VLAN message to set the MTU. |  | ||||||
|  * |  | ||||||
|  * @param[in] vlan_if_num  VLAN interface number. |  | ||||||
|  * @param[in] mtu          MTU value to set. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_set_mtu_msg(uint32_t vlan_if_num, uint32_t mtu); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_set_mac_addr_msg |  | ||||||
|  *	Sends a VLAN message to set the MAC address. |  | ||||||
|  * |  | ||||||
|  * @param[in] vlan_if_num  VLAN interface number. |  | ||||||
|  * @param[in] addr         Pointer to the MAC address. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_set_mac_addr_msg(uint32_t vlan_if_num, uint8_t *addr); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_vsi_attach_msg |  | ||||||
|  *	Send a VLAN message to attach a VSI. |  | ||||||
|  * |  | ||||||
|  * @param[in] vlan_if_num  VLAN interface number. |  | ||||||
|  * @param[in] vsi          PPE VSI to attach. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_vsi_attach_msg(uint32_t vlan_if_num, uint32_t vsi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_vsi_detach_msg |  | ||||||
|  *	Sends a VLAN message to detach VSI. |  | ||||||
|  * |  | ||||||
|  * @param[in] vlan_if_num  VLAN interface number. |  | ||||||
|  * @param[in] vsi          VSI to detach. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_vsi_detach_msg(uint32_t vlan_if_num, uint32_t vsi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vlan_tx_add_tag_msg |  | ||||||
|  *	Sends a VLAN add tag message. |  | ||||||
|  * |  | ||||||
|  * @param[in] vlan_if_num   VLAN interface number. |  | ||||||
|  * @param[in] vlan_tag      VLAN tag information. |  | ||||||
|  * @param[in] next_hop      Parent interface. |  | ||||||
|  * @param[in] physical_dev  Physical port to which to add the VLAN tag. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_vlan_tx_add_tag_msg(uint32_t vlan_if_num, uint32_t vlan_tag, uint32_t next_hop, uint32_t physical_dev); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Registers the VLAN handler with the NSS. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_vlan_register_handler(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif /* __NSS_VLAN_H */ |  | ||||||
| @@ -1,350 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_vxlan.h |  | ||||||
|  *	NSS VxLAN interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_VXLAN_H |  | ||||||
| #define __NSS_VXLAN_H |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @addtogroup nss_vxlan_subsystem |  | ||||||
|  * @{ |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported VxLAN tunnel sessions. |  | ||||||
|  */ |  | ||||||
| #define NSS_VXLAN_MAX_TUNNELS 64 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Maximum number of supported VxLAN FDB entries. |  | ||||||
|  */ |  | ||||||
| #define NSS_VXLAN_MACDB_ENTRIES_MAX 1024 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * MAC database entries per message. |  | ||||||
|  */ |  | ||||||
| #define NSS_VXLAN_MACDB_ENTRIES_PER_MSG 20 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  *  VxLAN Rule configure message flags |  | ||||||
|  */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_GBP_ENABLED 0x0001			/**< Group Policy ID is eanbled. */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_INHERIT_TOS 0x0002			/**< Use inner TOS for encapsulation. */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_ENCAP_L4_CSUM_REQUIRED 0x0004	/**< Generate transmit checksum. */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_IPV4 0x0010				/**< IPv4 tunnel. */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_IPV6 0x0020				/**< IPv6 tunnel. */ |  | ||||||
| #define NSS_VXLAN_RULE_FLAG_UDP 0x0100				/**< UDP tunnel. */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_msg_type |  | ||||||
|  *	Message types for VxLAN tunnel. |  | ||||||
|  */ |  | ||||||
| enum nss_vxlan_msg_type { |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_STATS_SYNC,		/**< Statistics synchronization message. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_TUN_CONFIGURE,	/**< Creating tunnel rule. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_TUN_UNCONFIGURE,	/**< Destroying tunnel rule. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_TUN_ENABLE,		/**< Enable the tunnel. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_TUN_DISABLE,		/**< Disable the tunnel. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_MAC_ADD,		/**< Add MAC rule to the database. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_MAC_DEL,		/**< Remove MAC rule from the database. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_MACDB_STATS,		/**< MAC database statistics synchronization message. */ |  | ||||||
| 	NSS_VXLAN_MSG_TYPE_MAX,			/**< Maximum message type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_error_response_types |  | ||||||
|  *	Error types for VxLAN responses to messages from the host. |  | ||||||
|  */ |  | ||||||
| enum nss_vxlan_error_type { |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_NONE = 1,			/**< Unknown type error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_DECAP_REGISTER_FAIL,	/**< Decapsulation node registration failed. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_DEST_IP_MISMATCH,		/**< Destination IP address mismatch. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_INVALID_VNI,		/**< Invalid virtual network ID. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_INVALID_L3_PROTO,		/**< L3 Protocol is invalid error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_INVALID_UDP_PROTO,		/**< UDP Protocol is invalid error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_INVALID_SRC_PORT,		/**< Source port range is invalid. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_BAD_ENTRY,		/**< MAC table has a bad entry. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_EXISTS,		/**< MAC entry exists in the table error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_NOT_EXIST,		/**< MAC does not exist in the table error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_ENTRY_UNHASHED,	/**< MAC entry is not hashed in table. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_ENTRY_ALLOC_FAILED,	/**< MAC entry allocation failed. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_ENTRY_DELETE_FAILED,	/**< MAC entry deletion failed. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAC_TABLE_FULL,		/**< MAC table is full error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_SIBLING_NODE_NOT_EXIST,	/**< Sibling node does not exist. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_CONFIGURED,		/**< Tunnel is already configured. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_UNCONFIGURED,	/**< Tunnel is not configured. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_ADD_FAILED,		/**< Adding tunnel information failed. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_DISABLED,		/**< Tunnel is already disabled error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_ENABLED,		/**< Tunnel is already enabled error. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_TUNNEL_ENTRY_EXISTS,	/**< Tunnel already exists. */ |  | ||||||
| 	NSS_VXLAN_ERROR_TYPE_MAX,			/**< Maximum error type. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_stats_msg |  | ||||||
|  *	Per-tunnel statistics messages from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_stats_msg { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Common firmware statistics. */ |  | ||||||
| 	uint32_t except_mac_db_lookup_failed;	/**< MAC database look up failed. */ |  | ||||||
| 	uint32_t except_mac_move;		/**< User is moved. */ |  | ||||||
| 	uint32_t except_low_hroom;		/**< Transmit exception due to insufficient headroom. */ |  | ||||||
| 	uint32_t except_no_policy_id;		/**< Policy ID does not exist. */ |  | ||||||
| 	uint32_t except_extra_vxlan_hdr_flags;	/**< More flags are set than NSS can process. */ |  | ||||||
| 	uint32_t except_vni_lookup_failed;	/**< Virtual network ID look up failed. */ |  | ||||||
| 	uint32_t dropped_malformed;		/**< Packet is malformed. */ |  | ||||||
| 	uint32_t dropped_next_node_queue_full;	/**< Next node dropped the packet. */ |  | ||||||
| 	uint32_t except_inner_hash;		/**< Inner hash calculation failed. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_rule_msg |  | ||||||
|  *	 VxLAN rule message. |  | ||||||
|  * |  | ||||||
|  * The same rule structure applies for both encapsulation and decapsulation |  | ||||||
|  * in a tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_rule_msg { |  | ||||||
| 	/* |  | ||||||
| 	 * VxLAN Rules |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t sibling_if_num;	/**< Sibling node interface number. */ |  | ||||||
| 	uint32_t vni;			/**< Virtual network ID. */ |  | ||||||
| 	uint16_t tunnel_flags;		/**< VxLAN tunnel flags. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * IP rules |  | ||||||
| 	 */ |  | ||||||
| 	uint16_t flow_label;		/**< Flow label. */ |  | ||||||
| 	uint8_t tos;			/**< Type of service/traffic class. */ |  | ||||||
| 	uint8_t ttl;			/**< TTL/Hop Limit. */ |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * L4 rules |  | ||||||
| 	 */ |  | ||||||
| 	uint16_t src_port_min;		/**< Minimum permissible port number. */ |  | ||||||
| 	uint16_t src_port_max;		/**< Maximum permissible port number. */ |  | ||||||
| 	uint16_t dest_port;		/**< UDP destination port. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_encap_rule |  | ||||||
|  *	Encapsulation information for a VxLAN tunnel. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_encap_rule { |  | ||||||
| 	uint32_t src_ip[4];	/**< Source IP. */ |  | ||||||
| 	uint32_t dest_ip[4];	/**< Destination IP. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_mac_msg |  | ||||||
|  *	VxLAN MAC message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_mac_msg { |  | ||||||
| 	struct nss_vxlan_encap_rule encap; |  | ||||||
| 					/**< Tunnel encapsulation header. */ |  | ||||||
| 	uint32_t vni;			/**< VxLAN network identifier. */ |  | ||||||
| 	uint16_t mac_addr[3];		/**< MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_macdb_stats_entry |  | ||||||
|  *	MAC database statistics entry. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_macdb_stats_entry { |  | ||||||
| 	uint32_t hits;			/**< Total hash hits on this hash entry. */ |  | ||||||
| 	uint16_t mac[3];		/**< MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_macdb_stats_msg |  | ||||||
|  *	VxLAN MAC database statistics. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_macdb_stats_msg { |  | ||||||
| 	uint16_t cnt;			/**< Number of MAC database entries copied. */ |  | ||||||
| 	uint16_t reserved;		/**< Reserved for future use. */ |  | ||||||
| 	struct nss_vxlan_macdb_stats_entry entry[NSS_VXLAN_MACDB_ENTRIES_PER_MSG]; |  | ||||||
| 					/**< MAC database entries. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_msg |  | ||||||
|  *	Data structure for sending and receiving VxLAN messages. |  | ||||||
|  */ |  | ||||||
| struct nss_vxlan_msg { |  | ||||||
| 	struct nss_cmn_msg cm;			/**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of a VxLAN message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_vxlan_stats_msg stats; |  | ||||||
| 				/**< Synchronized statistics for the VxLAN interface. */ |  | ||||||
| 		struct nss_vxlan_rule_msg vxlan_create; |  | ||||||
| 				/**< Allocate VxLAN tunnel node. */ |  | ||||||
| 		struct nss_vxlan_rule_msg vxlan_destroy; |  | ||||||
| 				/**< Destroy VxLAN tunnel node. */ |  | ||||||
| 		struct nss_vxlan_mac_msg mac_add; |  | ||||||
| 				/**< MAC add message for UDP encapsulation. */ |  | ||||||
| 		struct nss_vxlan_mac_msg mac_del; |  | ||||||
| 				/**< MAC delete message. */ |  | ||||||
| 		struct nss_vxlan_macdb_stats_msg db_stats; |  | ||||||
| 				/**< MAC database statistics. */ |  | ||||||
| 	} msg;			/**< Payload for VxLAN tunnel messages exchanged with the NSS core. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving VxLAN tunnel 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_vxlan_buf_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving VxLAN 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_vxlan_msg_callback_t)(void *app_data, struct nss_cmn_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_tx_msg |  | ||||||
|  *	Sends VxLAN tunnel messages to the NSS. |  | ||||||
|  * |  | ||||||
|  * Do not call this function from a softirq or interrupt because it |  | ||||||
|  * might sleep if the NSS firmware is busy serving another host thread. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_vxlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] nvm      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_vxlan_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_vxlan_msg *nvm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_tx_msg_sync |  | ||||||
|  *	Sends a VxLAN message to the NSS synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_vxlan_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] nvm      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the Tx operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_vxlan_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_vxlan_msg *nvm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_unregister_if |  | ||||||
|  *	Deregisters the VxLAN interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern bool nss_vxlan_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_register_if |  | ||||||
|  *	Registers the VxLAN interface with the NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_vxlan_buf_callback_t \n |  | ||||||
|  * nss_vxlan_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num             NSS interface number. |  | ||||||
|  * @param[in] type               Dynamic interface type. |  | ||||||
|  * @param[in] data_cb            Callback for the data. |  | ||||||
|  * @param[in] notify_cb          Callback for the message. |  | ||||||
|  * @param[in] netdev             Pointer to the associated network device. |  | ||||||
|  * @param[in] features           Data socket buffer types supported by this interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_vxlan_register_if(uint32_t if_num, uint32_t type, nss_vxlan_buf_callback_t data_cb, |  | ||||||
| 					nss_vxlan_msg_callback_t notify_cb, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_register_handler |  | ||||||
|  *	Initializes VxLAN module in NSS |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_vxlan_init(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_msg_init |  | ||||||
|  *	Initializes a VxLAN message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_vxlan_msg \n |  | ||||||
|  * nss_vxlan_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in,out] nvm       Pointer to the VxLAN tunnel message. |  | ||||||
|  * @param[in]     if_num    NSS interface number. |  | ||||||
|  * @param[in]     type      Type of message. |  | ||||||
|  * @param[in]     len       Size of the message. |  | ||||||
|  * @param[in]     cb        Pointer to the message callback. |  | ||||||
|  * @param[in]     app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| extern void nss_vxlan_msg_init(struct nss_vxlan_msg *nvm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 				nss_vxlan_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_vxlan_get_ctx() |  | ||||||
|  *	Get VxLAN context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_vxlan_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @} |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| /* __NSS_VXLAN_H */ |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,297 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * @file nss_wifi_ext_vdev_if.h |  | ||||||
|  *	NSS Wi-Fi extended virtual device interface definitions. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __NSS_WIFI_EXT_VDEV_IF_H |  | ||||||
| #define __NSS_WIFI_EXT_VDEV_IF_H |  | ||||||
|  |  | ||||||
| #define NSS_WIFI_EXT_VDEV_MAX 16 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_wifi_ext_vdev_msg_types |  | ||||||
|  *	WiFi extension virtual device mesage types. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_ext_vdev_msg_types { |  | ||||||
| 	NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_IF = NSS_IF_MAX_MSG_TYPES + 1, |  | ||||||
| 	NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_WDS, |  | ||||||
| 	NSS_WIFI_EXT_VDEV_SET_NEXT_HOP, |  | ||||||
| 	NSS_WIFI_EXT_VDEV_MSG_STATS_SYNC, |  | ||||||
| 	NSS_WIFI_EXT_VDEV_MSG_CONFIGURE_VLAN, |  | ||||||
| 	NSS_WIFI_EXT_VDEV_MSG_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_error_tyes |  | ||||||
|  *	WiFi extension error types. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_ext_vdev_error_types { |  | ||||||
| 	NSS_WIFI_EXT_VDEV_ERROR_NONE = NSS_IF_ERROR_TYPE_MAX + 1, |  | ||||||
| 						/** Configuration successful. */ |  | ||||||
| 	NSS_WIFI_EXT_VDEV_ERROR_NULL_MAC,		/**< NULL MAC received. */ |  | ||||||
| 	NSS_WIFI_EXT_VDEV_ERROR_INV_RADIO_ID,	/**< Invalid radio 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_INV_IF,		/**< Message sent on invalid interface number. */ |  | ||||||
| 	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 |  | ||||||
|  *	Extended WDS configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_ext_vdev_wds_msg { |  | ||||||
| 	uint16_t wds_peer_id;	/**< WDS station peer ID. */ |  | ||||||
| 	uint16_t mac_addr[3];	/**< Remote MAC address. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_stats |  | ||||||
|  *	Statistics message structure. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_ext_vdev_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats;	/**< Ethernet node statistics. */ |  | ||||||
| 	uint32_t mc_count;			/**< Number of mulitcast counts. */ |  | ||||||
| 	uint32_t nxt_hop_drp;			/**< Next hop drop. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_vdev_config_msg |  | ||||||
|  *	NSS Wi-Fi virtual device configuration message. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_ext_vdev_configure_if_msg { |  | ||||||
| 	uint8_t mac_addr[ETH_ALEN];	/**< MAC address. */ |  | ||||||
| 	uint16_t radio_ifnum;		/**< Radio interface corresponding to virtual AP. */ |  | ||||||
| 	uint16_t pvap_ifnum;		/**< Parent virtual device interface number. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_set_next_hop_msg |  | ||||||
|  *	Message to set the next hop. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_ext_vdev_set_next_hop_msg { |  | ||||||
| 	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 |  | ||||||
|  *	Message structure to Send/Receive commands. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_ext_vdev_msg { |  | ||||||
| 	struct nss_cmn_msg cm;				/**< Cnode message. */ |  | ||||||
| 	union { |  | ||||||
| 		union nss_if_msgs if_msg; /**< NSS interface base message. */ |  | ||||||
| 		struct nss_wifi_ext_vdev_configure_if_msg cmsg;	/**< Interface configuration 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_stats stats;	/**< Statistics messasge. */ |  | ||||||
| 		struct nss_wifi_ext_vdev_vlan_msg vmsg;	/**< VLAN message. */ |  | ||||||
| 	} msg; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving Wi-Fi extended virtual device 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_ext_vdev_data_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving Wi-Fi extended virtual device messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_wifi_ext_vdev_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * @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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Callback function for receiving extended data from the Wi-Fi extended virtual device interface. |  | ||||||
|  * |  | ||||||
|  * @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. |  | ||||||
|  * @param[in] netdev  Pointer to the associated network device. |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_wifi_ext_vdev_ext_data_callback_t)(struct net_device *netdev, |  | ||||||
| 				struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_msg_init |  | ||||||
|  *	Initializes a Wi-Fi extended virtual device message. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_wifi_vdev_msg \n |  | ||||||
|  * nss_wifi_vdev_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] nim       Pointer to the NSS interface message. |  | ||||||
|  * @param[in] if_num    NSS interface number. |  | ||||||
|  * @param[in] type      Type of message. |  | ||||||
|  * @param[in] len       Length of message. |  | ||||||
|  * @param[in] cb        Message callback. |  | ||||||
|  * @param[in] app_data  Pointer to the application context of the message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  */ |  | ||||||
| void nss_wifi_ext_vdev_msg_init(struct nss_wifi_ext_vdev_msg *nim, uint32_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 				nss_wifi_ext_vdev_msg_callback_t cb, void *app_data); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_unregister_if |  | ||||||
|  *      Deregisters a Wi-Fi extended virtual interface from the NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num  Wi-Fi extended virtual interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * None. |  | ||||||
|  * |  | ||||||
|  * @dependencies |  | ||||||
|  * The Wi-Fi extended virtual interface must have been previously registered. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * True if successful, else false. |  | ||||||
|  */ |  | ||||||
| extern bool nss_wifi_ext_vdev_unregister_if(uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_tx_buf |  | ||||||
|  *      Sends data buffers to NSS firmware asynchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * sk_buff |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] os_buf   Pointer to the OS buffer (e.g. skbuff). |  | ||||||
|  * @param[in] if_num   Wi-Fi extended virtual interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_wifi_ext_vdev_tx_buf(struct nss_ctx_instance *nss_ctx, struct sk_buff *os_buf, |  | ||||||
| 		uint32_t if_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_tx_msg |  | ||||||
|  *	Sends Wi-Fi extended virtual interface messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_wifi_ext_vdev_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx  Pointer to the NSS context. |  | ||||||
|  * @param[in] wevm      Pointer to the message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_wifi_ext_vdev_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_wifi_ext_vdev_msg *wevm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_tx_msg_sync |  | ||||||
|  *	Sends messages to NSS firmware synchronously. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_wifi_ext_vdev_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx   NSS core context. |  | ||||||
|  * @param[in] nwevm     Pointer to Wi-Fi extended virtual interface message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Status of the transmit operation. |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_wifi_ext_vdev_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_wifi_ext_vdev_msg *nwevm); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_set_next_hop |  | ||||||
|  *	Sets the extended virtual interface next hop. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * |  | ||||||
|  * @param[in] ctx      NSS core context. |  | ||||||
|  * @param[in] if_num   NSS 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); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_get_ctx |  | ||||||
|  *	Gets the NSS Wi-Fi extended virtual interface context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * Pointer to the NSS core context. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_wifi_ext_vdev_get_ctx(void); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_ext_vdev_register_if |  | ||||||
|  *      Registers Wi-Fi extended virtual interface with NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * net_device \n |  | ||||||
|  * nss_wifi_ext_vdev_data_callback_t \n |  | ||||||
|  * nss_wifi_ext_vdev_ext_data_callback_t \n |  | ||||||
|  * nss_wifi_ext_vdev_msg_callback_t |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num         NSS interface number. |  | ||||||
|  * @param[in] cb_func_data   Callback for the data. |  | ||||||
|  * @param[in] cb_func_ext    Callback for the message. |  | ||||||
|  * @param[in] cb_func_msg    Callback for the event message. |  | ||||||
|  * @param[in] features       Data socket buffer types supported by this interface. |  | ||||||
|  * @param[in] netdev         Pointer to the associated network device. |  | ||||||
|  * @param[in] app_ctx        Pointer to the application context. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * NSS interface number allocated. |  | ||||||
|  */ |  | ||||||
| extern struct nss_ctx_instance *nss_wifi_ext_vdev_register_if(uint32_t if_num, |  | ||||||
| 		nss_wifi_ext_vdev_data_callback_t cb_func_data, nss_wifi_ext_vdev_ext_data_callback_t cb_func_ext, |  | ||||||
| 		nss_wifi_ext_vdev_msg_callback_t cb_func_msg, struct net_device *netdev, uint32_t features, |  | ||||||
| 		void *app_ctx); |  | ||||||
| #endif |  | ||||||
| @@ -1,277 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * 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. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
|  /** |  | ||||||
|   * @file nss_wifi_mac_db_if.h |  | ||||||
|   *	NSS-to-HLOS interface definitions. |  | ||||||
|   */ |  | ||||||
| #ifndef __NSS_WIFI_MAC_DB_H |  | ||||||
| #define __NSS_WIFI_MAC_DB_H |  | ||||||
|  |  | ||||||
| #define NSS_WIFI_MAC_DB_ENTRY_IF_LOCAL 0x1 |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * MAX Wi-Fi MAC database entries sent in group |  | ||||||
|  * is chosen considering the entry size and |  | ||||||
|  * maximum entries a smallest buffer could accomodate. |  | ||||||
|  */ |  | ||||||
| #define NSS_WIFI_MAC_DB_GROUP_ENTRIES_MAX 48 |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_msg_types |  | ||||||
|  *	Wi-Fi MAC database messages. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_mac_db_msg_types { |  | ||||||
| 	NSS_WIFI_MAC_DB_INIT_MSG,		/**< Wi-Fi MAC database initialization message. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ADD_ENTRY_MSG,		/**< Wi-Fi MAC database add entry message. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_DEL_ENTRY_MSG,		/**< Wi-Fi MAC database delete 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_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_iftype |  | ||||||
|  * 	Wi-Fi MAC database interface type. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_mac_db_iftype { |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IFTYPE_NONE, |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IFTYPE_VAP,	/**< Wi-Fi MAC database VAP entry interface. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IFTYPE_NON_VAP,	/**< Wi-Fi MAC database non-VAP entry interface. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IFTYPE_MAX	/**< Wi-Fi MAC database maximum interface. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_if_opmode |  | ||||||
|  * 	Wi-Fi MAC database interface operation mode. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_mac_db_if_opmode { |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_NONE,	/**< No entry database interface operation mode. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_ETH,	/**< Ethernet entry database interface operation mode. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_WIFI_AP,	/**< Wi-Fi AP entry database interface operation mode. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_WIFI_STA,	/**< Wi-Fi station entry database interface operation mode. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ENTRY_IF_OPMODE_MAX	/**< Maximum entry database interface operation mode. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Wi-Fi MAC database errors. |  | ||||||
|  */ |  | ||||||
| enum nss_wifi_mac_db_err_types { |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_NONE, |  | ||||||
| 		/**< Wi-Fi MAC database error none. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_ENTRY_ALLOC_FAIL, |  | ||||||
| 		/**< Error used to report a Wi-Fi MAC database entry pool allocation failure. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAC_EXISTS, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry already exists. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAC_TABLE_FULL, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC table is full. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAC_ENTRY_ALLOC_FAILED, |  | ||||||
| 		/**< Error used to report a Wi-Fi MAC database entry allocation failure. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_ENTRY_NOT_FOUND, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry is not present. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAC_ENTRY_UNHASHED, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry is unhashed. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAC_ENTRY_DELETE_FAILED, |  | ||||||
| 		/**< Error used to report a Wi-Fi MAC database entry delete failure. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_INVALID_NUM_ENTRIES_FAIL, |  | ||||||
| 		/**< Error used to report the number of invalid Wi-Fi MAC database entries. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_NOT_ALLOCATED_FAIL, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database is not allocated. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_INV_IF_RECVD_FAIL, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry interface is invalid. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_INVALID_EVENT, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database event is invalid. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_PN_INVALID, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry pnode is invalid. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_PHY_PN_INVALID, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry radio pnode is invalid. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_ENTRY_POOL_INVALID, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry pool is invalid. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_ENTRY_POOL_ALREADY_ALLOCATED, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database entry pool exists. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_GROUP_ENTRY_ADD_FAIL, |  | ||||||
| 		/**< Error used to report that a Wi-Fi MAC database group entry add failure. */ |  | ||||||
| 	NSS_WIFI_MAC_DB_ERROR_MAX, |  | ||||||
| 		/**< 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 |  | ||||||
|  *	Wi-Fi MAC database entry information. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_mac_db_entry_info_msg { |  | ||||||
| 	uint8_t mac_addr[ETH_ALEN];	/**< MAC address. */ |  | ||||||
| 	uint16_t flag;			/**< Flag information about NSS interface. */ |  | ||||||
| 	int32_t nss_if;		    	/**< NSS interface number. */ |  | ||||||
| 	uint32_t iftype;		/**< NSS interface type. */ |  | ||||||
| 	uint32_t opmode;		/**< NSS interface operation mode. */ |  | ||||||
| 	uint32_t wiphy_ifnum;		/**< NSS interface for wireless physical device. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_entry_group_info_msg |  | ||||||
|  *	Wi-Fi MAC database group of entries information. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_mac_db_entry_group_info_msg { |  | ||||||
| 	uint32_t num_entries; |  | ||||||
| 		/**< Number of entries in group information message. */ |  | ||||||
| 	struct nss_wifi_mac_db_entry_info_msg entry[NSS_WIFI_MAC_DB_GROUP_ENTRIES_MAX]; |  | ||||||
| 		/**< Wi-Fi MAC database information specific message. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_msg |  | ||||||
|  *	Structure that describes Wi-Fi MAC database messages. |  | ||||||
|  */ |  | ||||||
| struct nss_wifi_mac_db_msg { |  | ||||||
| 	struct nss_cmn_msg cm;                  /**< Common message header. */ |  | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Payload of Wi-Fi MAC database message. |  | ||||||
| 	 */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_wifi_mac_db_entry_info_msg nmfdbeimsg; |  | ||||||
| 				/**< Wi-Fi MAC database information specific message. */ |  | ||||||
| 		struct nss_wifi_mac_db_entry_group_info_msg nmfdbegimsg; |  | ||||||
| 				/**< 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. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_msg_callback_t |  | ||||||
|  *	Callback to receive Wi-Fi MAC database messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_wifi_mac_db_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] app_data Application context of the message. |  | ||||||
|  * @param[in] msg      Message data. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * void |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_wifi_mac_db_msg_callback_t)(void *app_data, struct nss_wifi_mac_db_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_callback_t |  | ||||||
|  *	Callback to receive Wi-Fi MAC database messages. |  | ||||||
|  * |  | ||||||
|  * @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. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * void |  | ||||||
|  */ |  | ||||||
| typedef void (*nss_wifi_mac_db_callback_t)(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_wifi_mac_db_tx_msg |  | ||||||
|  *	Send Wi-Fi MAC database messages. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_ctx_instance \n |  | ||||||
|  * nss_wifi_mac_db_msg |  | ||||||
|  * |  | ||||||
|  * @param[in] nss_ctx NSS context. |  | ||||||
|  * @param[in] msg     NSS Wi-Fi MAC database message. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * nss_tx_status_t Tx status |  | ||||||
|  */ |  | ||||||
| extern nss_tx_status_t nss_wifi_mac_db_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_wifi_mac_db_msg *msg); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_register_wifi_mac_db_if |  | ||||||
|  *	Register to send/receive Wi-Fi MAC database messages to NSS. |  | ||||||
|  * |  | ||||||
|  * @datatypes |  | ||||||
|  * nss_wifi_mac_db_callback_t \n |  | ||||||
|  * nss_wifi_mac_db_msg_callback_t \n |  | ||||||
|  * net_device |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num             NSS interface number. |  | ||||||
|  * @param[in] mfdb_callback      Callback for the Wi-Fi MAC database device data. |  | ||||||
|  * @param[in] mfdb_ext_callback  Callback for the extended data. |  | ||||||
|  * @param[in] event_callback     Callback for the message. |  | ||||||
|  * @param[in] netdev             Pointer to the associated network device. |  | ||||||
|  * @param[in] features           Data socket buffer types supported by this |  | ||||||
|  *                               interface. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * nss_ctx_instance* NSS context |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_register_wifi_mac_db_if(uint32_t if_num, nss_wifi_mac_db_callback_t wifi_mac_db_callback, |  | ||||||
| 			nss_wifi_mac_db_callback_t wifi_mac_db_ext_callback, nss_wifi_mac_db_msg_callback_t event_callback, struct net_device *netdev, uint32_t features); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * nss_unregister_wifi_mac_db_if |  | ||||||
|  *	Deregister Wi-Fi MAC database SoC interface with NSS. |  | ||||||
|  * |  | ||||||
|  * @param[in] if_num NSS interface number. |  | ||||||
|  * |  | ||||||
|  * @return |  | ||||||
|  * void |  | ||||||
|  */ |  | ||||||
| void nss_unregister_wifi_mac_db_if(uint32_t if_num); |  | ||||||
| struct nss_ctx_instance *nss_wifi_mac_db_get_context(void); |  | ||||||
| #endif /* __NSS_WIFI_MAC_DB_H */ |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,501 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_tx_rx_common.h" |  | ||||||
| #include "nss_bridge_log.h" |  | ||||||
|  |  | ||||||
| #define NSS_BRIDGE_TX_TIMEOUT 1000 /* 1 Second */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Private data structure |  | ||||||
|  */ |  | ||||||
| static struct nss_bridge_pvt { |  | ||||||
| 	struct semaphore sem; |  | ||||||
| 	struct completion complete; |  | ||||||
| 	int response; |  | ||||||
| 	void *cb; |  | ||||||
| 	void *app_data; |  | ||||||
| } bridge_pvt; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_handler() |  | ||||||
|  * 	Handle NSS -> HLOS messages for bridge |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, void *app_data) |  | ||||||
| { |  | ||||||
| 	struct nss_bridge_msg *nbm = (struct nss_bridge_msg *)ncm; |  | ||||||
| 	nss_bridge_msg_callback_t cb; |  | ||||||
|  |  | ||||||
| 	BUG_ON(!nss_is_dynamic_interface(ncm->interface)); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Is this a valid request/response packet? |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->type >= NSS_BRIDGE_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: received invalid message %d for bridge interface", nss_ctx, ncm->type); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_bridge_msg)) { |  | ||||||
| 		nss_warning("%px: length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Trace Messages |  | ||||||
| 	 */ |  | ||||||
| 	nss_bridge_log_rx_msg(nbm); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Log failures |  | ||||||
| 	 */ |  | ||||||
| 	nss_core_log_msg_failures(nss_ctx, ncm); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Update the callback and app_data for NOTIFY messages, IPv4 sends all notify messages |  | ||||||
| 	 * to the same callback/app_data. |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { |  | ||||||
| 		ncm->cb = (nss_ptr_t)nss_ctx->nss_top->bridge_callback; |  | ||||||
| 		ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->bridge_ctx; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Do we have a call back |  | ||||||
| 	 */ |  | ||||||
| 	if (!ncm->cb) { |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * callback |  | ||||||
| 	 */ |  | ||||||
| 	cb = (nss_bridge_msg_callback_t)ncm->cb; |  | ||||||
| 	cb((void *)ncm->app_data, nbm); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_get_context() |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_get_context(void) |  | ||||||
| { |  | ||||||
| 	return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.bridge_handler_id]; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_get_context); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_callback() |  | ||||||
|  *	Callback to handle the completion of NSS->HLOS messages. |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_callback(void *app_data, struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	nss_bridge_msg_callback_t callback = (nss_bridge_msg_callback_t)bridge_pvt.cb; |  | ||||||
| 	void *data = bridge_pvt.app_data; |  | ||||||
|  |  | ||||||
| 	bridge_pvt.response = NSS_TX_SUCCESS; |  | ||||||
| 	bridge_pvt.cb = NULL; |  | ||||||
| 	bridge_pvt.app_data = NULL; |  | ||||||
|  |  | ||||||
| 	if (nbm->cm.response != NSS_CMN_RESPONSE_ACK) { |  | ||||||
| 		nss_warning("bridge error response %d\n", nbm->cm.response); |  | ||||||
| 		bridge_pvt.response = nbm->cm.response; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (callback) { |  | ||||||
| 		callback(data, nbm); |  | ||||||
| 	} |  | ||||||
| 	complete(&bridge_pvt.complete); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_verify_if_num() |  | ||||||
|  *	Verify if_num passed to us. |  | ||||||
|  */ |  | ||||||
| bool nss_bridge_verify_if_num(uint32_t if_num) |  | ||||||
| { |  | ||||||
| 	if (nss_is_dynamic_interface(if_num) == false) { |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_dynamic_interface_get_type(nss_bridge_get_context(), if_num) != NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE) { |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_verify_if_num); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_msg() |  | ||||||
|  *	Transmit a bridge message to NSSFW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_bridge_msg *msg) |  | ||||||
| { |  | ||||||
| 	struct nss_cmn_msg *ncm = &msg->cm; |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Sanity check the message |  | ||||||
| 	 */ |  | ||||||
| 	if (!nss_is_dynamic_interface(ncm->interface)) { |  | ||||||
| 		nss_warning("%px: tx request for interface that is not a bridge: %d", nss_ctx, ncm->interface); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (ncm->type >= NSS_BRIDGE_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Trace Messages |  | ||||||
| 	 */ |  | ||||||
| 	nss_bridge_log_tx_msg(msg); |  | ||||||
|  |  | ||||||
| 	return nss_core_send_cmd(nss_ctx, msg, sizeof(*msg), NSS_NBUF_PAYLOAD_SIZE); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_msg_sync() |  | ||||||
|  *	Transmit a bridge message to NSS firmware synchronously. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	nss_tx_status_t status; |  | ||||||
| 	int ret = 0; |  | ||||||
|  |  | ||||||
| 	down(&bridge_pvt.sem); |  | ||||||
| 	bridge_pvt.cb = (void *)nbm->cm.cb; |  | ||||||
| 	bridge_pvt.app_data = (void *)nbm->cm.app_data; |  | ||||||
|  |  | ||||||
| 	nbm->cm.cb = (nss_ptr_t)nss_bridge_callback; |  | ||||||
| 	nbm->cm.app_data = (nss_ptr_t)NULL; |  | ||||||
|  |  | ||||||
| 	status = nss_bridge_tx_msg(nss_ctx, nbm); |  | ||||||
| 	if (status != NSS_TX_SUCCESS) { |  | ||||||
| 		nss_warning("%px: bridge_tx_msg failed\n", nss_ctx); |  | ||||||
| 		up(&bridge_pvt.sem); |  | ||||||
| 		return status; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	ret = wait_for_completion_timeout(&bridge_pvt.complete, msecs_to_jiffies(NSS_BRIDGE_TX_TIMEOUT)); |  | ||||||
|  |  | ||||||
| 	if (!ret) { |  | ||||||
| 		nss_warning("%px: bridge msg tx failed due to timeout\n", nss_ctx); |  | ||||||
| 		bridge_pvt.response = NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	status = bridge_pvt.response; |  | ||||||
| 	up(&bridge_pvt.sem); |  | ||||||
| 	return status; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_msg_sync); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_msg_init() |  | ||||||
|  *	Initialize nss_bridge_msg. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_msg_init(struct nss_bridge_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len, void *cb, void *app_data) |  | ||||||
| { |  | ||||||
| 	nss_cmn_msg_init(&ncm->cm, if_num, type, len, cb, app_data); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_msg_init); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_vsi_assign_msg |  | ||||||
|  *	API to send vsi assign message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_vsi_assign_msg(uint32_t if_num, uint32_t vsi) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(if_num) == false) { |  | ||||||
| 		nss_warning("%px: invalid interface %d", nss_ctx, if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_bridge_msg_init(&nbm, if_num, NSS_IF_VSI_ASSIGN, |  | ||||||
| 			sizeof(struct nss_if_vsi_assign), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	nbm.msg.if_msg.vsi_assign.vsi = vsi; |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_vsi_assign_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_vsi_unassign_msg |  | ||||||
|  *	API to send vsi unassign message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_vsi_unassign_msg(uint32_t if_num, uint32_t vsi) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(if_num) == false) { |  | ||||||
| 		nss_warning("%px: invalid interface %d", nss_ctx, if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_bridge_msg_init(&nbm, if_num, NSS_IF_VSI_UNASSIGN, |  | ||||||
| 			sizeof(struct nss_if_vsi_unassign), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	nbm.msg.if_msg.vsi_unassign.vsi = vsi; |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_vsi_unassign_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_change_mtu_msg |  | ||||||
|  *	API to send change mtu message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_mtu_msg(uint32_t bridge_if_num, uint32_t mtu) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
| 	struct nss_if_mtu_change *nimc; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(bridge_if_num) == false) { |  | ||||||
| 		nss_warning("%px: received invalid interface %d", nss_ctx, bridge_if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_bridge_msg_init(&nbm, bridge_if_num, NSS_IF_MTU_CHANGE, |  | ||||||
| 			sizeof(struct nss_if_mtu_change), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	nimc = &nbm.msg.if_msg.mtu_change; |  | ||||||
| 	nimc->min_buf_size = (uint16_t)mtu; |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_set_mtu_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_set_mac_addr_msg |  | ||||||
|  *	API to send change mac addr message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, uint8_t *addr) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
| 	struct nss_if_mac_address_set *nmas; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(bridge_if_num) == false) { |  | ||||||
| 		nss_warning("%px: received invalid interface %d", nss_ctx, bridge_if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_bridge_msg_init(&nbm, bridge_if_num, NSS_IF_MAC_ADDR_SET, |  | ||||||
| 			sizeof(struct nss_if_mac_address_set), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	nmas = &nbm.msg.if_msg.mac_address_set; |  | ||||||
| 	memcpy(nmas->mac_addr, addr, ETH_ALEN); |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_set_mac_addr_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_join_msg |  | ||||||
|  *	API to send slave join message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_join_msg(uint32_t bridge_if_num, struct net_device *netdev) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
| 	uint32_t slave_if_num; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(bridge_if_num) == false) { |  | ||||||
| 		nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	slave_if_num = nss_cmn_get_interface_number_by_dev(netdev); |  | ||||||
| 	if (slave_if_num < 0) { |  | ||||||
| 		nss_warning("%px: invalid slave device %px\n", nss_ctx, netdev); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nbm.msg.br_join.if_num = slave_if_num; |  | ||||||
| 	nss_bridge_msg_init(&nbm, bridge_if_num, NSS_BRIDGE_MSG_JOIN, |  | ||||||
| 				sizeof(struct nss_bridge_join_msg), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_join_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_leave_msg |  | ||||||
|  *	API to send slave leave message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_leave_msg(uint32_t bridge_if_num, struct net_device *netdev) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
| 	uint32_t slave_if_num; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(bridge_if_num) == false) { |  | ||||||
| 		nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	slave_if_num = nss_cmn_get_interface_number_by_dev(netdev); |  | ||||||
| 	if (slave_if_num < 0) { |  | ||||||
| 		nss_warning("%px: invalid slave device %px\n", nss_ctx, netdev); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nbm.msg.br_leave.if_num = slave_if_num; |  | ||||||
| 	nss_bridge_msg_init(&nbm, bridge_if_num, NSS_BRIDGE_MSG_LEAVE, |  | ||||||
| 				sizeof(struct nss_bridge_leave_msg), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_leave_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_tx_set_fdb_learn_msg |  | ||||||
|  *	API to send FDB learn message to NSS FW |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_bridge_tx_set_fdb_learn_msg(uint32_t bridge_if_num, enum nss_bridge_fdb_learn_mode fdb_learn) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
| 	struct nss_bridge_msg nbm; |  | ||||||
|  |  | ||||||
| 	if (!nss_ctx) { |  | ||||||
| 		nss_warning("Can't get nss context\n"); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_bridge_verify_if_num(bridge_if_num) == false) { |  | ||||||
| 		nss_warning("%px: received invalid interface %d\n", nss_ctx, bridge_if_num); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (fdb_learn >= NSS_BRIDGE_FDB_LEARN_MODE_MAX) { |  | ||||||
| 		nss_warning("%px: received invalid fdb learn mode %d\n", nss_ctx, fdb_learn); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_bridge_msg_init(&nbm, bridge_if_num, NSS_BRIDGE_MSG_SET_FDB_LEARN, |  | ||||||
| 				sizeof(struct nss_bridge_set_fdb_learn_msg), NULL, NULL); |  | ||||||
|  |  | ||||||
| 	nbm.msg.fdb_learn.mode = fdb_learn; |  | ||||||
|  |  | ||||||
| 	return nss_bridge_tx_msg_sync(nss_ctx, &nbm); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_tx_set_fdb_learn_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_init() |  | ||||||
|  */ |  | ||||||
| void nss_bridge_init(void) |  | ||||||
| { |  | ||||||
| 	sema_init(&bridge_pvt.sem, 1); |  | ||||||
| 	init_completion(&bridge_pvt.complete); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_unregister() |  | ||||||
|  */ |  | ||||||
| void nss_bridge_unregister(uint32_t if_num) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
|  |  | ||||||
| 	nss_assert(nss_bridge_verify_if_num(if_num)); |  | ||||||
|  |  | ||||||
| 	nss_core_unregister_subsys_dp(nss_ctx, if_num); |  | ||||||
|  |  | ||||||
| 	nss_top_main.bridge_callback = NULL; |  | ||||||
|  |  | ||||||
| 	nss_core_unregister_handler(nss_ctx, if_num); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_unregister); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_register() |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_register(uint32_t if_num, struct net_device *netdev, |  | ||||||
| 						nss_bridge_callback_t bridge_data_cb, |  | ||||||
| 						nss_bridge_msg_callback_t bridge_msg_cb, |  | ||||||
| 						uint32_t features, |  | ||||||
| 						void *app_data) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = nss_bridge_get_context(); |  | ||||||
|  |  | ||||||
| 	nss_assert(nss_bridge_verify_if_num(if_num)); |  | ||||||
|  |  | ||||||
| 	nss_core_register_subsys_dp(nss_ctx, if_num, bridge_data_cb, NULL, app_data, netdev, features); |  | ||||||
|  |  | ||||||
| 	nss_top_main.bridge_callback = bridge_msg_cb; |  | ||||||
|  |  | ||||||
| 	nss_core_register_handler(nss_ctx, if_num, nss_bridge_handler, app_data); |  | ||||||
| 	return nss_ctx; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_register); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_notify_register() |  | ||||||
|  *	Register to receive bridge notify messages. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_bridge_notify_register(nss_bridge_msg_callback_t cb, void *app_data) |  | ||||||
| { |  | ||||||
| 	nss_top_main.bridge_callback = cb; |  | ||||||
| 	nss_top_main.bridge_ctx = app_data; |  | ||||||
| 	return nss_bridge_get_context(); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_notify_register); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_notify_unregister() |  | ||||||
|  *	Unregister to receive bridge notify messages. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_notify_unregister(void) |  | ||||||
| { |  | ||||||
| 	nss_top_main.bridge_callback = NULL; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_bridge_notify_unregister); |  | ||||||
| @@ -1,135 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |  | ||||||
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |  | ||||||
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |  | ||||||
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |  | ||||||
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |  | ||||||
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |  | ||||||
|  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log.c |  | ||||||
|  *	NSS Bridge logger file. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include "nss_core.h" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_message_types_str |  | ||||||
|  *	NSS Bridge message strings |  | ||||||
|  */ |  | ||||||
| static int8_t *nss_bridge_log_message_types_str[NSS_BRIDGE_MSG_TYPE_MAX] __maybe_unused = { |  | ||||||
| 	"Bridge Join message", |  | ||||||
| 	"Bridge Leave message", |  | ||||||
| 	"Bridge Set FDB Learn message" |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_join_msg() |  | ||||||
|  *	Log NSS Bridge Join message. |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_join_msg(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	struct nss_bridge_join_msg *nbjm __maybe_unused = &nbm->msg.br_join; |  | ||||||
| 	nss_trace("%px: NSS Bridge Join message \n" |  | ||||||
| 		"Interface Number: %d\n", |  | ||||||
| 		nbm, nbjm->if_num); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_leave_msg() |  | ||||||
|  *	Log NSS Bridge Leave message. |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_leave_msg(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	struct nss_bridge_leave_msg *nblm __maybe_unused = &nbm->msg.br_leave; |  | ||||||
| 	nss_trace("%px: NSS Bridge Leave message: \n" |  | ||||||
| 		"Interface Number: %d\n", |  | ||||||
| 		nbm, nblm->if_num); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_fdb_learn_msg() |  | ||||||
|  *	Log NSS Set Bridge FDB Learn message. |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_fdb_learn_msg(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	struct nss_bridge_set_fdb_learn_msg *nbflm __maybe_unused = |  | ||||||
| 		&nbm->msg.fdb_learn; |  | ||||||
| 	nss_trace("%px: NSS Bridge Set FDB Learn message: \n" |  | ||||||
| 		"Mode: %d\n", |  | ||||||
| 		nbm, nbflm->mode); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_verbose() |  | ||||||
|  *	Log message contents. |  | ||||||
|  */ |  | ||||||
| static void nss_bridge_log_verbose(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	switch (nbm->cm.type) { |  | ||||||
| 	case NSS_BRIDGE_MSG_JOIN: |  | ||||||
| 		nss_bridge_join_msg(nbm); |  | ||||||
| 		break; |  | ||||||
|  |  | ||||||
| 	case NSS_BRIDGE_MSG_LEAVE: |  | ||||||
| 		nss_bridge_leave_msg(nbm); |  | ||||||
| 		break; |  | ||||||
|  |  | ||||||
| 	case NSS_BRIDGE_MSG_SET_FDB_LEARN: |  | ||||||
| 		nss_bridge_fdb_learn_msg(nbm); |  | ||||||
| 		break; |  | ||||||
|  |  | ||||||
| 	default: |  | ||||||
| 		nss_trace("%px: Invalid message type\n", nbm); |  | ||||||
| 		break; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_tx_msg() |  | ||||||
|  *	Log messages transmitted to FW. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_log_tx_msg(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	if (nbm->cm.type >= NSS_BRIDGE_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: Invalid message type\n", nbm); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: type[%d]:%s\n", nbm, nbm->cm.type, nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1]); |  | ||||||
| 	nss_bridge_log_verbose(nbm); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_rx_msg() |  | ||||||
|  *	Log messages received from FW. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_log_rx_msg(struct nss_bridge_msg *nbm) |  | ||||||
| { |  | ||||||
| 	if (nbm->cm.response >= NSS_CMN_RESPONSE_LAST) { |  | ||||||
| 		nss_warning("%px: Invalid response\n", nbm); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nbm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nbm->cm.response == NSS_CMN_RESPONSE_ACK)) { |  | ||||||
| 		nss_info("%px: type[%d]:%s, response[%d]:%s\n", nbm, nbm->cm.type, |  | ||||||
| 			nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1], |  | ||||||
| 			nbm->cm.response, nss_cmn_response_str[nbm->cm.response]); |  | ||||||
| 		goto verbose; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s\n", |  | ||||||
| 		nbm, nbm->cm.type, nss_bridge_log_message_types_str[nbm->cm.type - NSS_IF_MAX_MSG_TYPES - 1], |  | ||||||
| 		nbm->cm.response, nss_cmn_response_str[nbm->cm.response]); |  | ||||||
|  |  | ||||||
| verbose: |  | ||||||
| 	nss_bridge_log_verbose(nbm); |  | ||||||
| } |  | ||||||
| @@ -1,41 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 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_BRIDGE_LOG_H |  | ||||||
| #define __NSS_BRIDGE_LOG_H |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge.h |  | ||||||
|  *	NSS Bridge header file. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Logger APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_tx_msg |  | ||||||
|  *	Logs a bridge message that is sent to the NSS firmware. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_log_tx_msg(struct nss_bridge_msg *nbm); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_bridge_log_rx_msg |  | ||||||
|  *	Logs a bridge message that is received from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| void nss_bridge_log_rx_msg(struct nss_bridge_msg *nbm); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_BRIDGE_LOG_H */ |  | ||||||
| @@ -1,113 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |  | ||||||
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |  | ||||||
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |  | ||||||
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |  | ||||||
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |  | ||||||
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |  | ||||||
|  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx.c |  | ||||||
|  *	NSS C2C_RX APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include <nss_hal.h> |  | ||||||
| #include "nss_c2c_rx_stats.h" |  | ||||||
| #include "nss_c2c_rx_strings.h" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_verify_if_num() |  | ||||||
|  *	Verify if_num passed to us. |  | ||||||
|  */ |  | ||||||
| static bool nss_c2c_rx_verify_if_num(uint32_t if_num) |  | ||||||
| { |  | ||||||
| 	return if_num == NSS_C2C_RX_INTERFACE; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_interface_handler() |  | ||||||
|  *	Handle NSS -> HLOS messages for C2C_RX Statistics |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_rx_interface_handler(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 		struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data) |  | ||||||
| { |  | ||||||
| 	struct nss_c2c_rx_msg *ncrm = (struct nss_c2c_rx_msg *)ncm; |  | ||||||
| 	nss_c2c_rx_msg_callback_t cb; |  | ||||||
|  |  | ||||||
| 	if (!nss_c2c_rx_verify_if_num(ncm->interface)) { |  | ||||||
| 		nss_warning("%px: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Is this a valid request/response packet? |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->type >= NSS_C2C_RX_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: received invalid message %d for c2c_rx", nss_ctx, ncm->type); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_c2c_rx_msg)) { |  | ||||||
| 		nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Log failures |  | ||||||
| 	 */ |  | ||||||
| 	nss_core_log_msg_failures(nss_ctx, ncm); |  | ||||||
|  |  | ||||||
| 	switch (ncrm->cm.type) { |  | ||||||
| 	case NSS_C2C_RX_MSG_TYPE_STATS: |  | ||||||
| 		/* |  | ||||||
| 		 * Update driver statistics and send statistics notifications to the registered modules. |  | ||||||
| 		 */ |  | ||||||
| 		nss_c2c_rx_stats_sync(nss_ctx, &ncrm->msg.stats); |  | ||||||
| 		nss_c2c_rx_stats_notify(nss_ctx); |  | ||||||
| 		break; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Update the callback and app_data for NOTIFY messages |  | ||||||
| 	 * TODO: Add notify callbacks for c2c_rx |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Do we have a callback? |  | ||||||
| 	 */ |  | ||||||
| 	if (!ncm->cb) { |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * callback |  | ||||||
| 	 */ |  | ||||||
| 	cb = (nss_c2c_rx_msg_callback_t)ncm->cb; |  | ||||||
| 	cb((void *)ncm->app_data, ncrm); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_register_handler() |  | ||||||
|  *	Register handler for messaging |  | ||||||
|  */ |  | ||||||
| void nss_c2c_rx_register_handler(struct nss_ctx_instance *nss_ctx) |  | ||||||
| { |  | ||||||
| 	nss_core_register_handler(nss_ctx, NSS_C2C_RX_INTERFACE, nss_c2c_rx_interface_handler, NULL); |  | ||||||
|  |  | ||||||
| 	if (nss_ctx->id == NSS_CORE_0) { |  | ||||||
| 		nss_c2c_rx_stats_dentry_create(); |  | ||||||
| 	} |  | ||||||
| 	nss_c2c_rx_strings_dentry_create(); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_rx_register_handler); |  | ||||||
| @@ -1,173 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_c2c_rx_stats.h" |  | ||||||
| #include "nss_c2c_rx_strings.h" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Declare atomic notifier data structure for statistics. |  | ||||||
|  */ |  | ||||||
| ATOMIC_NOTIFIER_HEAD(nss_c2c_rx_stats_notifier); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Spinlock to protect C2C_RX statistics update/read |  | ||||||
|  */ |  | ||||||
| DEFINE_SPINLOCK(nss_c2c_rx_stats_lock); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats |  | ||||||
|  *	c2c_rx statistics |  | ||||||
|  */ |  | ||||||
| uint64_t nss_c2c_rx_stats[NSS_MAX_CORES][NSS_C2C_RX_STATS_MAX]; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_read() |  | ||||||
|  *	Read C2C_RX statistics |  | ||||||
|  */ |  | ||||||
| static ssize_t nss_c2c_rx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) |  | ||||||
| { |  | ||||||
| 	int32_t i, core; |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Max output lines = #stats * NSS_MAX_CORES  + |  | ||||||
| 	 * few blank lines for banner printing + Number of Extra outputlines for future reference to add new stats |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t max_output_lines = NSS_C2C_RX_STATS_MAX * NSS_MAX_CORES + 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 = kzalloc(size_al, GFP_KERNEL); |  | ||||||
| 	if (unlikely(lbuf == NULL)) { |  | ||||||
| 		nss_warning("Could not allocate memory for local statistics buffer"); |  | ||||||
| 		return -ENOMEM; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	stats_shadow = kzalloc(NSS_C2C_RX_STATS_MAX * 8, GFP_KERNEL); |  | ||||||
| 	if (unlikely(stats_shadow == NULL)) { |  | ||||||
| 		nss_warning("Could not allocate memory for local shadow buffer"); |  | ||||||
| 		kfree(lbuf); |  | ||||||
| 		return -ENOMEM; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * C2C_RX statistics |  | ||||||
| 	 */ |  | ||||||
| 	for (core = 0; core < NSS_MAX_CORES; core++) { |  | ||||||
| 		spin_lock_bh(&nss_c2c_rx_stats_lock); |  | ||||||
| 		for (i = 0; i < NSS_C2C_RX_STATS_MAX; i++) { |  | ||||||
| 			stats_shadow[i] = nss_c2c_rx_stats[core][i]; |  | ||||||
| 		} |  | ||||||
| 		spin_unlock_bh(&nss_c2c_rx_stats_lock); |  | ||||||
| 		size_wr += nss_stats_banner(lbuf, size_wr, size_al, "c2c_rx", core); |  | ||||||
| 		size_wr += nss_stats_print("c2c_rx", NULL, NSS_STATS_SINGLE_INSTANCE |  | ||||||
| 						, nss_c2c_rx_strings_stats |  | ||||||
| 						, stats_shadow |  | ||||||
| 						, NSS_C2C_RX_STATS_MAX |  | ||||||
| 						, lbuf, size_wr, size_al); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf)); |  | ||||||
| 	kfree(lbuf); |  | ||||||
| 	kfree(stats_shadow); |  | ||||||
|  |  | ||||||
| 	return bytes_read; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_ops |  | ||||||
|  */ |  | ||||||
| NSS_STATS_DECLARE_FILE_OPERATIONS(c2c_rx); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_dentry_create() |  | ||||||
|  *	Create C2C_RX statistics debug entry. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_rx_stats_dentry_create(void) |  | ||||||
| { |  | ||||||
| 	nss_stats_create_dentry("c2c_rx", &nss_c2c_rx_stats_ops); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_sync() |  | ||||||
|  *	Handle the syncing of NSS C2C_RX statistics. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_rx_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_c2c_rx_stats *ncrs) |  | ||||||
| { |  | ||||||
| 	int id = nss_ctx->id; |  | ||||||
| 	int j; |  | ||||||
|  |  | ||||||
| 	spin_lock_bh(&nss_c2c_rx_stats_lock); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Common node stats |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_STATS_NODE_RX_PKTS] += (ncrs->pbuf_simple + ncrs->pbuf_sg + ncrs->pbuf_returning); |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_STATS_NODE_RX_BYTES] += ncrs->node_stats.rx_bytes; |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_STATS_NODE_TX_PKTS] += ncrs->node_stats.tx_packets; |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_STATS_NODE_TX_BYTES] += ncrs->node_stats.tx_bytes; |  | ||||||
|  |  | ||||||
| 	for (j = 0; j < NSS_MAX_NUM_PRI; j++) { |  | ||||||
| 		nss_c2c_rx_stats[id][NSS_STATS_NODE_RX_QUEUE_0_DROPPED + j] += ncrs->node_stats.rx_dropped[j]; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * C2C_RX statistics |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_C2C_RX_STATS_PBUF_SIMPLE] += ncrs->pbuf_simple; |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_C2C_RX_STATS_PBUF_SG] += ncrs->pbuf_sg; |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_C2C_RX_STATS_PBUF_RETURNING] += ncrs->pbuf_returning; |  | ||||||
| 	nss_c2c_rx_stats[id][NSS_C2C_RX_STATS_INVAL_DEST] += ncrs->inval_dest; |  | ||||||
|  |  | ||||||
| 	spin_unlock_bh(&nss_c2c_rx_stats_lock); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_notify() |  | ||||||
|  *	Sends notifications to all the registered modules. |  | ||||||
|  * |  | ||||||
|  * Leverage NSS-FW statistics timing to update Netlink. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_rx_stats_notify(struct nss_ctx_instance *nss_ctx) |  | ||||||
| { |  | ||||||
| 	struct nss_c2c_rx_stats_notification c2c_rx_stats; |  | ||||||
|  |  | ||||||
| 	c2c_rx_stats.core_id = nss_ctx->id; |  | ||||||
| 	memcpy(c2c_rx_stats.stats, nss_c2c_rx_stats[c2c_rx_stats.core_id], sizeof(c2c_rx_stats.stats)); |  | ||||||
| 	atomic_notifier_call_chain(&nss_c2c_rx_stats_notifier, NSS_STATS_EVENT_NOTIFY, (void *)&c2c_rx_stats); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_register_notifier() |  | ||||||
|  *	Registers statistics notifier. |  | ||||||
|  */ |  | ||||||
| int nss_c2c_rx_stats_register_notifier(struct notifier_block *nb) |  | ||||||
| { |  | ||||||
| 	return atomic_notifier_chain_register(&nss_c2c_rx_stats_notifier, nb); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_rx_stats_register_notifier); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats_unregister_notifier() |  | ||||||
|  *	Deregisters statistics notifier. |  | ||||||
|  */ |  | ||||||
| int nss_c2c_rx_stats_unregister_notifier(struct notifier_block *nb) |  | ||||||
| { |  | ||||||
| 	return atomic_notifier_chain_unregister(&nss_c2c_rx_stats_notifier, nb); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_rx_stats_unregister_notifier); |  | ||||||
| @@ -1,63 +0,0 @@ | |||||||
| /* |  | ||||||
|  ****************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_C2C_RX_STATS_H |  | ||||||
| #define __NSS_C2C_RX_STATS_H |  | ||||||
|  |  | ||||||
| #include <nss_cmn.h> |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * c2c_rx_msg_type |  | ||||||
|  *	Message types supported |  | ||||||
|  */ |  | ||||||
| enum c2c_rx_msg_type { |  | ||||||
| 	NSS_C2C_RX_MSG_TYPE_STATS,		/* Statistics synchronization */ |  | ||||||
| 	NSS_C2C_RX_MSG_TYPE_MAX |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_stats |  | ||||||
|  *	The NSS c2c_rx node stats structure. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_rx_stats { |  | ||||||
| 	struct nss_cmn_node_stats node_stats; |  | ||||||
| 					/* Common node stats for core-to-core reception. */ |  | ||||||
| 	uint32_t pbuf_simple;		/* Number of received simple pbuf. */ |  | ||||||
| 	uint32_t pbuf_sg;		/* Number of S/G pbuf received. */ |  | ||||||
| 	uint32_t pbuf_returning;	/* Number of returning S/G pbuf. */ |  | ||||||
| 	uint32_t inval_dest;		/* Number of pbuf enqueue failure because of dest is invalid. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_msg |  | ||||||
|  *	Message structure to send/receive c2c_rx commands |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_rx_msg { |  | ||||||
| 	struct nss_cmn_msg cm;			/* Message Header */ |  | ||||||
| 	union { |  | ||||||
| 		struct nss_c2c_rx_stats stats;	/* c2c_rx statistics */ |  | ||||||
| 	} msg; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * C2C_RX statistics APIs |  | ||||||
|  */ |  | ||||||
| extern void nss_c2c_rx_stats_notify(struct nss_ctx_instance *nss_ctx); |  | ||||||
| typedef void (*nss_c2c_rx_msg_callback_t)(void *app_data, struct nss_c2c_rx_msg *msg); |  | ||||||
| extern void nss_c2c_rx_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_c2c_rx_stats *ncrs); |  | ||||||
| extern void nss_c2c_rx_stats_dentry_create(void); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_RX_STATS_H */ |  | ||||||
| @@ -1,61 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_strings_stats |  | ||||||
|  *	Core-to-core Rx statistics strings. |  | ||||||
|  */ |  | ||||||
| struct nss_stats_info nss_c2c_rx_strings_stats[NSS_C2C_RX_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}, |  | ||||||
| 	{"pbuf_simple"		, NSS_STATS_TYPE_SPECIAL}, |  | ||||||
| 	{"pbuf_sg"		, NSS_STATS_TYPE_SPECIAL}, |  | ||||||
| 	{"pbuf_returning"	, NSS_STATS_TYPE_SPECIAL}, |  | ||||||
| 	{"inval_dest"		, NSS_STATS_TYPE_DROP} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_strings_read() |  | ||||||
|  *	Read C2C Rx node statistics names. |  | ||||||
|  */ |  | ||||||
| static ssize_t nss_c2c_rx_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) |  | ||||||
| { |  | ||||||
| 	return nss_strings_print(ubuf, sz, ppos, nss_c2c_rx_strings_stats, NSS_C2C_RX_STATS_MAX); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_strings_ops |  | ||||||
|  */ |  | ||||||
| NSS_STRINGS_DECLARE_FILE_OPERATIONS(c2c_rx); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_rx_strings_dentry_create() |  | ||||||
|  *	Create C2C Rx statistics strings debug entry. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_rx_strings_dentry_create(void) |  | ||||||
| { |  | ||||||
| 	nss_strings_create_dentry("c2c_rx", &nss_c2c_rx_strings_ops); |  | ||||||
| } |  | ||||||
| @@ -1,23 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_C2C_RX_STRINGS_H |  | ||||||
| #define __NSS_C2C_RX_STRINGS_H |  | ||||||
|  |  | ||||||
| extern struct nss_stats_info nss_c2c_rx_strings_stats[NSS_C2C_RX_STATS_MAX]; |  | ||||||
| extern void nss_c2c_rx_strings_dentry_create(void); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_RX_STRINGS_H */ |  | ||||||
| @@ -1,439 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |  | ||||||
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |  | ||||||
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |  | ||||||
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |  | ||||||
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |  | ||||||
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |  | ||||||
|  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx.c |  | ||||||
|  *	NSS C2C_TX APIs |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include <nss_hal.h> |  | ||||||
| #include "nss_c2c_tx_stats.h" |  | ||||||
| #include "nss_c2c_tx_log.h" |  | ||||||
| #include "nss_c2c_tx_strings.h" |  | ||||||
|  |  | ||||||
| int nss_c2c_tx_test_id = -1; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Private data structure. |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_pvt { |  | ||||||
| 	struct semaphore sem;		/* Semaphore structure. */ |  | ||||||
| 	struct completion complete;	/* Completion structure. */ |  | ||||||
| 	int response;			/* Response from FW. */ |  | ||||||
| 	void *cb;			/* Original cb for sync msgs. */ |  | ||||||
| 	void *app_data;			/* Original app_data for sync msgs. */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Notify data structure |  | ||||||
|  */ |  | ||||||
| struct nss_c2c_tx_notify_data { |  | ||||||
| 	nss_c2c_tx_msg_callback_t c2c_tx_callback; |  | ||||||
| 	void *app_data; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static struct nss_c2c_tx_notify_data nss_c2c_tx_notify[NSS_CORE_MAX]; |  | ||||||
| static struct nss_c2c_tx_pvt nss_c2c_tx_cfg_pvt; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_verify_if_num() |  | ||||||
|  *	Verify if_num passed to us. |  | ||||||
|  */ |  | ||||||
| static inline bool nss_c2c_tx_verify_if_num(uint32_t if_num) |  | ||||||
| { |  | ||||||
| 	return if_num == NSS_C2C_TX_INTERFACE; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_interface_handler() |  | ||||||
|  *	Handle NSS -> HLOS messages for C2C_TX Statistics |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_tx_msg_handler(struct nss_ctx_instance *nss_ctx, |  | ||||||
| 		struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data) |  | ||||||
| { |  | ||||||
| 	struct nss_c2c_tx_msg *nctm = (struct nss_c2c_tx_msg *)ncm; |  | ||||||
| 	nss_c2c_tx_msg_callback_t cb; |  | ||||||
|  |  | ||||||
| 	if (!nss_c2c_tx_verify_if_num(ncm->interface)) { |  | ||||||
| 		nss_warning("%px: invalid interface %d for c2c_tx\n", nss_ctx, ncm->interface); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Is this a valid request/response packet? |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->type >= NSS_C2C_TX_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: received invalid message %d for c2c_tx", nss_ctx, ncm->type); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_c2c_tx_msg)) { |  | ||||||
| 		nss_warning("%px: Length of message is greater than required: %d", nss_ctx, nss_cmn_get_msg_len(ncm)); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Trace messages. |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_tx_log_rx_msg(nctm); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Log failures |  | ||||||
| 	 */ |  | ||||||
| 	nss_core_log_msg_failures(nss_ctx, ncm); |  | ||||||
|  |  | ||||||
| 	switch (nctm->cm.type) { |  | ||||||
| 	case NSS_C2C_TX_MSG_TYPE_TX_MAP: |  | ||||||
| 	case NSS_C2C_TX_MSG_TYPE_PERFORMANCE_TEST: |  | ||||||
| 		break; |  | ||||||
|  |  | ||||||
| 	case NSS_C2C_TX_MSG_TYPE_STATS: |  | ||||||
| 		/* |  | ||||||
| 		 * Update driver statistics and send statistics notifications to the registered modules. |  | ||||||
| 		 */ |  | ||||||
| 		nss_c2c_tx_stats_sync(nss_ctx, &nctm->msg.stats); |  | ||||||
| 		nss_c2c_tx_stats_notify(nss_ctx); |  | ||||||
| 		break; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Update the callback and app_data for NOTIFY messages |  | ||||||
| 	 */ |  | ||||||
| 	if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) { |  | ||||||
| 		ncm->cb = (nss_ptr_t)nss_c2c_tx_notify[nss_ctx->id].c2c_tx_callback; |  | ||||||
| 		ncm->app_data = (nss_ptr_t)nss_c2c_tx_notify[nss_ctx->id].app_data; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Do we have a callback? |  | ||||||
| 	 */ |  | ||||||
| 	if (!ncm->cb) { |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * callback |  | ||||||
| 	 */ |  | ||||||
| 	cb = (nss_c2c_tx_msg_callback_t)ncm->cb; |  | ||||||
| 	cb((void *)ncm->app_data, nctm); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_register_handler() |  | ||||||
|  *	Register handler for messaging |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_register_handler(struct nss_ctx_instance *nss_ctx) |  | ||||||
| { |  | ||||||
| 	nss_info("%px: nss_c2c_tx_register_handler", nss_ctx); |  | ||||||
| 	nss_core_register_handler(nss_ctx, NSS_C2C_TX_INTERFACE, nss_c2c_tx_msg_handler, NULL); |  | ||||||
|  |  | ||||||
| 	if (nss_ctx->id == NSS_CORE_0) { |  | ||||||
| 		nss_c2c_tx_stats_dentry_create(); |  | ||||||
| 	} |  | ||||||
| 	nss_c2c_tx_strings_dentry_create(); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_register_handler); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_tx_msg() |  | ||||||
|  *	Transmit an c2c_tx message to the FW with a specified size. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_c2c_tx_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	struct nss_cmn_msg *ncm = &nctm->cm; |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Sanity check the message |  | ||||||
| 	 */ |  | ||||||
| 	if (!nss_c2c_tx_verify_if_num(ncm->interface)) { |  | ||||||
| 		nss_warning("%px: tx request for another interface: %d", nss_ctx, ncm->interface); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (ncm->type >= NSS_C2C_TX_MSG_TYPE_MAX) { |  | ||||||
| 		nss_warning("%px: message type out of range: %d", nss_ctx, ncm->type); |  | ||||||
| 		return NSS_TX_FAILURE; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Trace messages. |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_tx_log_tx_msg(nctm); |  | ||||||
|  |  | ||||||
| 	return nss_core_send_cmd(nss_ctx, nctm, sizeof(*nctm), NSS_NBUF_PAYLOAD_SIZE); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_tx_msg); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_msg_cfg_map_callback() |  | ||||||
|  *	Callback function for tx_map configuration |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_tx_msg_cfg_map_callback(void *app_data, struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx __attribute__((unused)) = (struct nss_ctx_instance *)app_data; |  | ||||||
| 	if (nctm->cm.response != NSS_CMN_RESPONSE_ACK) { |  | ||||||
| 		nss_warning("%px: nss c2c_tx_map configuration failed: %d for NSS core %d\n", |  | ||||||
| 			nss_ctx, nctm->cm.error, nss_ctx->id); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: nss c2c_tx_map configuration succeeded for NSS core %d\n", |  | ||||||
| 		nss_ctx, nss_ctx->id); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_msg_performance_test_start_callback() |  | ||||||
|  *	Callback function for c2c_tx test start configuration |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_tx_msg_performance_test_callback(void *app_data, struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	struct nss_ctx_instance *nss_ctx __attribute__((unused)) = (struct nss_ctx_instance *)app_data; |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Test start has been failed. Restore the value to initial state. |  | ||||||
| 	 */ |  | ||||||
| 	if (nctm->cm.response != NSS_CMN_RESPONSE_ACK) { |  | ||||||
| 		nss_warning("%px: nss c2c_tx test start failed: %d for NSS core %d\n", |  | ||||||
| 			nss_ctx, nctm->cm.error, nss_ctx->id); |  | ||||||
| 		nss_c2c_tx_test_id = -1; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: nss c2c_tx test successfully initialized for NSS core %d\n", |  | ||||||
| 		nss_ctx, nss_ctx->id); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_msg_cfg_map() |  | ||||||
|  *	Send NSS to c2c_map |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_c2c_tx_msg_cfg_map(struct nss_ctx_instance *nss_ctx, uint32_t tx_map, uint32_t c2c_intr_addr) |  | ||||||
| { |  | ||||||
| 	int32_t status; |  | ||||||
| 	struct nss_c2c_tx_msg nctm; |  | ||||||
| 	struct nss_c2c_tx_map *cfg_map; |  | ||||||
|  |  | ||||||
| 	nss_info("%px: C2C map:%x\n", nss_ctx, tx_map); |  | ||||||
| 	nss_c2c_tx_msg_init(&nctm, NSS_C2C_TX_INTERFACE, NSS_C2C_TX_MSG_TYPE_TX_MAP, |  | ||||||
| 		sizeof(struct nss_c2c_tx_map), nss_c2c_tx_msg_cfg_map_callback, (void *)nss_ctx); |  | ||||||
|  |  | ||||||
| 	cfg_map = &nctm.msg.map; |  | ||||||
| 	cfg_map->tx_map = tx_map; |  | ||||||
| 	cfg_map->c2c_intr_addr = c2c_intr_addr; |  | ||||||
|  |  | ||||||
| 	status = nss_c2c_tx_tx_msg(nss_ctx, &nctm); |  | ||||||
| 	if (unlikely(status != NSS_TX_SUCCESS)) { |  | ||||||
| 		return status; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return NSS_TX_SUCCESS; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_msg_performance_test() |  | ||||||
|  *	Send NSS c2c peformance test start message. |  | ||||||
|  */ |  | ||||||
| nss_tx_status_t nss_c2c_tx_msg_performance_test(struct nss_ctx_instance *nss_ctx, uint32_t test_id) |  | ||||||
| { |  | ||||||
| 	int32_t status; |  | ||||||
| 	struct nss_c2c_tx_msg nctm; |  | ||||||
| 	struct nss_c2c_tx_test *test; |  | ||||||
|  |  | ||||||
| 	nss_info("%px: C2C test message:%x\n", nss_ctx, test_id); |  | ||||||
| 	nss_c2c_tx_msg_init(&nctm, NSS_C2C_TX_INTERFACE, NSS_C2C_TX_MSG_TYPE_PERFORMANCE_TEST, |  | ||||||
| 		sizeof(struct nss_c2c_tx_test), nss_c2c_tx_msg_performance_test_callback, (void *)nss_ctx); |  | ||||||
|  |  | ||||||
| 	test = &nctm.msg.test; |  | ||||||
| 	test->test_id = test_id; |  | ||||||
|  |  | ||||||
| 	status = nss_c2c_tx_tx_msg(nss_ctx, &nctm); |  | ||||||
| 	if (unlikely(status != NSS_TX_SUCCESS)) { |  | ||||||
| 		return status; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return NSS_TX_SUCCESS; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_msg_init() |  | ||||||
|  *	Initialize C2C_TX message. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_msg_init(struct nss_c2c_tx_msg *nctm, uint16_t if_num, uint32_t type, uint32_t len, |  | ||||||
| 			nss_c2c_tx_msg_callback_t cb, void *app_data) |  | ||||||
| { |  | ||||||
| 	nss_cmn_msg_init(&nctm->cm, if_num, type, len, (void *)cb, app_data); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_msg_init); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_performance_test_handler() |  | ||||||
|  *	Handles the performance test. |  | ||||||
|  */ |  | ||||||
| static int nss_c2c_tx_performance_test_handler(struct ctl_table *ctl, int write, |  | ||||||
| 				void __user *buffer, size_t *lenp, loff_t *ppos) |  | ||||||
| { |  | ||||||
| 	struct nss_top_instance *nss_top = &nss_top_main; |  | ||||||
| 	struct nss_ctx_instance *nss_ctx = &nss_top->nss[0]; |  | ||||||
| 	int ret, ret_c2c_tx, current_state; |  | ||||||
| 	current_state = nss_c2c_tx_test_id; |  | ||||||
| 	ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |  | ||||||
|  |  | ||||||
| 	if (ret != NSS_SUCCESS) { |  | ||||||
| 		return ret; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!write) { |  | ||||||
| 		return ret; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (current_state != -1) { |  | ||||||
| 		nss_warning("%px: Another test is running.\n", nss_ctx); |  | ||||||
| 		return -EINVAL; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nss_c2c_tx_test_id >= NSS_C2C_TX_TEST_TYPE_MAX || nss_c2c_tx_test_id <= 0) { |  | ||||||
| 		nss_warning("%px: Invalid test ID.\n", nss_ctx); |  | ||||||
| 		nss_c2c_tx_test_id = current_state; |  | ||||||
| 		return -EINVAL; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("Starting the c2c_tx performance test\n"); |  | ||||||
| 	ret_c2c_tx = nss_c2c_tx_msg_performance_test(nss_ctx, nss_c2c_tx_test_id); |  | ||||||
|  |  | ||||||
| 	if (ret_c2c_tx != NSS_SUCCESS) { |  | ||||||
| 		nss_warning("%px: Starting the test has failed.\n", nss_ctx); |  | ||||||
| 		nss_c2c_tx_test_id = -1; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ret_c2c_tx; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static struct ctl_table nss_c2c_tx_table[] = { |  | ||||||
| 	{ |  | ||||||
| 		.procname	= "test_code", |  | ||||||
| 		.data		= &nss_c2c_tx_test_id, |  | ||||||
| 		.maxlen		= sizeof(int), |  | ||||||
| 		.mode		= 0644, |  | ||||||
| 		.proc_handler	= &nss_c2c_tx_performance_test_handler, |  | ||||||
| 	}, |  | ||||||
| 	{ } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static struct ctl_table nss_c2c_tx_dir[] = { |  | ||||||
| 	{ |  | ||||||
| 		.procname		= "c2c_tx", |  | ||||||
| 		.mode			= 0555, |  | ||||||
| 		.child			= nss_c2c_tx_table, |  | ||||||
| 	}, |  | ||||||
| 	{ } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static struct ctl_table nss_c2c_tx_root_dir[] = { |  | ||||||
| 	{ |  | ||||||
| 		.procname		= "nss", |  | ||||||
| 		.mode			= 0555, |  | ||||||
| 		.child			= nss_c2c_tx_dir, |  | ||||||
| 	}, |  | ||||||
| 	{ } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static struct ctl_table nss_c2c_tx_root[] = { |  | ||||||
| 	{ |  | ||||||
| 		.procname		= "dev", |  | ||||||
| 		.mode			= 0555, |  | ||||||
| 		.child			= nss_c2c_tx_root_dir, |  | ||||||
| 	}, |  | ||||||
| 	{ } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static struct ctl_table_header *nss_c2c_tx_header; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_register_sysctl() |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_register_sysctl(void) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * c2c_tx sema init. |  | ||||||
| 	 */ |  | ||||||
| 	sema_init(&nss_c2c_tx_cfg_pvt.sem, 1); |  | ||||||
| 	init_completion(&nss_c2c_tx_cfg_pvt.complete); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Register sysctl table. |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_tx_header = register_sysctl_table(nss_c2c_tx_root); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_unregister_sysctl() |  | ||||||
|  *      Unregister sysctl specific to c2c_tx |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_unregister_sysctl(void) |  | ||||||
| { |  | ||||||
| 	/* |  | ||||||
| 	 * Unregister sysctl table. |  | ||||||
| 	 */ |  | ||||||
| 	if (nss_c2c_tx_header) { |  | ||||||
| 		unregister_sysctl_table(nss_c2c_tx_header); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_notify_register() |  | ||||||
|  *	Register to receive c2c_tx notify messages. |  | ||||||
|  */ |  | ||||||
| struct nss_ctx_instance *nss_c2c_tx_notify_register(int core, nss_c2c_tx_msg_callback_t cb, void *app_data) |  | ||||||
| { |  | ||||||
| 	if (core >= NSS_CORE_MAX) { |  | ||||||
| 		nss_warning("Input core number %d is wrong\n", core); |  | ||||||
| 		return NULL; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_c2c_tx_notify[core].c2c_tx_callback = cb; |  | ||||||
| 	nss_c2c_tx_notify[core].app_data = app_data; |  | ||||||
|  |  | ||||||
| 	return (struct nss_ctx_instance *)&nss_top_main.nss[core]; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_notify_register); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_notify_unregister() |  | ||||||
|  *	Unregister to receive c2c_tx notify messages. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_notify_unregister(int core) |  | ||||||
| { |  | ||||||
| 	if (core >= NSS_CORE_MAX) { |  | ||||||
| 		nss_warning("Input core number %d is wrong\n", core); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_c2c_tx_notify[core].c2c_tx_callback = NULL; |  | ||||||
| 	nss_c2c_tx_notify[core].app_data = NULL; |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_notify_unregister); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_init() |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_init(void) |  | ||||||
| { |  | ||||||
| 	int core; |  | ||||||
|  |  | ||||||
| 	for (core = 0; core < NSS_CORE_MAX; core++) { |  | ||||||
| 		nss_c2c_tx_notify_register(core, NULL, NULL); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -1,121 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |  | ||||||
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |  | ||||||
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |  | ||||||
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |  | ||||||
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |  | ||||||
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |  | ||||||
|  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |  | ||||||
|  ************************************************************************** |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log.c |  | ||||||
|  *	NSS C2C TX logger file. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include "nss_core.h" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_message_types_str |  | ||||||
|  *	C2C TX message strings |  | ||||||
|  */ |  | ||||||
| static int8_t *nss_c2c_tx_log_message_types_str[NSS_C2C_TX_MSG_TYPE_MAX] __maybe_unused = { |  | ||||||
| 	"C2C TX Stats message", |  | ||||||
| 	"C2C TX Map Message", |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_error_response_types_str |  | ||||||
|  *	Strings for error types for c2c_tx messages |  | ||||||
|  */ |  | ||||||
| static int8_t *nss_c2c_tx_log_error_response_types_str[NSS_C2C_TX_MSG_ERROR_MAX] __maybe_unused = { |  | ||||||
| 	"No error", |  | ||||||
| 	"Invalid Operation" |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_map_msg()() |  | ||||||
|  *	Log NSS C2C TX Map message. |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_tx_map_msg(struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	struct nss_c2c_tx_map *nctmm __maybe_unused = &nctm->msg.map; |  | ||||||
| 	nss_trace("%px: NSS C2C TX Map message: \n" |  | ||||||
| 		"C2C Receiver Queue Start Address: %d\n" |  | ||||||
| 		"C2C Interrupt Register Address: %d\n", |  | ||||||
| 		nctm, |  | ||||||
| 		nctmm->tx_map, nctmm->c2c_intr_addr); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_verbose() |  | ||||||
|  *	Log message contents. |  | ||||||
|  */ |  | ||||||
| static void nss_c2c_tx_log_verbose(struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	switch (nctm->cm.type) { |  | ||||||
| 	case NSS_C2C_TX_MSG_TYPE_TX_MAP: |  | ||||||
| 		nss_c2c_tx_map_msg(nctm); |  | ||||||
| 		break; |  | ||||||
|  |  | ||||||
| 	default: |  | ||||||
| 		nss_trace("%px: Invalid message type\n", nctm); |  | ||||||
| 		break; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_tx_msg() |  | ||||||
|  *	Log messages transmitted to FW. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_log_tx_msg(struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	if (nctm->cm.type >= NSS_C2C_TX_MSG_TYPE_MAX) { |  | ||||||
| 		nss_info("%px: Invalid message type\n", nctm); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: type[%d]:%s\n", nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type]); |  | ||||||
| 	nss_c2c_tx_log_verbose(nctm); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_rx_msg() |  | ||||||
|  *	Log messages received from FW. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_log_rx_msg(struct nss_c2c_tx_msg *nctm) |  | ||||||
| { |  | ||||||
| 	if (nctm->cm.response >= NSS_CMN_RESPONSE_LAST) { |  | ||||||
| 		nss_warning("%px: Invalid response\n", nctm); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nctm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nctm->cm.response == NSS_CMN_RESPONSE_ACK)) { |  | ||||||
| 		nss_info("%px: type[%d]:%s, response[%d]:%s\n", nctm, nctm->cm.type, |  | ||||||
| 			nss_c2c_tx_log_message_types_str[nctm->cm.type], |  | ||||||
| 			nctm->cm.response, nss_cmn_response_str[nctm->cm.response]); |  | ||||||
| 		goto verbose; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (nctm->cm.error >= NSS_C2C_TX_MSG_ERROR_MAX) { |  | ||||||
| 		nss_warning("%px: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n", |  | ||||||
| 			nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type], |  | ||||||
| 			nctm->cm.response, nss_cmn_response_str[nctm->cm.response], |  | ||||||
| 			nctm->cm.error); |  | ||||||
| 		goto verbose; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	nss_info("%px: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n", |  | ||||||
| 		nctm, nctm->cm.type, nss_c2c_tx_log_message_types_str[nctm->cm.type], |  | ||||||
| 		nctm->cm.response, nss_cmn_response_str[nctm->cm.response], |  | ||||||
| 		nctm->cm.error, nss_c2c_tx_log_error_response_types_str[nctm->cm.error]); |  | ||||||
|  |  | ||||||
| verbose: |  | ||||||
| 	nss_c2c_tx_log_verbose(nctm); |  | ||||||
| } |  | ||||||
| @@ -1,36 +0,0 @@ | |||||||
| /* |  | ||||||
|  ****************************************************************************** |  | ||||||
|  * Copyright (c) 2018, 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_C2C_TX_LOG_H |  | ||||||
| #define __NSS_C2C_TX_LOG_H |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log.h |  | ||||||
|  *	NSS C2C TX Log Header File |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_tx_msg |  | ||||||
|  *	Logs an C2C TX message that is sent to the NSS firmware. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_log_tx_msg(struct nss_c2c_tx_msg *nctm); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_log_rx_msg |  | ||||||
|  *	Logs an IPv4 message that is received from the NSS firmware. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_log_rx_msg(struct nss_c2c_tx_msg *nctm); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_TX_LOG_H */ |  | ||||||
| @@ -1,168 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_c2c_tx_stats.h" |  | ||||||
| #include "nss_c2c_tx_strings.h" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Declare atomic notifier data structure for statistics. |  | ||||||
|  */ |  | ||||||
| ATOMIC_NOTIFIER_HEAD(nss_c2c_tx_stats_notifier); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Spinlock to protect C2C_TX statistics update/read |  | ||||||
|  */ |  | ||||||
| DEFINE_SPINLOCK(nss_c2c_tx_stats_lock); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats |  | ||||||
|  *	c2c_tx statistics |  | ||||||
|  */ |  | ||||||
| uint64_t nss_c2c_tx_stats[NSS_MAX_CORES][NSS_C2C_TX_STATS_MAX]; |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_read() |  | ||||||
|  *	Read c2c_tx statistics |  | ||||||
|  */ |  | ||||||
| static ssize_t nss_c2c_tx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) |  | ||||||
| { |  | ||||||
| 	int32_t i, core; |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Max output lines = #stats * NSS_MAX_CORES  + |  | ||||||
| 	 * few blank lines for banner printing + Number of Extra outputlines for future reference to add new stats |  | ||||||
| 	 */ |  | ||||||
| 	uint32_t max_output_lines = NSS_C2C_TX_STATS_MAX * NSS_MAX_CORES + 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 = kzalloc(size_al, GFP_KERNEL); |  | ||||||
| 	if (unlikely(lbuf == NULL)) { |  | ||||||
| 		nss_warning("Could not allocate memory for local statistics buffer"); |  | ||||||
| 		return -ENOMEM; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	stats_shadow = kzalloc(NSS_C2C_TX_STATS_MAX * 8, GFP_KERNEL); |  | ||||||
| 	if (unlikely(stats_shadow == NULL)) { |  | ||||||
| 		nss_warning("Could not allocate memory for local shadow buffer"); |  | ||||||
| 		kfree(lbuf); |  | ||||||
| 		return -ENOMEM; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * C2C_TX statistics |  | ||||||
| 	 */ |  | ||||||
| 	for (core = 0; core < NSS_MAX_CORES; core++) { |  | ||||||
| 		spin_lock_bh(&nss_c2c_tx_stats_lock); |  | ||||||
| 		for (i = 0; i < NSS_C2C_TX_STATS_MAX; i++) { |  | ||||||
| 			stats_shadow[i] = nss_c2c_tx_stats[core][i]; |  | ||||||
| 		} |  | ||||||
| 		spin_unlock_bh(&nss_c2c_tx_stats_lock); |  | ||||||
| 		size_wr += nss_stats_banner(lbuf, size_wr, size_al, "c2c_tx", core); |  | ||||||
| 		size_wr += nss_stats_print("c2c_tx", NULL, NSS_STATS_SINGLE_INSTANCE, nss_c2c_tx_strings_stats, stats_shadow, NSS_C2C_TX_STATS_MAX, lbuf, size_wr, size_al); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf)); |  | ||||||
| 	kfree(lbuf); |  | ||||||
| 	kfree(stats_shadow); |  | ||||||
|  |  | ||||||
| 	return bytes_read; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_ops |  | ||||||
|  */ |  | ||||||
| NSS_STATS_DECLARE_FILE_OPERATIONS(c2c_tx); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_dentry_create() |  | ||||||
|  *	Create c2c_tx statistics debug entry. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_stats_dentry_create(void) |  | ||||||
| { |  | ||||||
| 	nss_stats_create_dentry("c2c_tx", &nss_c2c_tx_stats_ops); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_sync() |  | ||||||
|  *	Handle the syncing of NSS C2C_TX statistics. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_c2c_tx_stats *nct) |  | ||||||
| { |  | ||||||
| 	int id = nss_ctx->id; |  | ||||||
| 	int j; |  | ||||||
|  |  | ||||||
| 	spin_lock_bh(&nss_c2c_tx_stats_lock); |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * Common node stats |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_STATS_NODE_RX_PKTS] += (nct->pbuf_simple + nct->pbuf_sg + nct->pbuf_returning); |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_STATS_NODE_RX_BYTES] += nct->node_stats.rx_bytes; |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_STATS_NODE_TX_PKTS] += nct->node_stats.tx_packets; |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_STATS_NODE_TX_BYTES] += nct->node_stats.tx_bytes; |  | ||||||
|  |  | ||||||
| 	for (j = 0; j < NSS_MAX_NUM_PRI; j++) { |  | ||||||
| 		nss_c2c_tx_stats[id][NSS_STATS_NODE_RX_QUEUE_0_DROPPED + j] += nct->node_stats.rx_dropped[j]; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* |  | ||||||
| 	 * C2C_TX statistics |  | ||||||
| 	 */ |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_C2C_TX_STATS_PBUF_SIMPLE] += nct->pbuf_simple; |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_C2C_TX_STATS_PBUF_SG] += nct->pbuf_sg; |  | ||||||
| 	nss_c2c_tx_stats[id][NSS_C2C_TX_STATS_PBUF_RETURNING] += nct->pbuf_returning; |  | ||||||
|  |  | ||||||
| 	spin_unlock_bh(&nss_c2c_tx_stats_lock); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_notify() |  | ||||||
|  *	Sends notifications to all the registered modules. |  | ||||||
|  * |  | ||||||
|  * Leverage NSS-FW statistics timing to update Netlink. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_stats_notify(struct nss_ctx_instance *nss_ctx) |  | ||||||
| { |  | ||||||
| 	struct nss_c2c_tx_stats_notification c2c_tx_stats; |  | ||||||
|  |  | ||||||
| 	c2c_tx_stats.core_id = nss_ctx->id; |  | ||||||
| 	memcpy(c2c_tx_stats.stats, nss_c2c_tx_stats[c2c_tx_stats.core_id], sizeof(c2c_tx_stats.stats)); |  | ||||||
| 	atomic_notifier_call_chain(&nss_c2c_tx_stats_notifier, NSS_STATS_EVENT_NOTIFY, (void *)&c2c_tx_stats); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_register_notifier() |  | ||||||
|  *	Registers statistics notifier. |  | ||||||
|  */ |  | ||||||
| int nss_c2c_tx_stats_register_notifier(struct notifier_block *nb) |  | ||||||
| { |  | ||||||
| 	return atomic_notifier_chain_register(&nss_c2c_tx_stats_notifier, nb); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_stats_register_notifier); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_stats_unregister_notifier() |  | ||||||
|  *	Deregisters statistics notifier. |  | ||||||
|  */ |  | ||||||
| int nss_c2c_tx_stats_unregister_notifier(struct notifier_block *nb) |  | ||||||
| { |  | ||||||
| 	return atomic_notifier_chain_unregister(&nss_c2c_tx_stats_notifier, nb); |  | ||||||
| } |  | ||||||
| EXPORT_SYMBOL(nss_c2c_tx_stats_unregister_notifier); |  | ||||||
| @@ -1,29 +0,0 @@ | |||||||
| /* |  | ||||||
|  ****************************************************************************** |  | ||||||
|  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_C2C_TX_STATS_H |  | ||||||
| #define __NSS_C2C_TX_STATS_H |  | ||||||
|  |  | ||||||
| #include <nss_cmn.h> |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * C2C Tx statistics APIs |  | ||||||
|  */ |  | ||||||
| extern void nss_c2c_tx_stats_notify(struct nss_ctx_instance *nss_ctx); |  | ||||||
| extern void nss_c2c_tx_stats_sync(struct nss_ctx_instance *nss_ctx, struct nss_c2c_tx_stats *nct); |  | ||||||
| extern void nss_c2c_tx_stats_dentry_create(void); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_TX_STATS_H */ |  | ||||||
| @@ -1,61 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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" |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_strings_stats |  | ||||||
|  *	C2C Tx statistics strings. |  | ||||||
|  */ |  | ||||||
| struct nss_stats_info nss_c2c_tx_strings_stats[NSS_C2C_TX_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}, |  | ||||||
| 	{"pbuf_simple"		, NSS_STATS_TYPE_SPECIAL}, |  | ||||||
| 	{"pbuf_sg"		, NSS_STATS_TYPE_SPECIAL}, |  | ||||||
| 	{"pbuf_returning"	, NSS_STATS_TYPE_SPECIAL} |  | ||||||
| }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_strings_read() |  | ||||||
|  *	Read c2c Tx node statistics names |  | ||||||
|  */ |  | ||||||
| static ssize_t nss_c2c_tx_strings_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos) |  | ||||||
| { |  | ||||||
| 	return nss_strings_print(ubuf, sz, ppos, nss_c2c_tx_strings_stats, NSS_C2C_TX_STATS_MAX); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_strings_ops |  | ||||||
|  */ |  | ||||||
| NSS_STRINGS_DECLARE_FILE_OPERATIONS(c2c_tx); |  | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * nss_c2c_tx_strings_dentry_create() |  | ||||||
|  *	Create C2C Tx statistics strings debug entry. |  | ||||||
|  */ |  | ||||||
| void nss_c2c_tx_strings_dentry_create(void) |  | ||||||
| { |  | ||||||
| 	nss_strings_create_dentry("c2c_tx", &nss_c2c_tx_strings_ops); |  | ||||||
| } |  | ||||||
| @@ -1,23 +0,0 @@ | |||||||
| /* |  | ||||||
|  ************************************************************************** |  | ||||||
|  * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. |  | ||||||
|  * Permission to use, copy, modify, and/or distribute this software for |  | ||||||
|  * any purpose with or without fee is hereby granted, provided that the |  | ||||||
|  * above copyright notice and this permission notice appear in all copies. |  | ||||||
|  * 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_C2C_TX_STRINGS_H |  | ||||||
| #define __NSS_C2C_TX_STRINGS_H |  | ||||||
|  |  | ||||||
| extern struct nss_stats_info nss_c2c_tx_strings_stats[NSS_C2C_TX_STATS_MAX]; |  | ||||||
| extern void nss_c2c_tx_strings_dentry_create(void); |  | ||||||
|  |  | ||||||
| #endif /* __NSS_C2C_TX_STRINGS_H */ |  | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin