ipq806x: NSS Hardware Offloading QCA Packages
This commit is contained in:
		
							
								
								
									
										11
									
								
								package/qca/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								package/qca/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| QSDK NSS Drivers | ||||
| ================ | ||||
|  | ||||
| This repo contains drivers required to activate and use the IPQ806x SoCs' | ||||
| NSS accelerator cores. | ||||
|  | ||||
| The drivers are from the QSDK 11.2r1 release.  The entire QSDK 11.2r1 release | ||||
| can be found in the link below: | ||||
|  | ||||
| https://source.codeaurora.org/quic/qsdk/releases/manifest/qstak/tree/caf_AU_LINUX_QSDK_NHSS.QSDK.11.2.R1_TARGET_ALL.12.0.4540.030.xml?h=release | ||||
|  | ||||
							
								
								
									
										49
									
								
								package/qca/nss-ifb/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								package/qca/nss-ifb/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| # | ||||
| # Copyright (C) 2008-2012 OpenWrt.org | ||||
| # | ||||
| # This is free software, licensed under the GNU General Public License v2. | ||||
| # See /LICENSE for more information. | ||||
| # | ||||
|  | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=nss-ifb | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/nss-ifb | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=NSS IFB Interface | ||||
|   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/nss-ifb.ko | ||||
|   KCONFIG:= | ||||
| endef | ||||
|  | ||||
| define KernelPackage/nss-ifb/description | ||||
|  Kernel module to register a NSS aware IFB interface. | ||||
| endef | ||||
|  | ||||
| EXTRA_KCONFIG:= \ | ||||
| 	CONFIG_NET_CLS=y | ||||
|  | ||||
| EXTRA_CFLAGS:= \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-drv | ||||
|  | ||||
| MAKE_OPTS:= \ | ||||
| 	$(KERNEL_MAKE_FLAGS) \ | ||||
| 	M="$(PKG_BUILD_DIR)" \ | ||||
| 	EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||
| 	$(EXTRA_KCONFIG) | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) -C "$(LINUX_DIR)" \ | ||||
| 		$(MAKE_OPTS) \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,nss-ifb)) | ||||
|  | ||||
							
								
								
									
										45
									
								
								package/qca/nss-ifb/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								package/qca/nss-ifb/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| NSS Physical Interface Ingress Driver | ||||
| ===================================== | ||||
|  | ||||
| This driver redirect NSS physical interface (namely GMACs) ingress traffic to itself | ||||
| and sends it back to the Linux network stack (as the source GMACs packets) as it's | ||||
| egress traffic. | ||||
|  | ||||
| This allows the NSS QDISC drivers to manage the egress traffic of this driver's | ||||
| NSS virtual interface. | ||||
|  | ||||
| This driver will create a single network interface named 'nssifb'.  The default | ||||
| source interface is defined as 'eth0'.  It can be changed using the following module | ||||
| parameter path: | ||||
|  | ||||
| /sys/module/nss-ifb/parameter/nss_src_dev | ||||
|  | ||||
| To change the source NSS physical interface to 'eth1', use the following command: | ||||
|  | ||||
| printf eth1 > /sys/module/nss-ifb/parameter/nss_src_dev | ||||
|  | ||||
| You need to change the source interface first before bringing up the 'nssifb' | ||||
| interface.  Changing it after the interface is up will have no effect.  You need | ||||
| to bring down the interface and bring it back up to have the changes take effect. | ||||
|  | ||||
| CPU load imposed on the Krait CPUs appears negligible with this driver intercepting | ||||
| the physical interface's ingress traffic.  Full line speed of the GMAC interface | ||||
| could still be achieved. | ||||
|  | ||||
| The commands below shows an example to shape ingress traffic to 500 Mbps and egress | ||||
| to 200 Mbps for the 'eth0' interface. | ||||
|  | ||||
| # Load the module if it's not loaded | ||||
| modprobe nss-ifb | ||||
|  | ||||
| # Bring up the nssifb interface to active ingress redirect | ||||
| ip link set up nssifb | ||||
|  | ||||
| # Shape ingress traffic to 500 Mbit with chained NSSFQ_CODEL | ||||
| tc qdisc add dev nssifb root handle 1: nsstbl rate 500Mbit burst 1Mb | ||||
| tc qdisc add dev nssifb parent 1: handle 10: nssfq_codel limit 10240 flows 1024 quantum 1514 target 5ms interval 100ms set_default | ||||
|  | ||||
| # Shape egress traffic to 200 Mbit with chained NSSFQ_CODEL | ||||
| tc qdisc add dev eth0 root handle 1: nsstbl rate 200Mbit burst 1Mb | ||||
| tc qdisc add dev eth0 parent 1: handle 10: nssfq_codel limit 10240 flows 1024 quantum 1514 target 5ms interval 100ms set_default | ||||
|  | ||||
							
								
								
									
										3
									
								
								package/qca/nss-ifb/src/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								package/qca/nss-ifb/src/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| obj-m += nss-ifb.o | ||||
|  | ||||
| nss-ifb-objs := nss_ifb.o | ||||
							
								
								
									
										304
									
								
								package/qca/nss-ifb/src/nss_ifb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										304
									
								
								package/qca/nss-ifb/src/nss_ifb.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,304 @@ | ||||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||||
|  | ||||
| /* | ||||
|  * This driver is adapted from the Linux /drivers/net/ifb.c file. | ||||
|  * | ||||
|  * Redirect QCA NSS physical interface ingress traffic to this driver's | ||||
|  * virtual interface.  This will allow ingress traffic shaping using the | ||||
|  * QCA NSS shaper. | ||||
|  */ | ||||
|  | ||||
| #include <nss_api_if.h> | ||||
|  | ||||
| #define TX_Q_LIMIT    32 | ||||
|  | ||||
| struct nss_ifb_dev_private { | ||||
| 	struct nss_virt_if_handle *nssctx; | ||||
| 	struct net_device *nss_src_dev; | ||||
| 	uint32_t nss_src_if_num; | ||||
| 	char nss_src_dev_name[32]; | ||||
| }; | ||||
|  | ||||
| char nss_dev_name_array[32] = "eth0"; | ||||
| char *nss_dev_name = nss_dev_name_array; | ||||
| module_param(nss_dev_name, charp, 0644); | ||||
| MODULE_PARM_DESC(nss_dev_name, "NSS physical interface source device name"); | ||||
|  | ||||
| /* | ||||
|  * Virtual interface egress packet callback. | ||||
|  * | ||||
|  * We send it back to the Linux network stack. | ||||
|  */ | ||||
| static void nss_ifb_data_cb(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp = netdev_priv(netdev); | ||||
|  | ||||
| 	skb->protocol = eth_type_trans(skb, dp->nss_src_dev); | ||||
| 	skb->ip_summed = CHECKSUM_UNNECESSARY; | ||||
|  | ||||
| 	napi_gro_receive(napi, skb); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Virtual interface ingress packet callback. | ||||
|  * | ||||
|  * We just send it back to the NSS firmware to let the shaper work on it. | ||||
|  */ | ||||
| static void nss_ifb_xmit_cb(struct net_device *netdev, struct sk_buff *skb) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp = netdev_priv(netdev); | ||||
| 	int ret; | ||||
|  | ||||
| 	ret = nss_virt_if_tx_buf(dp->nssctx, skb); | ||||
| 	if (unlikely(ret)) { | ||||
| 		pr_warn("Failed [%d] to send skb [len: %d, protocol: 0x%X] to NSS!\n", | ||||
| 			ret, skb->len, ntohs(skb->protocol)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static void nss_ifb_stats64(struct net_device *dev, | ||||
| 			struct rtnl_link_stats64 *stats) | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| static int nss_ifb_dev_init(struct net_device *dev) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp =  netdev_priv(dev); | ||||
|  | ||||
| 	dp->nssctx = nss_virt_if_create_sync_nexthop(dev, NSS_ETH_RX_INTERFACE, NSS_ETH_RX_INTERFACE); | ||||
| 	if (!dp->nssctx) { | ||||
| 		dp->nssctx = NULL; | ||||
| 		pr_warn("Could not create a NSS virtual interface for dev [%s]\n", | ||||
| 			dev->name); | ||||
|  | ||||
| 		return -ENODEV; | ||||
| 	} | ||||
| 	pr_info("Created a NSS virtual interface for dev [%s]\n", dev->name); | ||||
|  | ||||
| 	nss_virt_if_register(dp->nssctx, nss_ifb_data_cb, dev); | ||||
| 	pr_info("NSS IFB data callback registered\n"); | ||||
|  | ||||
| 	nss_virt_if_xmit_callback_register(dp->nssctx, nss_ifb_xmit_cb); | ||||
| 	pr_info("NSS IFB transmit callback registered\n"); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static void nss_ifb_dev_uninit(struct net_device *dev) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp = netdev_priv(dev); | ||||
| 	int ret; | ||||
|  | ||||
| 	nss_virt_if_xmit_callback_unregister(dp->nssctx); | ||||
| 	pr_info("NSS IFB transmit callback unregistered\n"); | ||||
|  | ||||
| 	ret = nss_virt_if_destroy_sync(dp->nssctx); | ||||
| 	if (ret == NSS_TX_SUCCESS) { | ||||
| 		pr_info("NSS virtual interface destroyed for dev [%s]\n", dev->name); | ||||
| 	} | ||||
| 	else { | ||||
| 		pr_warn("Unable to destroy NSS virtual interface for dev [%s], error[%d]\n", | ||||
| 		dev->name, ret); | ||||
| 	} | ||||
| 	dp->nssctx = NULL; | ||||
| } | ||||
|  | ||||
| static netdev_tx_t nss_ifb_xmit(struct sk_buff *skb, struct net_device *dev) | ||||
| { | ||||
| 	return NETDEV_TX_OK; | ||||
| } | ||||
|  | ||||
| static int nss_ifb_close(struct net_device *dev) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp = netdev_priv(dev); | ||||
| 	struct nss_ctx_instance *nss_ctx; | ||||
| 	struct net_device *src_dev; | ||||
| 	uint32_t src_if_num; | ||||
| 	int ret; | ||||
|  | ||||
| 	nss_ctx = dp->nssctx->nss_ctx; | ||||
| 	src_dev = dp->nss_src_dev; | ||||
| 	src_if_num = dp->nss_src_if_num; | ||||
|  | ||||
| 	ret = nss_phys_if_set_nexthop(nss_ctx, src_if_num, NSS_ETH_RX_INTERFACE); | ||||
| 	if (ret != NSS_TX_SUCCESS) { | ||||
| 		pr_warn("%p: Failed to reset next hop for net device [%s].\n", | ||||
| 			nss_ctx, src_dev->name); | ||||
| 	} | ||||
| 	else { | ||||
| 		pr_info("%p: Reset nexthop successful for net device [%s].\n", | ||||
| 			nss_ctx, src_dev->name); | ||||
| 	} | ||||
|  | ||||
| 	dev_put(src_dev); | ||||
| 	dp->nss_src_dev = NULL; | ||||
| 	dp->nss_src_if_num = -1; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int nss_ifb_open(struct net_device *dev) | ||||
| { | ||||
| 	struct nss_ifb_dev_private *dp = netdev_priv(dev); | ||||
| 	struct net_device *src_dev; | ||||
| 	uint32_t src_if_num; | ||||
| 	uint32_t nh_if_num; | ||||
| 	nss_tx_status_t nss_tx_status; | ||||
| 	struct nss_ctx_instance *nss_ctx; | ||||
|  | ||||
| 	nss_ctx = dp->nssctx->nss_ctx; | ||||
| 	nh_if_num = dp->nssctx->if_num_n2h; | ||||
|  | ||||
| 	strcpy(dp->nss_src_dev_name, nss_dev_name); | ||||
|  | ||||
| 	src_dev = dev_get_by_name(&init_net, dp->nss_src_dev_name); | ||||
| 	if (!src_dev) { | ||||
| 		pr_warn("%p: Cannot find the net device [%s]\n", | ||||
| 			nss_ctx, dp->nss_src_dev_name); | ||||
|  | ||||
| 		return -ENODEV; | ||||
| 	} | ||||
| 	pr_info("%p: Found net device [%s]\n", nss_ctx, dp->nss_src_dev_name); | ||||
|  | ||||
| 	src_if_num = nss_cmn_get_interface_number_by_dev(src_dev); | ||||
| 	if (src_if_num < 0) { | ||||
| 		pr_warn("%p: Invalid interface number:%d\n", nss_ctx, src_if_num); | ||||
| 		dev_put(src_dev); | ||||
|  | ||||
| 		return -ENODEV; | ||||
| 	} | ||||
| 	pr_info("%p: Net device [%s] has NSS intf_num [%d]\n", | ||||
| 		nss_ctx, dp->nss_src_dev_name, src_if_num); | ||||
|  | ||||
| 	nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, src_if_num, nh_if_num); | ||||
| 	if (nss_tx_status != NSS_TX_SUCCESS) { | ||||
| 		pr_warn("%p: Sending message failed, cannot change nexthop for [%s]\n", | ||||
| 			nss_ctx, dp->nss_src_dev_name); | ||||
| 	} | ||||
| 	else { | ||||
| 		pr_info("Nexthop successfully set for [%s] to [%s]\n", | ||||
| 			dp->nss_src_dev_name, dev->name); | ||||
| 	} | ||||
|  | ||||
| 	dp->nss_src_dev = src_dev; | ||||
| 	dp->nss_src_if_num = src_if_num; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static const struct net_device_ops nss_ifb_netdev_ops = { | ||||
| 	.ndo_open	= nss_ifb_open, | ||||
| 	.ndo_stop	= nss_ifb_close, | ||||
| 	.ndo_get_stats64 = nss_ifb_stats64, | ||||
| 	.ndo_start_xmit	= nss_ifb_xmit, | ||||
| 	.ndo_validate_addr = eth_validate_addr, | ||||
| 	.ndo_init	= nss_ifb_dev_init, | ||||
| 	.ndo_uninit	= nss_ifb_dev_uninit, | ||||
| }; | ||||
|  | ||||
| #define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST	| \ | ||||
| 		      NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6	| \ | ||||
| 		      NETIF_F_GSO_ENCAP_ALL 				| \ | ||||
| 		      NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX		| \ | ||||
| 		      NETIF_F_HW_VLAN_STAG_TX) | ||||
|  | ||||
| static void nss_ifb_dev_free(struct net_device *dev) | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| static void nss_ifb_setup(struct net_device *dev) | ||||
| { | ||||
| 	/* Initialize the device structure. */ | ||||
| 	dev->netdev_ops = &nss_ifb_netdev_ops; | ||||
|  | ||||
| 	/* Fill in device structure with ethernet-generic values. */ | ||||
| 	ether_setup(dev); | ||||
| 	dev->tx_queue_len = TX_Q_LIMIT; | ||||
|  | ||||
| 	dev->features |= IFB_FEATURES; | ||||
| 	dev->hw_features |= dev->features; | ||||
| 	dev->hw_enc_features |= dev->features; | ||||
| 	dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | | ||||
| 					       NETIF_F_HW_VLAN_STAG_TX); | ||||
|  | ||||
| 	dev->flags |= IFF_NOARP; | ||||
| 	dev->flags &= ~IFF_MULTICAST; | ||||
| 	dev->priv_flags &= ~IFF_TX_SKB_SHARING; | ||||
| 	netif_keep_dst(dev); | ||||
| 	eth_hw_addr_random(dev); | ||||
| 	dev->needs_free_netdev = true; | ||||
| 	dev->priv_destructor = nss_ifb_dev_free; | ||||
|  | ||||
| 	dev->min_mtu = 0; | ||||
| 	dev->max_mtu = 0; | ||||
| } | ||||
|  | ||||
| static int nss_ifb_validate(struct nlattr *tb[], struct nlattr *data[], | ||||
| 			struct netlink_ext_ack *extack) | ||||
| { | ||||
| 	if (tb[IFLA_ADDRESS]) { | ||||
| 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) | ||||
| 			return -EINVAL; | ||||
| 		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) | ||||
| 			return -EADDRNOTAVAIL; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static struct rtnl_link_ops nss_ifb_link_ops __read_mostly = { | ||||
| 	.kind		= "nss_ifb", | ||||
| 	.priv_size	= sizeof(struct nss_ifb_dev_private), | ||||
| 	.setup		= nss_ifb_setup, | ||||
| 	.validate	= nss_ifb_validate, | ||||
| }; | ||||
|  | ||||
| static int __init nss_ifb_init_module(void) | ||||
| { | ||||
| 	struct net_device *dev; | ||||
| 	int err; | ||||
|  | ||||
| 	down_write(&pernet_ops_rwsem); | ||||
| 	rtnl_lock(); | ||||
| 	err = __rtnl_link_register(&nss_ifb_link_ops); | ||||
| 	if (err < 0) | ||||
| 		goto out; | ||||
|  | ||||
| 	dev = alloc_netdev(sizeof(struct nss_ifb_dev_private), "nssifb", | ||||
| 			NET_NAME_UNKNOWN, nss_ifb_setup); | ||||
|  | ||||
| 	if (dev) { | ||||
| 		dev->rtnl_link_ops = &nss_ifb_link_ops; | ||||
| 		err = register_netdevice(dev); | ||||
| 	} | ||||
| 	else { | ||||
| 		err = -ENOMEM; | ||||
| 	} | ||||
|  | ||||
| 	if (err) | ||||
| 		__rtnl_link_unregister(&nss_ifb_link_ops); | ||||
|  | ||||
| out: | ||||
| 	rtnl_unlock(); | ||||
| 	up_write(&pernet_ops_rwsem); | ||||
|  | ||||
| 	if (!err) | ||||
| 		pr_info("NSS IFB module loaded.\n"); | ||||
| 	else | ||||
| 		pr_warn("Failed to load NSS IFB module.\n"); | ||||
|  | ||||
| 	return err; | ||||
| } | ||||
|  | ||||
| static void __exit nss_ifb_cleanup_module(void) | ||||
| { | ||||
| 	rtnl_link_unregister(&nss_ifb_link_ops); | ||||
|  | ||||
| 	pr_info("NSS IFB module unloaded.\n"); | ||||
| } | ||||
|  | ||||
| module_init(nss_ifb_init_module); | ||||
| module_exit(nss_ifb_cleanup_module); | ||||
| MODULE_LICENSE("GPL"); | ||||
| MODULE_ALIAS_RTNL_LINK("nss_ifb"); | ||||
							
								
								
									
										98
									
								
								package/qca/qca-nss-cfi/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								package/qca/qca-nss-cfi/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-cfi | ||||
| PKG_RELEASE:=2 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-cfi | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=8035a8ddefdcc8a2f06c96b2a82618ca6ce6406d | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| ifeq ($(CONFIG_TARGET_ipq),y) | ||||
| subtarget:=$(SUBTARGET) | ||||
| else | ||||
| subtarget:=$(CONFIG_TARGET_BOARD) | ||||
| endif | ||||
|  | ||||
| # v1.0 is for Akronite | ||||
| # v2.0 is for Hawkeye/Cypress/Maple | ||||
| ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64")) | ||||
|   CFI_OCF_DIR:=ocf/v2.0 | ||||
|   CFI_CRYPTOAPI_DIR:=cryptoapi/v2.0 | ||||
| else | ||||
|   CFI_CRYPTOAPI_DIR:=cryptoapi/v1.1 | ||||
|   CFI_OCF_DIR:=ocf/v1.0 | ||||
|   CFI_IPSEC_DIR:=ipsec/v1.0 | ||||
| endif | ||||
|  | ||||
| define KernelPackage/qca-nss-cfi-cryptoapi | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ | ||||
| 		+kmod-qca-nss-crypto +kmod-crypto-authenc @!LINUX_3_18 | ||||
|   TITLE:=Kernel driver for NSS cfi | ||||
|   FILES:=$(PKG_BUILD_DIR)/$(CFI_CRYPTOAPI_DIR)/qca-nss-cfi-cryptoapi.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,59,qca-nss-cfi-cryptoapi) | ||||
| endef | ||||
|  | ||||
| # OCF should be dropped | ||||
| # define KernelPackage/qca-nss-cfi-ocf | ||||
| #   SECTION:=kernel | ||||
| #   CATEGORY:=Kernel modules | ||||
| #   SUBMENU:=Network Devices | ||||
| #   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ | ||||
| # 		+kmod-qca-nss-crypto +PACKAGE_kmod-crypto-ocf:kmod-crypto-ocf @!LINUX_3_18 | ||||
| #   TITLE:=Kernel driver for NSS cfi | ||||
| #   FILES:=$(PKG_BUILD_DIR)/$(CFI_OCF_DIR)/qca-nss-cfi-ocf.ko | ||||
|  | ||||
| # ifdef CFI_IPSEC_DIR | ||||
| #   FILES+=$(PKG_BUILD_DIR)/$(CFI_IPSEC_DIR)/qca-nss-ipsec.ko | ||||
| #   AUTOLOAD:=$(call AutoLoad,61,qca-nss-cfi-ocf qca-nss-ipsec) | ||||
| # else | ||||
| #   AUTOLOAD:=$(call AutoLoad,61,qca-nss-cfi-ocf) | ||||
| # endif | ||||
| # endef | ||||
|  | ||||
| define Build/InstallDev/qca-nss-cfi | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-cfi | ||||
| 	$(CP) $(PKG_BUILD_DIR)/$(CFI_CRYPTOAPI_DIR)/../exports/* $(1)/usr/include/qca-nss-cfi | ||||
| 	$(CP) $(PKG_BUILD_DIR)/include/* $(1)/usr/include/qca-nss-cfi | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	$(call Build/InstallDev/qca-nss-cfi,$(1)) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-cfi/Description | ||||
| This package contains a NSS cfi driver for QCA chipset | ||||
| endef | ||||
|  | ||||
| EXTRA_CFLAGS+= \ | ||||
| 	-DCONFIG_NSS_DEBUG_LEVEL=4 \ | ||||
| 	-I$(LINUX_DIR)/crypto/ocf \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-crypto \ | ||||
| 	-I$(STAGING_DIR)/usr/include/crypto \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-drv | ||||
|  | ||||
| ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64")) | ||||
| EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-clients | ||||
| endif | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||
| 		CFI_CRYPTOAPI_DIR=$(CFI_CRYPTOAPI_DIR) \ | ||||
| 		CFI_OCF_DIR=$(CFI_OCF_DIR) \ | ||||
| 		CFI_IPSEC_DIR=$(CFI_IPSEC_DIR) \ | ||||
| 		SoC=$(subtarget) \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-cfi-cryptoapi)) | ||||
| #$(eval $(call KernelPackage,qca-nss-cfi-ocf)) | ||||
| @@ -0,0 +1,30 @@ | ||||
| From a8a573c5ce83bdddca9a60c62161638a5fd906d4 Mon Sep 17 00:00:00 2001 | ||||
| From: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| Date: Sat, 13 Jun 2020 12:57:14 +0200 | ||||
| Subject: [PATCH 1/3] compile only cryptoapi | ||||
|  | ||||
| --- | ||||
|  Makefile | 8 ++++---- | ||||
|  1 file changed, 4 insertions(+), 4 deletions(-) | ||||
|  | ||||
| diff --git a/Makefile b/Makefile | ||||
| index c42adca..36a9d3f 100644 | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -4,9 +4,9 @@ | ||||
|   | ||||
|  export BUILD_ID = \"Build Id: $(shell date +'%m/%d/%y, %H:%M:%S')\" | ||||
|   | ||||
| -obj-m += $(CFI_OCF_DIR)/ | ||||
| +# obj-m += $(CFI_OCF_DIR)/ | ||||
|  obj-m += $(CFI_CRYPTOAPI_DIR)/ | ||||
|   | ||||
| -ifeq ($(SoC),$(filter $(SoC),ipq806x)) | ||||
| -obj-m += $(CFI_IPSEC_DIR)/ | ||||
| -endif | ||||
| +# ifeq ($(SoC),$(filter $(SoC),ipq806x)) | ||||
| +# obj-m += $(CFI_IPSEC_DIR)/ | ||||
| +# endif | ||||
| --  | ||||
| 2.27.0.rc0 | ||||
|  | ||||
							
								
								
									
										78
									
								
								package/qca/qca-nss-cfi/patches/0002-wip-support-5.4.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								package/qca/qca-nss-cfi/patches/0002-wip-support-5.4.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,78 @@ | ||||
| From 202f57bae49947a04301ac8ac9bdc00f28f09355 Mon Sep 17 00:00:00 2001 | ||||
| From: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| Date: Sat, 13 Jun 2020 12:58:26 +0200 | ||||
| Subject: [PATCH 2/3] wip: support 5.4 | ||||
|  | ||||
| --- | ||||
|  cryptoapi/v1.1/nss_cryptoapi.c      |  1 - | ||||
|  cryptoapi/v1.1/nss_cryptoapi_ablk.c | 12 ++++++------ | ||||
|  cryptoapi/v1.1/nss_cryptoapi_aead.c |  2 +- | ||||
|  3 files changed, 7 insertions(+), 8 deletions(-) | ||||
|  | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi.c b/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| index d1a7313..a10590e 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| @@ -231,7 +231,6 @@ static struct crypto_alg cryptoapi_ablkcipher_algs[] = { | ||||
|  		.cra_u          = { | ||||
|  			.ablkcipher = { | ||||
|  				.ivsize         = CTR_RFC3686_IV_SIZE, | ||||
| -				.geniv          = "seqiv", | ||||
|  				.min_keysize    = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
|  				.max_keysize    = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
|  				.setkey         = nss_cryptoapi_ablk_aes_setkey, | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi_ablk.c b/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| index 223591c..9b6c65e 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| @@ -108,7 +108,7 @@ EXPORT_SYMBOL(nss_cryptoapi_skcipher_ctx2session); | ||||
|  int nss_cryptoapi_ablkcipher_init(struct crypto_tfm *tfm) | ||||
|  { | ||||
|  	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(tfm); | ||||
| -	struct crypto_ablkcipher *sw_tfm; | ||||
| +	struct crypto_cipher *sw_tfm; | ||||
|   | ||||
|  	nss_cfi_assert(ctx); | ||||
|   | ||||
| @@ -122,20 +122,20 @@ int nss_cryptoapi_ablkcipher_init(struct crypto_tfm *tfm) | ||||
|   | ||||
|  	nss_cryptoapi_set_magic(ctx); | ||||
|   | ||||
| -	if (!(crypto_tfm_alg_flags(tfm) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
| +	if (!(crypto_tfm_alg_type(tfm) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
|  		return 0; | ||||
|   | ||||
|  	/* Alloc fallback transform for future use */ | ||||
| -	sw_tfm = crypto_alloc_ablkcipher(crypto_tfm_alg_name(tfm), 0, CRYPTO_ALG_ASYNC | | ||||
| -									CRYPTO_ALG_NEED_FALLBACK); | ||||
| +	sw_tfm = crypto_alloc_cipher(crypto_tfm_alg_name(tfm), 0, CRYPTO_ALG_ASYNC | | ||||
| + 									CRYPTO_ALG_NEED_FALLBACK); | ||||
|  	if (IS_ERR(sw_tfm)) { | ||||
|  		nss_cfi_err("unable to alloc software crypto for %s\n", crypto_tfm_alg_name(tfm)); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
|  	/* set this tfm reqsize same to fallback tfm */ | ||||
| -	tfm->crt_ablkcipher.reqsize = crypto_ablkcipher_reqsize(sw_tfm); | ||||
| -	ctx->sw_tfm = crypto_ablkcipher_tfm(sw_tfm); | ||||
| +	tfm->crt_ablkcipher.reqsize = sizeof(struct nss_cryptoapi_ctx); | ||||
| +	ctx->sw_tfm = crypto_cipher_tfm(sw_tfm); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi_aead.c b/cryptoapi/v1.1/nss_cryptoapi_aead.c | ||||
| index 527936b..53e4bed 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi_aead.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi_aead.c | ||||
| @@ -103,7 +103,7 @@ int nss_cryptoapi_aead_init(struct crypto_aead *aead) | ||||
|   | ||||
|  	nss_cryptoapi_set_magic(ctx); | ||||
|   | ||||
| -	if (!(crypto_tfm_alg_flags(tfm) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
| +	if (!(crypto_tfm_alg_type(tfm) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
|  		return 0; | ||||
|   | ||||
|  	/* Alloc fallback transform for future use */ | ||||
| --  | ||||
| 2.27.0.rc0 | ||||
|  | ||||
| @@ -0,0 +1,707 @@ | ||||
| From e3a53a6d11b2c1770545a2820a58c117799bcb70 Mon Sep 17 00:00:00 2001 | ||||
| From: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| Date: Tue, 16 Jun 2020 18:12:34 +0200 | ||||
| Subject: [PATCH 3/3] Convert ablkcipher to skcipher | ||||
|  | ||||
| --- | ||||
|  cryptoapi/v1.1/nss_cryptoapi.c         | 149 +++++++++++-------------- | ||||
|  cryptoapi/v1.1/nss_cryptoapi_ablk.c    | 136 +++++++++++----------- | ||||
|  cryptoapi/v1.1/nss_cryptoapi_debugfs.c |   1 + | ||||
|  cryptoapi/v1.1/nss_cryptoapi_private.h |  16 +-- | ||||
|  4 files changed, 145 insertions(+), 157 deletions(-) | ||||
|  | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi.c b/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| index a10590e..3a835dc 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi.c | ||||
| @@ -66,7 +66,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "echainiv(authenc(hmac(sha1),cbc(aes)))", | ||||
|  			.cra_driver_name = "nss-hmac-sha1-cbc-aes", | ||||
|  			.cra_priority   = 10000, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -87,7 +87,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "seqiv(authenc(hmac(sha1),rfc3686(ctr(aes))))", | ||||
|  			.cra_driver_name = "nss-hmac-sha1-rfc3686-ctr-aes", | ||||
|  			.cra_priority   = 10000, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -108,7 +108,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "echainiv(authenc(hmac(sha1),cbc(des3_ede)))", | ||||
|  			.cra_driver_name = "nss-hmac-sha1-cbc-3des", | ||||
|  			.cra_priority   = 300, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = DES3_EDE_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -129,7 +129,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "echainiv(authenc(hmac(sha256),cbc(aes)))", | ||||
|  			.cra_driver_name = "nss-hmac-sha256-cbc-aes", | ||||
|  			.cra_priority   = 10000, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -150,7 +150,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "seqiv(authenc(hmac(sha256),rfc3686(ctr(aes))))", | ||||
|  			.cra_driver_name = "nss-hmac-sha256-rfc3686-ctr-aes", | ||||
|  			.cra_priority   = 10000, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -171,7 +171,7 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  			.cra_name       = "echainiv(authenc(hmac(sha256),cbc(des3_ede)))", | ||||
|  			.cra_driver_name = "nss-hmac-sha256-cbc-3des", | ||||
|  			.cra_priority   = 300, | ||||
| -			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG, | ||||
| +			.cra_flags      = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
|  			.cra_blocksize  = DES3_EDE_BLOCK_SIZE, | ||||
|  			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
|  			.cra_alignmask  = 0, | ||||
| @@ -192,75 +192,66 @@ struct aead_alg cryptoapi_aead_algs[] = { | ||||
|  /* | ||||
|   * ABLK cipher algorithms | ||||
|   */ | ||||
| -static struct crypto_alg cryptoapi_ablkcipher_algs[] = { | ||||
| +static struct skcipher_alg cryptoapi_skcipher_algs[] = { | ||||
|  	{ | ||||
| -		.cra_name       = "cbc(aes)", | ||||
| -		.cra_driver_name = "nss-cbc-aes", | ||||
| -		.cra_priority   = 10000, | ||||
| -		.cra_flags      = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, | ||||
| -		.cra_blocksize  = AES_BLOCK_SIZE, | ||||
| -		.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| -		.cra_alignmask  = 0, | ||||
| -		.cra_type       = &crypto_ablkcipher_type, | ||||
| -		.cra_module     = THIS_MODULE, | ||||
| -		.cra_init       = nss_cryptoapi_ablkcipher_init, | ||||
| -		.cra_exit       = nss_cryptoapi_ablkcipher_exit, | ||||
| -		.cra_u          = { | ||||
| -			.ablkcipher = { | ||||
| -				.ivsize         = AES_BLOCK_SIZE, | ||||
| -				.min_keysize    = AES_MIN_KEY_SIZE, | ||||
| -				.max_keysize    = AES_MAX_KEY_SIZE, | ||||
| -				.setkey         = nss_cryptoapi_ablk_aes_setkey, | ||||
| -				.encrypt        = nss_cryptoapi_ablk_aes_encrypt, | ||||
| -				.decrypt        = nss_cryptoapi_ablk_aes_decrypt, | ||||
| -			}, | ||||
| +		.base = { | ||||
| +			.cra_name       = "cbc(aes)", | ||||
| +			.cra_driver_name = "nss-cbc-aes", | ||||
| +			.cra_priority   = 10000, | ||||
| +			.cra_flags      = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
| +			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
| +			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| +			.cra_alignmask  = 0, | ||||
| +			.cra_module     = THIS_MODULE, | ||||
|  		}, | ||||
| +		.init       = nss_cryptoapi_skcipher_init, | ||||
| +		.exit       = nss_cryptoapi_skcipher_exit, | ||||
| +		.ivsize         = AES_BLOCK_SIZE, | ||||
| +		.min_keysize    = AES_MIN_KEY_SIZE, | ||||
| +		.max_keysize    = AES_MAX_KEY_SIZE, | ||||
| +		.setkey         = nss_cryptoapi_ablk_aes_setkey, | ||||
| +		.encrypt        = nss_cryptoapi_ablk_aes_encrypt, | ||||
| +		.decrypt        = nss_cryptoapi_ablk_aes_decrypt, | ||||
|  	}, | ||||
|  	{ | ||||
| -		.cra_name       = "rfc3686(ctr(aes))", | ||||
| -		.cra_driver_name = "nss-rfc3686-ctr-aes", | ||||
| -		.cra_priority   = 30000, | ||||
| -		.cra_flags      = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, | ||||
| -		.cra_blocksize  = AES_BLOCK_SIZE, | ||||
| -		.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| -		.cra_alignmask  = 0, | ||||
| -		.cra_type       = &crypto_ablkcipher_type, | ||||
| -		.cra_module     = THIS_MODULE, | ||||
| -		.cra_init       = nss_cryptoapi_ablkcipher_init, | ||||
| -		.cra_exit       = nss_cryptoapi_ablkcipher_exit, | ||||
| -		.cra_u          = { | ||||
| -			.ablkcipher = { | ||||
| -				.ivsize         = CTR_RFC3686_IV_SIZE, | ||||
| -				.min_keysize    = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
| -				.max_keysize    = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
| -				.setkey         = nss_cryptoapi_ablk_aes_setkey, | ||||
| -				.encrypt        = nss_cryptoapi_ablk_aes_encrypt, | ||||
| -				.decrypt        = nss_cryptoapi_ablk_aes_decrypt, | ||||
| -			}, | ||||
| +		.base = { | ||||
| +			.cra_name       = "rfc3686(ctr(aes))", | ||||
| +			.cra_driver_name = "nss-rfc3686-ctr-aes", | ||||
| +			.cra_priority   = 30000, | ||||
| +			.cra_flags      = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
| +			.cra_blocksize  = AES_BLOCK_SIZE, | ||||
| +			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| +			.cra_alignmask  = 0, | ||||
| +			.cra_module     = THIS_MODULE, | ||||
|  		}, | ||||
| +		.init       = nss_cryptoapi_skcipher_init, | ||||
| +		.exit       = nss_cryptoapi_skcipher_exit, | ||||
| +		.ivsize         = CTR_RFC3686_IV_SIZE, | ||||
| +		.min_keysize    = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
| +		.max_keysize    = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, | ||||
| +		.setkey         = nss_cryptoapi_ablk_aes_setkey, | ||||
| +		.encrypt        = nss_cryptoapi_ablk_aes_encrypt, | ||||
| +		.decrypt        = nss_cryptoapi_ablk_aes_decrypt, | ||||
|  	}, | ||||
|  	{ | ||||
| -		.cra_name       = "cbc(des3_ede)", | ||||
| -		.cra_driver_name = "nss-cbc-3des", | ||||
| -		.cra_priority   = 1000, | ||||
| -		.cra_flags      = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC, | ||||
| -		.cra_blocksize  = DES3_EDE_BLOCK_SIZE, | ||||
| -		.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| -		.cra_alignmask  = 0, | ||||
| -		.cra_type       = &crypto_ablkcipher_type, | ||||
| -		.cra_module     = THIS_MODULE, | ||||
| -		.cra_init       = nss_cryptoapi_ablkcipher_init, | ||||
| -		.cra_exit       = nss_cryptoapi_ablkcipher_exit, | ||||
| -		.cra_u          = { | ||||
| -			.ablkcipher = { | ||||
| -				.ivsize         = DES3_EDE_BLOCK_SIZE, | ||||
| -				.min_keysize    = DES3_EDE_KEY_SIZE, | ||||
| -				.max_keysize    = DES3_EDE_KEY_SIZE, | ||||
| -				.setkey         = nss_cryptoapi_3des_cbc_setkey, | ||||
| -				.encrypt        = nss_cryptoapi_3des_cbc_encrypt, | ||||
| -				.decrypt        = nss_cryptoapi_3des_cbc_decrypt, | ||||
| -			}, | ||||
| +		.base = { | ||||
| +			.cra_name       = "cbc(des3_ede)", | ||||
| +			.cra_driver_name = "nss-cbc-3des", | ||||
| +			.cra_priority   = 1000, | ||||
| +			.cra_flags      = CRYPTO_ALG_TYPE_SKCIPHER | CRYPTO_ALG_NOSUPP_SG | CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY, | ||||
| +			.cra_blocksize  = DES3_EDE_BLOCK_SIZE, | ||||
| +			.cra_ctxsize    = sizeof(struct nss_cryptoapi_ctx), | ||||
| +			.cra_alignmask  = 0, | ||||
| +			.cra_module     = THIS_MODULE, | ||||
|  		}, | ||||
| +		.init       = nss_cryptoapi_skcipher_init, | ||||
| +		.exit       = nss_cryptoapi_skcipher_exit, | ||||
| +		.ivsize         = DES3_EDE_BLOCK_SIZE, | ||||
| +		.min_keysize    = DES3_EDE_KEY_SIZE, | ||||
| +		.max_keysize    = DES3_EDE_KEY_SIZE, | ||||
| +		.setkey         = nss_cryptoapi_3des_cbc_setkey, | ||||
| +		.encrypt        = nss_cryptoapi_3des_cbc_encrypt, | ||||
| +		.decrypt        = nss_cryptoapi_3des_cbc_decrypt, | ||||
|  	}, | ||||
|  }; | ||||
|   | ||||
| @@ -277,14 +268,14 @@ static nss_crypto_user_ctx_t nss_cryptoapi_register(nss_crypto_handle_t crypto) | ||||
|   | ||||
|  	sc->crypto = crypto; | ||||
|   | ||||
| -	for (i = 0; i < ARRAY_SIZE(cryptoapi_ablkcipher_algs); i++) { | ||||
| -		rc = crypto_register_alg(&cryptoapi_ablkcipher_algs[i]); | ||||
| +	for (i = 0; i < ARRAY_SIZE(cryptoapi_skcipher_algs); i++) { | ||||
| +		rc = crypto_register_skcipher(&cryptoapi_skcipher_algs[i]); | ||||
|  		if (rc) { | ||||
| -			nss_cfi_trace("Ablk registration failed, algo: %s\n", cryptoapi_ablkcipher_algs[i].cra_name); | ||||
| -			cryptoapi_ablkcipher_algs[i].cra_flags = 0; | ||||
| +			nss_cfi_trace("Ablk registration failed, algo: %s\n", cryptoapi_skcipher_algs[i].base.cra_name); | ||||
| +			cryptoapi_skcipher_algs[i].base.cra_flags = 0; | ||||
|  			continue; | ||||
|  		} | ||||
| -		nss_cfi_info("Ablk registration succeeded, algo: %s\n", cryptoapi_ablkcipher_algs[i].cra_name); | ||||
| +		nss_cfi_info("Ablk registration succeeded, algo: %s\n", cryptoapi_skcipher_algs[i].base.cra_name); | ||||
|  	} | ||||
|   | ||||
|  	for (i = 0; i < ARRAY_SIZE(cryptoapi_aead_algs); i++) { | ||||
| @@ -317,7 +308,7 @@ static nss_crypto_user_ctx_t nss_cryptoapi_register(nss_crypto_handle_t crypto) | ||||
|  static void nss_cryptoapi_unregister(nss_crypto_user_ctx_t cfi) | ||||
|  { | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
| -	int i, ret = 0; | ||||
| +	int i; | ||||
|   | ||||
|  	nss_cfi_info("unregister nss_cryptoapi\n"); | ||||
|   | ||||
| @@ -326,16 +317,12 @@ static void nss_cryptoapi_unregister(nss_crypto_user_ctx_t cfi) | ||||
|  	 */ | ||||
|  	atomic_set(&gbl_ctx.registered, 0); | ||||
|   | ||||
| -	for (i = 0; i < ARRAY_SIZE(cryptoapi_ablkcipher_algs); i++) { | ||||
| -		if (!cryptoapi_ablkcipher_algs[i].cra_flags) { | ||||
| -			continue; | ||||
| -		} | ||||
| -		ret = crypto_unregister_alg(&cryptoapi_ablkcipher_algs[i]); | ||||
| -		if (ret) { | ||||
| -			nss_cfi_err("Ablk unregister failed, algo: %s\n", cryptoapi_ablkcipher_algs[i].cra_name); | ||||
| +	for (i = 0; i < ARRAY_SIZE(cryptoapi_skcipher_algs); i++) { | ||||
| +		if (!cryptoapi_skcipher_algs[i].base.cra_flags) { | ||||
|  			continue; | ||||
|  		} | ||||
| -		nss_cfi_info("Ablk unregister succeeded, algo: %s\n", cryptoapi_ablkcipher_algs[i].cra_name); | ||||
| +		crypto_unregister_skcipher(&cryptoapi_skcipher_algs[i]); | ||||
| +		nss_cfi_info("Ablk unregister succeeded, algo: %s\n", cryptoapi_skcipher_algs[i].base.cra_name); | ||||
|  	} | ||||
|   | ||||
|  	for (i = 0; i < ARRAY_SIZE(cryptoapi_aead_algs); i++) { | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi_ablk.c b/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| index 9b6c65e..913e9cc 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi_ablk.c | ||||
| @@ -102,12 +102,12 @@ int nss_cryptoapi_skcipher_ctx2session(struct crypto_skcipher *sk, uint32_t *sid | ||||
|  EXPORT_SYMBOL(nss_cryptoapi_skcipher_ctx2session); | ||||
|   | ||||
|  /* | ||||
| - * nss_cryptoapi_ablkcipher_init() | ||||
| - * 	Cryptoapi ablkcipher init function. | ||||
| + * nss_cryptoapi_skcipher_init() | ||||
| + * 	Cryptoapi skcipher init function. | ||||
|   */ | ||||
| -int nss_cryptoapi_ablkcipher_init(struct crypto_tfm *tfm) | ||||
| +int nss_cryptoapi_skcipher_init(struct crypto_skcipher  *tfm) | ||||
|  { | ||||
| -	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(tfm); | ||||
| +	struct nss_cryptoapi_ctx *ctx = crypto_skcipher_ctx(tfm); | ||||
|  	struct crypto_cipher *sw_tfm; | ||||
|   | ||||
|  	nss_cfi_assert(ctx); | ||||
| @@ -122,31 +122,31 @@ int nss_cryptoapi_ablkcipher_init(struct crypto_tfm *tfm) | ||||
|   | ||||
|  	nss_cryptoapi_set_magic(ctx); | ||||
|   | ||||
| -	if (!(crypto_tfm_alg_type(tfm) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
| +	if (!(crypto_tfm_alg_type(&tfm->base) & CRYPTO_ALG_NEED_FALLBACK)) | ||||
|  		return 0; | ||||
|   | ||||
|  	/* Alloc fallback transform for future use */ | ||||
| -	sw_tfm = crypto_alloc_cipher(crypto_tfm_alg_name(tfm), 0, CRYPTO_ALG_ASYNC | | ||||
| +	sw_tfm = crypto_alloc_cipher(crypto_tfm_alg_name(&tfm->base), 0, CRYPTO_ALG_ASYNC | | ||||
|   									CRYPTO_ALG_NEED_FALLBACK); | ||||
|  	if (IS_ERR(sw_tfm)) { | ||||
| -		nss_cfi_err("unable to alloc software crypto for %s\n", crypto_tfm_alg_name(tfm)); | ||||
| +		nss_cfi_err("unable to alloc software crypto for %s\n", crypto_tfm_alg_name(&tfm->base)); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
|  	/* set this tfm reqsize same to fallback tfm */ | ||||
| -	tfm->crt_ablkcipher.reqsize = sizeof(struct nss_cryptoapi_ctx); | ||||
| +	crypto_skcipher_set_reqsize(tfm, sizeof(struct nss_cryptoapi_ctx)); | ||||
|  	ctx->sw_tfm = crypto_cipher_tfm(sw_tfm); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| - * nss_cryptoapi_ablkcipher_exit() | ||||
| - * 	Cryptoapi ablkcipher exit function. | ||||
| + * nss_cryptoapi_skcipher_exit() | ||||
| + * 	Cryptoapi skcipher exit function. | ||||
|   */ | ||||
| -void nss_cryptoapi_ablkcipher_exit(struct crypto_tfm *tfm) | ||||
| +void nss_cryptoapi_skcipher_exit(struct crypto_skcipher *tfm) | ||||
|  { | ||||
| -	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(tfm); | ||||
| +	struct nss_cryptoapi_ctx *ctx = crypto_skcipher_ctx(tfm); | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	nss_crypto_status_t status; | ||||
|   | ||||
| @@ -158,7 +158,7 @@ void nss_cryptoapi_ablkcipher_exit(struct crypto_tfm *tfm) | ||||
|  	} | ||||
|   | ||||
|  	if (ctx->sw_tfm) { | ||||
| -		crypto_free_ablkcipher(__crypto_ablkcipher_cast(ctx->sw_tfm)); | ||||
| +		crypto_free_skcipher(__crypto_skcipher_cast(ctx->sw_tfm)); | ||||
|  		ctx->sw_tfm = NULL; | ||||
|  	} | ||||
|   | ||||
| @@ -183,9 +183,9 @@ void nss_cryptoapi_ablkcipher_exit(struct crypto_tfm *tfm) | ||||
|   * nss_cryptoapi_ablk_aes_setkey() | ||||
|   * 	Cryptoapi setkey routine for aes. | ||||
|   */ | ||||
| -int nss_cryptoapi_ablk_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) | ||||
| +int nss_cryptoapi_ablk_aes_setkey(struct crypto_skcipher *cipher, const u8 *key, unsigned int keylen) | ||||
|  { | ||||
| -	struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); | ||||
| +	struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); | ||||
|  	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(tfm); | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_crypto_key cip; | ||||
| @@ -255,10 +255,10 @@ int nss_cryptoapi_ablk_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *ke | ||||
|   | ||||
|  		/* set flag to fallback tfm */ | ||||
|  		crypto_tfm_clear_flags(ctx->sw_tfm, CRYPTO_TFM_REQ_MASK); | ||||
| -		crypto_tfm_set_flags(ctx->sw_tfm, crypto_ablkcipher_get_flags(cipher) & CRYPTO_TFM_REQ_MASK); | ||||
| +		crypto_tfm_set_flags(ctx->sw_tfm, crypto_skcipher_get_flags(cipher) & CRYPTO_TFM_REQ_MASK); | ||||
|   | ||||
|  		 /* Set key to the fallback tfm */ | ||||
| -		ret = crypto_ablkcipher_setkey(__crypto_ablkcipher_cast(ctx->sw_tfm), key, keylen); | ||||
| +		ret = crypto_skcipher_setkey(__crypto_skcipher_cast(ctx->sw_tfm), key, keylen); | ||||
|  		if (ret) { | ||||
|  			nss_cfi_err("Failed to set key to the sw crypto"); | ||||
|   | ||||
| @@ -266,7 +266,7 @@ int nss_cryptoapi_ablk_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *ke | ||||
|  			 * Set back the fallback tfm flag to the original flag one after | ||||
|  			 * doing setkey | ||||
|  			 */ | ||||
| -			crypto_ablkcipher_set_flags(cipher, crypto_tfm_get_flags(ctx->sw_tfm)); | ||||
| +			crypto_skcipher_set_flags(cipher, crypto_tfm_get_flags(ctx->sw_tfm)); | ||||
|  		} | ||||
|  		return ret; | ||||
|  	default: | ||||
| @@ -289,23 +289,23 @@ int nss_cryptoapi_ablk_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *ke | ||||
|  	return 0; | ||||
|   | ||||
|  fail: | ||||
| -	crypto_ablkcipher_set_flags(cipher, flag); | ||||
| +	crypto_skcipher_set_flags(cipher, flag); | ||||
|  	return -EINVAL; | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| - * nss_cryptoapi_ablkcipher_done() | ||||
| + * nss_cryptoapi_skcipher_done() | ||||
|   * 	Cipher operation completion callback function | ||||
|   */ | ||||
| -void nss_cryptoapi_ablkcipher_done(struct nss_crypto_buf *buf) | ||||
| +void nss_cryptoapi_skcipher_done(struct nss_crypto_buf *buf) | ||||
|  { | ||||
|  	struct nss_cryptoapi_ctx *ctx; | ||||
| -	struct ablkcipher_request *req; | ||||
| +	struct skcipher_request *req; | ||||
|  	int err = 0; | ||||
|   | ||||
|  	nss_cfi_assert(buf); | ||||
|   | ||||
| -	req = (struct ablkcipher_request *)nss_crypto_get_cb_ctx(buf); | ||||
| +	req = (struct skcipher_request *)nss_crypto_get_cb_ctx(buf); | ||||
|   | ||||
|  	/* | ||||
|  	 * check cryptoapi context magic number. | ||||
| @@ -319,7 +319,7 @@ void nss_cryptoapi_ablkcipher_done(struct nss_crypto_buf *buf) | ||||
|  	nss_crypto_buf_free(gbl_ctx.crypto, buf); | ||||
|   | ||||
|  	nss_cfi_dbg("after transformation\n"); | ||||
| -	nss_cfi_dbg_data(sg_virt(req->dst), req->nbytes, ' '); | ||||
| +	nss_cfi_dbg_data(sg_virt(req->dst), req->cryptlen, ' '); | ||||
|   | ||||
|  	/* | ||||
|  	 * Passing always pass in case of encrypt. | ||||
| @@ -337,7 +337,7 @@ void nss_cryptoapi_ablkcipher_done(struct nss_crypto_buf *buf) | ||||
|   * 	Cryptoapi: obtain sg to virtual address mapping. | ||||
|   * 	Check for multiple sg in src and dst | ||||
|   */ | ||||
| -int nss_cryptoapi_ablk_checkaddr(struct ablkcipher_request *req) | ||||
| +int nss_cryptoapi_ablk_checkaddr(struct skcipher_request *req) | ||||
|  { | ||||
|  	/* | ||||
|  	 * Currently only single sg is supported | ||||
| @@ -356,7 +356,7 @@ int nss_cryptoapi_ablk_checkaddr(struct ablkcipher_request *req) | ||||
|  	/* | ||||
|  	 * If the size of data is more than 65K reject transformation | ||||
|  	 */ | ||||
| -	if (req->nbytes > NSS_CRYPTOAPI_MAX_DATA_LEN) { | ||||
| +	if (req->cryptlen > NSS_CRYPTOAPI_MAX_DATA_LEN) { | ||||
|  		nss_cfi_err("Buffer length exceeded limit\n"); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
| @@ -368,10 +368,10 @@ int nss_cryptoapi_ablk_checkaddr(struct ablkcipher_request *req) | ||||
|   * nss_cryptoapi_ablk_transform() | ||||
|   * 	Crytoapi common routine for encryption and decryption operations. | ||||
|   */ | ||||
| -struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct ablkcipher_request *req, struct nss_cryptoapi_ablk_info *info) | ||||
| +struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct skcipher_request *req, struct nss_cryptoapi_ablk_info *info) | ||||
|  { | ||||
| -	struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(req); | ||||
| -	struct nss_cryptoapi_ctx *ctx = crypto_ablkcipher_ctx(cipher); | ||||
| +	struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); | ||||
| +	struct nss_cryptoapi_ctx *ctx = crypto_skcipher_ctx(cipher); | ||||
|  	struct nss_crypto_buf *buf; | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	nss_crypto_status_t status; | ||||
| @@ -382,7 +382,7 @@ struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct ablkcipher_request *r | ||||
|  	nss_cfi_assert(ctx); | ||||
|   | ||||
|  	nss_cfi_dbg("src_vaddr: 0x%p, dst_vaddr: 0x%p, iv: 0x%p\n", | ||||
| -			sg_virt(req->src), sg_virt(req->dst), req->info); | ||||
| +			sg_virt(req->src), sg_virt(req->dst), req->iv); | ||||
|   | ||||
|  	info->params->cipher_skip = 0; | ||||
|  	info->params->auth_skip = 0; | ||||
| @@ -419,19 +419,19 @@ struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct ablkcipher_request *r | ||||
|  	/* | ||||
|  	 * Get IV location and memcpy the IV | ||||
|  	 */ | ||||
| -	iv_size = crypto_ablkcipher_ivsize(cipher); | ||||
| +	iv_size = crypto_skcipher_ivsize(cipher); | ||||
|  	iv_addr = nss_crypto_get_ivaddr(buf); | ||||
|   | ||||
|  	switch (ctx->cip_alg) { | ||||
|  	case NSS_CRYPTO_CIPHER_AES_CBC: | ||||
|  	case NSS_CRYPTO_CIPHER_DES: | ||||
| -		memcpy(iv_addr, req->info, iv_size); | ||||
| +		memcpy(iv_addr, req->iv, iv_size); | ||||
|  		break; | ||||
|   | ||||
|  	case NSS_CRYPTO_CIPHER_AES_CTR: | ||||
|  		((uint32_t *)iv_addr)[0] = ctx->ctx_iv[0]; | ||||
| -		((uint32_t *)iv_addr)[1] = ((uint32_t *)req->info)[0]; | ||||
| -		((uint32_t *)iv_addr)[2] = ((uint32_t *)req->info)[1]; | ||||
| +		((uint32_t *)iv_addr)[1] = ((uint32_t *)req->iv)[0]; | ||||
| +		((uint32_t *)iv_addr)[2] = ((uint32_t *)req->iv)[1]; | ||||
|  		((uint32_t *)iv_addr)[3] = ctx->ctx_iv[3]; | ||||
|  		break; | ||||
|   | ||||
| @@ -446,7 +446,7 @@ struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct ablkcipher_request *r | ||||
|  	/* | ||||
|  	 * Fill Cipher and Auth len | ||||
|  	 */ | ||||
| -	cipher_len = req->nbytes; | ||||
| +	cipher_len = req->cryptlen; | ||||
|  	auth_len = 0; | ||||
|   | ||||
|  	nss_crypto_set_data(buf, sg_virt(req->src), sg_virt(req->dst), cipher_len); | ||||
| @@ -463,12 +463,12 @@ struct nss_crypto_buf *nss_cryptoapi_ablk_transform(struct ablkcipher_request *r | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| - * nss_cryptoapi_ablkcipher_fallback() | ||||
| - *	Cryptoapi fallback for ablkcipher algorithm. | ||||
| + * nss_cryptoapi_skcipher_fallback() | ||||
| + *	Cryptoapi fallback for skcipher algorithm. | ||||
|   */ | ||||
| -int nss_cryptoapi_ablkcipher_fallback(struct nss_cryptoapi_ctx *ctx, struct ablkcipher_request *req, int type) | ||||
| +int nss_cryptoapi_skcipher_fallback(struct nss_cryptoapi_ctx *ctx, struct skcipher_request *req, int type) | ||||
|  { | ||||
| -	struct crypto_ablkcipher *orig_tfm = crypto_ablkcipher_reqtfm(req); | ||||
| +	struct crypto_skcipher *orig_tfm = crypto_skcipher_reqtfm(req); | ||||
|  	int err; | ||||
|   | ||||
|  	if (!ctx->sw_tfm) { | ||||
| @@ -476,16 +476,16 @@ int nss_cryptoapi_ablkcipher_fallback(struct nss_cryptoapi_ctx *ctx, struct ablk | ||||
|  	} | ||||
|   | ||||
|  	/* Set new fallback tfm to the request */ | ||||
| -	ablkcipher_request_set_tfm(req, __crypto_ablkcipher_cast(ctx->sw_tfm)); | ||||
| +	skcipher_request_set_tfm(req, __crypto_skcipher_cast(ctx->sw_tfm)); | ||||
|   | ||||
|  	ctx->queued++; | ||||
|   | ||||
|  	switch (type) { | ||||
|  	case NSS_CRYPTOAPI_ENCRYPT: | ||||
| -		err = crypto_ablkcipher_encrypt(req); | ||||
| +		err = crypto_skcipher_encrypt(req); | ||||
|  		break; | ||||
|  	case NSS_CRYPTOAPI_DECRYPT: | ||||
| -		err = crypto_ablkcipher_decrypt(req); | ||||
| +		err = crypto_skcipher_decrypt(req); | ||||
|  		break; | ||||
|  	default: | ||||
|  		err = -EINVAL; | ||||
| @@ -495,7 +495,7 @@ int nss_cryptoapi_ablkcipher_fallback(struct nss_cryptoapi_ctx *ctx, struct ablk | ||||
|  		ctx->completed++; | ||||
|   | ||||
|  	/* Set original tfm to the request */ | ||||
| -	ablkcipher_request_set_tfm(req, orig_tfm); | ||||
| +	skcipher_request_set_tfm(req, orig_tfm); | ||||
|   | ||||
|  	return err; | ||||
|  } | ||||
| @@ -504,13 +504,13 @@ int nss_cryptoapi_ablkcipher_fallback(struct nss_cryptoapi_ctx *ctx, struct ablk | ||||
|   * nss_cryptoapi_ablk_aes_encrypt() | ||||
|   * 	Crytoapi encrypt for aes(aes-cbc/rfc3686-aes-ctr) algorithms. | ||||
|   */ | ||||
| -int nss_cryptoapi_ablk_aes_encrypt(struct ablkcipher_request *req) | ||||
| +int nss_cryptoapi_ablk_aes_encrypt(struct skcipher_request *req) | ||||
|  { | ||||
|  	struct nss_crypto_params params = { .req_type = NSS_CRYPTO_REQ_TYPE_ENCRYPT }; | ||||
| -	struct nss_cryptoapi_ablk_info info = {.cb_fn = nss_cryptoapi_ablkcipher_done, | ||||
| +	struct nss_cryptoapi_ablk_info info = {.cb_fn = nss_cryptoapi_skcipher_done, | ||||
|  						.params = ¶ms}; | ||||
| -	struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(req); | ||||
| -	struct nss_cryptoapi_ctx *ctx = crypto_ablkcipher_ctx(cipher); | ||||
| +	struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); | ||||
| +	struct nss_cryptoapi_ctx *ctx = crypto_skcipher_ctx(cipher); | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_crypto_buf *buf; | ||||
|   | ||||
| @@ -520,7 +520,7 @@ int nss_cryptoapi_ablk_aes_encrypt(struct ablkcipher_request *req) | ||||
|  	nss_cryptoapi_verify_magic(ctx); | ||||
|   | ||||
|  	if (ctx->fallback_req) | ||||
| -		return nss_cryptoapi_ablkcipher_fallback(ctx, req, NSS_CRYPTOAPI_ENCRYPT); | ||||
| +		return nss_cryptoapi_skcipher_fallback(ctx, req, NSS_CRYPTOAPI_ENCRYPT); | ||||
|   | ||||
|  	/* | ||||
|  	 * Check if previous call to setkey couldn't allocate session with core crypto. | ||||
| @@ -539,9 +539,9 @@ int nss_cryptoapi_ablk_aes_encrypt(struct ablkcipher_request *req) | ||||
|  	 * According to RFC3686, AES-CTR algo need not be padded if the | ||||
|  	 * plaintext or ciphertext is unaligned to block size boundary. | ||||
|  	 */ | ||||
| -	if (nss_cryptoapi_check_unalign(req->nbytes, AES_BLOCK_SIZE) && (ctx->cip_alg != NSS_CRYPTO_CIPHER_AES_CTR)) { | ||||
| +	if (nss_cryptoapi_check_unalign(req->cryptlen, AES_BLOCK_SIZE) && (ctx->cip_alg != NSS_CRYPTO_CIPHER_AES_CTR)) { | ||||
|  		nss_cfi_err("Invalid cipher len - Not aligned to algo blocksize\n"); | ||||
| -		crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
| +		crypto_skcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
| @@ -571,13 +571,13 @@ int nss_cryptoapi_ablk_aes_encrypt(struct ablkcipher_request *req) | ||||
|   * nss_cryptoapi_ablk_aes_decrypt() | ||||
|   * 	Crytoapi decrypt for aes(aes-cbc/rfc3686-aes-ctr) algorithms. | ||||
|   */ | ||||
| -int nss_cryptoapi_ablk_aes_decrypt(struct ablkcipher_request *req) | ||||
| +int nss_cryptoapi_ablk_aes_decrypt(struct skcipher_request *req) | ||||
|  { | ||||
|  	struct nss_crypto_params params = { .req_type = NSS_CRYPTO_REQ_TYPE_DECRYPT }; | ||||
| -	struct nss_cryptoapi_ablk_info info = {.cb_fn = nss_cryptoapi_ablkcipher_done, | ||||
| +	struct nss_cryptoapi_ablk_info info = {.cb_fn = nss_cryptoapi_skcipher_done, | ||||
|  						.params = ¶ms}; | ||||
| -	struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(req); | ||||
| -	struct nss_cryptoapi_ctx *ctx = crypto_ablkcipher_ctx(cipher); | ||||
| +	struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); | ||||
| +	struct nss_cryptoapi_ctx *ctx = crypto_skcipher_ctx(cipher); | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_crypto_buf *buf; | ||||
|   | ||||
| @@ -587,7 +587,7 @@ int nss_cryptoapi_ablk_aes_decrypt(struct ablkcipher_request *req) | ||||
|  	nss_cryptoapi_verify_magic(ctx); | ||||
|   | ||||
|  	if (ctx->fallback_req) | ||||
| -		return nss_cryptoapi_ablkcipher_fallback(ctx, req, NSS_CRYPTOAPI_DECRYPT); | ||||
| +		return nss_cryptoapi_skcipher_fallback(ctx, req, NSS_CRYPTOAPI_DECRYPT); | ||||
|   | ||||
|  	/* | ||||
|  	 * Check if previous call to setkey couldn't allocate session with core crypto. | ||||
| @@ -606,9 +606,9 @@ int nss_cryptoapi_ablk_aes_decrypt(struct ablkcipher_request *req) | ||||
|  	 * According to RFC3686, AES-CTR algo need not be padded if the | ||||
|  	 * plaintext or ciphertext is unaligned to block size boundary. | ||||
|  	 */ | ||||
| -	if (nss_cryptoapi_check_unalign(req->nbytes, AES_BLOCK_SIZE) && (ctx->cip_alg != NSS_CRYPTO_CIPHER_AES_CTR)) { | ||||
| +	if (nss_cryptoapi_check_unalign(req->cryptlen, AES_BLOCK_SIZE) && (ctx->cip_alg != NSS_CRYPTO_CIPHER_AES_CTR)) { | ||||
|  		nss_cfi_err("Invalid cipher len - Not aligned to algo blocksize\n"); | ||||
| -		crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
| +		crypto_skcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
| @@ -638,9 +638,9 @@ int nss_cryptoapi_ablk_aes_decrypt(struct ablkcipher_request *req) | ||||
|   * nss_cryptoapi_3des_cbc_setkey() | ||||
|   * 	Cryptoapi DES3 CBC setkey function. | ||||
|   */ | ||||
| -int nss_cryptoapi_3des_cbc_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) | ||||
| +int nss_cryptoapi_3des_cbc_setkey(struct crypto_skcipher *cipher, const u8 *key, unsigned int keylen) | ||||
|  { | ||||
| -	struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); | ||||
| +	struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); | ||||
|  	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(tfm); | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_crypto_key cip = { .algo = NSS_CRYPTO_CIPHER_DES }; | ||||
| @@ -693,7 +693,7 @@ int nss_cryptoapi_3des_cbc_setkey(struct crypto_ablkcipher *cipher, const u8 *ke | ||||
|  	return 0; | ||||
|   | ||||
|  fail: | ||||
| -	crypto_ablkcipher_set_flags(cipher, flag); | ||||
| +	crypto_skcipher_set_flags(cipher, flag); | ||||
|  	return -EINVAL; | ||||
|  } | ||||
|   | ||||
| @@ -701,7 +701,7 @@ fail: | ||||
|   * nss_cryptoapi_3des_cbc_encrypt() | ||||
|   * 	Cryptoapi DES3 CBC encrypt function. | ||||
|   */ | ||||
| -int nss_cryptoapi_3des_cbc_encrypt(struct ablkcipher_request *req) | ||||
| +int nss_cryptoapi_3des_cbc_encrypt(struct skcipher_request *req) | ||||
|  { | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm); | ||||
| @@ -727,14 +727,14 @@ int nss_cryptoapi_3des_cbc_encrypt(struct ablkcipher_request *req) | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
| -	if (nss_cryptoapi_check_unalign(req->nbytes, DES3_EDE_BLOCK_SIZE)) { | ||||
| +	if (nss_cryptoapi_check_unalign(req->cryptlen, DES3_EDE_BLOCK_SIZE)) { | ||||
|  		nss_cfi_err("Invalid cipher len - Not aligned to algo blocksize\n"); | ||||
| -		crypto_ablkcipher_set_flags(crypto_ablkcipher_reqtfm(req), CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
| +		crypto_skcipher_set_flags(crypto_skcipher_reqtfm(req), CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
|  	info.params = ¶ms; | ||||
| -	info.cb_fn = nss_cryptoapi_ablkcipher_done; | ||||
| +	info.cb_fn = nss_cryptoapi_skcipher_done; | ||||
|   | ||||
|  	buf = nss_cryptoapi_ablk_transform(req, &info); | ||||
|  	if (!buf) { | ||||
| @@ -762,7 +762,7 @@ int nss_cryptoapi_3des_cbc_encrypt(struct ablkcipher_request *req) | ||||
|   * nss_cryptoapi_3des_cbc_decrypt() | ||||
|   * 	Cryptoapi DES3 CBC decrypt function. | ||||
|   */ | ||||
| -int nss_cryptoapi_3des_cbc_decrypt(struct ablkcipher_request *req) | ||||
| +int nss_cryptoapi_3des_cbc_decrypt(struct skcipher_request *req) | ||||
|  { | ||||
|  	struct nss_cryptoapi *sc = &gbl_ctx; | ||||
|  	struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm); | ||||
| @@ -788,14 +788,14 @@ int nss_cryptoapi_3des_cbc_decrypt(struct ablkcipher_request *req) | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
| -	if (nss_cryptoapi_check_unalign(req->nbytes, DES3_EDE_BLOCK_SIZE)) { | ||||
| +	if (nss_cryptoapi_check_unalign(req->cryptlen, DES3_EDE_BLOCK_SIZE)) { | ||||
|  		nss_cfi_err("Invalid cipher len - Not aligned to algo blocksize\n"); | ||||
| -		crypto_ablkcipher_set_flags(crypto_ablkcipher_reqtfm(req), CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
| +		crypto_skcipher_set_flags(crypto_skcipher_reqtfm(req), CRYPTO_TFM_RES_BAD_BLOCK_LEN); | ||||
|  		return -EINVAL; | ||||
|  	} | ||||
|   | ||||
|  	info.params = ¶ms; | ||||
| -	info.cb_fn = nss_cryptoapi_ablkcipher_done; | ||||
| +	info.cb_fn = nss_cryptoapi_skcipher_done; | ||||
|   | ||||
|  	buf = nss_cryptoapi_ablk_transform(req, &info); | ||||
|  	if (!buf) { | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi_debugfs.c b/cryptoapi/v1.1/nss_cryptoapi_debugfs.c | ||||
| index dff774c..cf4bc70 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi_debugfs.c | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi_debugfs.c | ||||
| @@ -55,6 +55,7 @@ | ||||
|   */ | ||||
|  void nss_cryptoapi_debugfs_add_stats(struct dentry *parent, struct nss_cryptoapi_ctx *session_ctx) | ||||
|  { | ||||
| +	pr_info("add stats"); | ||||
|  	debugfs_create_u64("queued", S_IRUGO, parent, &session_ctx->queued); | ||||
|  	debugfs_create_u64("completed", S_IRUGO, parent, &session_ctx->completed); | ||||
|  	debugfs_create_u64("queue_failed", S_IRUGO, parent, &session_ctx->queue_failed); | ||||
| diff --git a/cryptoapi/v1.1/nss_cryptoapi_private.h b/cryptoapi/v1.1/nss_cryptoapi_private.h | ||||
| index 5feb9e3..70c6714 100644 | ||||
| --- a/cryptoapi/v1.1/nss_cryptoapi_private.h | ||||
| +++ b/cryptoapi/v1.1/nss_cryptoapi_private.h | ||||
| @@ -141,16 +141,16 @@ int nss_cryptoapi_sha256_3des_encrypt(struct aead_request *req); | ||||
|  int nss_cryptoapi_sha256_3des_decrypt(struct aead_request *req); | ||||
|   | ||||
|  /* ABLKCIPHER */ | ||||
| -int nss_cryptoapi_ablkcipher_init(struct crypto_tfm *tfm); | ||||
| -void nss_cryptoapi_ablkcipher_exit(struct crypto_tfm *tfm); | ||||
| -int nss_cryptoapi_ablk_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int len); | ||||
| -int nss_cryptoapi_3des_cbc_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int len); | ||||
| +int nss_cryptoapi_skcipher_init(struct crypto_skcipher *tfm); | ||||
| +void nss_cryptoapi_skcipher_exit(struct crypto_skcipher *tfm); | ||||
| +int nss_cryptoapi_ablk_aes_setkey(struct crypto_skcipher *cipher, const u8 *key, unsigned int len); | ||||
| +int nss_cryptoapi_3des_cbc_setkey(struct crypto_skcipher *cipher, const u8 *key, unsigned int len); | ||||
|   | ||||
| -int nss_cryptoapi_ablk_aes_encrypt(struct ablkcipher_request *req); | ||||
| -int nss_cryptoapi_ablk_aes_decrypt(struct ablkcipher_request *req); | ||||
| +int nss_cryptoapi_ablk_aes_encrypt(struct skcipher_request *req); | ||||
| +int nss_cryptoapi_ablk_aes_decrypt(struct skcipher_request *req); | ||||
|   | ||||
| -int nss_cryptoapi_3des_cbc_encrypt(struct ablkcipher_request *req); | ||||
| -int nss_cryptoapi_3des_cbc_decrypt(struct ablkcipher_request *req); | ||||
| +int nss_cryptoapi_3des_cbc_encrypt(struct skcipher_request *req); | ||||
| +int nss_cryptoapi_3des_cbc_decrypt(struct skcipher_request *req); | ||||
|   | ||||
|  #endif /* __NSS_CRYPTOAPI_PRIVATE_H */ | ||||
|   | ||||
| --  | ||||
| 2.27.0.rc0 | ||||
|  | ||||
							
								
								
									
										468
									
								
								package/qca/qca-nss-clients/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										468
									
								
								package/qca/qca-nss-clients/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,468 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-clients | ||||
| PKG_RELEASE:=2 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-clients | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=740d0102c518cd49f30c5580982b218b480006b1 | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| # Keep default as ipq806x for branches that does not have subtarget framework | ||||
| ifeq ($(CONFIG_TARGET_ipq),y) | ||||
| subtarget:=$(SUBTARGET) | ||||
| else | ||||
| subtarget:=$(CONFIG_TARGET_BOARD) | ||||
| endif | ||||
|  | ||||
| ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64")) | ||||
| # DTLS Manager v2.0 for Hawkeye/Cypress | ||||
|   DTLSMGR_DIR:=v2.0 | ||||
| # IPsec Manager v2.0 for Hawkeye/Cypress | ||||
|   IPSECMGR_DIR:=v2.0 | ||||
| # KLIPS plugin | ||||
|   IPSECMGR_KLIPS:= $(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko | ||||
| else | ||||
| # DTLS Manager v1.0 for Akronite. | ||||
|   DTLSMGR_DIR:=v1.0 | ||||
| # IPsec Manager v1.0 for Akronite. | ||||
|   IPSECMGR_DIR:=v1.0 | ||||
| # KLIPS plugin not needed | ||||
|   IPSECMGR_KLIPS:= | ||||
| endif | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-tun6rd | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - tun6rd | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-sit +6rd @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/qca-nss-tun6rd.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,60,qca-nss-tun6rd) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-tun6rd/Description | ||||
| Kernel modules for NSS connection manager - Support for 6rd tunnel | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-dtlsmgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - dtlsmgr | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/dtls/$(DTLSMGR_DIR)/qca-nss-dtlsmgr.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-dtls/Description | ||||
| Kernel modules for NSS connection manager - Support for DTLS sessions | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-l2tpv2 | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - l2tp | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-ppp +kmod-l2tp @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/l2tp/l2tpv2/qca-nss-l2tpv2.ko | ||||
|   KCONFIG:=CONFIG_L2TP=y | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-l2tpv2) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-l2tp/Description | ||||
| Kernel modules for NSS connection manager - Support for l2tp tunnel | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pptp | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - PPTP | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-pptp @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/pptp/qca-nss-pptp.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-pptp) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pptp/Description | ||||
| Kernel modules for NSS connection manager - Support for PPTP tunnel | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pppoe | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - PPPoE | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-pppoe @!LINUX_3_18 \ | ||||
| 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||
|   FILES:=$(PKG_BUILD_DIR)/pppoe/qca-nss-pppoe.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-pppoe) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pppoe/Description | ||||
| Kernel modules for NSS connection manager - Support for PPPoE | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-map-t | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - MAP-T | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-nat46 @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/map/map-t/qca-nss-map-t.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-map-t) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-map-t/Description | ||||
| Kernel modules for NSS connection manager - Support for MAP-T | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-gre | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - GRE | ||||
|   DEPENDS:=@TARGET_ipq_ipq806x||TARGET_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||
| 	   +kmod-qca-nss-drv @!LINUX_3_18 +kmod-gre6 | ||||
|   FILES:=$(PKG_BUILD_DIR)/gre/qca-nss-gre.ko $(PKG_BUILD_DIR)/gre/test/qca-nss-gre-test.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-gre) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-gre/Description | ||||
| Kernel modules for NSS connection manager - Support for GRE | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-tunipip6 | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (connection manager) - DS-lite and ipip6 Tunnel | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-iptunnel6 +kmod-ip6-tunnel @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/qca-nss-tunipip6.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,60,qca-nss-tunipip6) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-tunipip6/Description | ||||
| Kernel modules for NSS connection manager | ||||
| Add support for DS-lite and ipip6 tunnel | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-profile | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||
|   TITLE:=Profiler for QCA NSS driver (IPQ806x) | ||||
|   FILES:=$(PKG_BUILD_DIR)/profiler/qca-nss-profile-drv.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-profile/Description | ||||
| This package contains a NSS driver profiler for QCA chipset | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ipsecmgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS (ipsec manager) - ipsecmgr | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ | ||||
| 		+kmod-qca-nss-drv +kmod-qca-nss-ecm-standard +kmod-qca-nss-cfi-cryptoapi @!LINUX_3_18 | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),) | ||||
|   DEPENDS+=+kmod-qca-nss-drv-l2tpv2 | ||||
| endif | ||||
|   FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/qca-nss-ipsecmgr.ko	$(IPSECMGR_KLIPS) | ||||
|   AUTOLOAD:=$(call AutoLoad,60,qca-nss-ipsecmgr) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ipsecmgr/Description | ||||
| Kernel module for NSS IPsec offload manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-capwapmgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-dtlsmgr @!LINUX_3_18 | ||||
|   TITLE:=NSS CAPWAP Manager for QCA NSS driver (IPQ806x) | ||||
|   FILES:=$(PKG_BUILD_DIR)/capwapmgr/qca-nss-capwapmgr.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-capwapmgr/Description | ||||
| This package contains a NSS CAPWAP Manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-bridge-mgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS bridge manager | ||||
|   DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ | ||||
| 		+TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 		+TARGET_ipq_ipq807x_64:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 		+TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 		+TARGET_ipq807x_64:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 		+TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 		+TARGET_ipq_ipq60xx_64:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||
| 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||
|   FILES:=$(PKG_BUILD_DIR)/bridge/qca-nss-bridge-mgr.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-bridge-mgr) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-bridge-mgr/Description | ||||
| Kernel modules for NSS bridge manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-vlan-mgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS vlan manager | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq807x +kmod-qca-nss-drv @!LINUX_3_18 \ | ||||
| 		+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding | ||||
|   FILES:=$(PKG_BUILD_DIR)/vlan/qca-nss-vlan.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-vlan) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-vlan-mgr/Description | ||||
| Kernel modules for NSS vlan manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-qdisc | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Support | ||||
|   TITLE:=Qdisc for configuring shapers in NSS | ||||
|   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||
|   FILES:=$(PKG_BUILD_DIR)/nss_qdisc/qca-nss-qdisc.ko | ||||
|   KCONFIG:=CONFIG_NET_CLS_ACT=y | ||||
|   AUTOLOAD:=$(call AutoLoad,58,qca-nss-qdisc) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-qdisc/Description | ||||
| Linux qdisc that aids in configuring shapers in the NSS | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-lag-mgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS LAG manager | ||||
|   DEPENDS:=+kmod-qca-nss-drv  @!LINUX_3_18 \ | ||||
| 	   +TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 	   +TARGET_ipq_ipq807x_64:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||
| 	   +TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \ | ||||
| 	   +TARGET_ipq807x_64:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||
| 	   +TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||
| 	   +TARGET_ipq_ipq60xx_64:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \ | ||||
| 	   +kmod-bonding | ||||
|   FILES:=$(PKG_BUILD_DIR)/lag/qca-nss-lag-mgr.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,51,qca-nss-lag-mgr) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-lag-mgr/Description | ||||
| Kernel modules for NSS LAG manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-netlink | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=@TARGET_ipq807x||TARGET_ipq_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||
| 		+kmod-qca-nss-drv @!LINUX_3_18 \ | ||||
| 		+PACKAGE_kmod-qca-nss-drv-ipsecmgr:kmod-qca-nss-drv-ipsecmgr \ | ||||
| 		+PACKAGE_kmod-qca-nss-drv-dtlsmgr:kmod-qca-nss-drv-dtlsmgr \ | ||||
| 		+PACKAGE_kmod-qca-nss-drv-capwapmgr:kmod-qca-nss-drv-capwapmgr @!LINUX_3_18 | ||||
|   TITLE:=NSS NETLINK Manager for QCA NSS driver | ||||
|   FILES:=$(PKG_BUILD_DIR)/netlink/qca-nss-netlink.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-netlink/Description | ||||
| Kernel module for NSS netlink manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ovpn-mgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for NSS OpenVPN manager | ||||
|   DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi +kmod-tun +kmod-ipt-conntrack @!LINUX_3_18 \ | ||||
| 	  @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 | ||||
|   FILES:=$(PKG_BUILD_DIR)/openvpn/src/qca-nss-ovpn-mgr.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ovpn-mgr/Description | ||||
| Kernel module for NSS OpenVPN manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ovpn-link | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   TITLE:=Kernel driver for interfacing NSS OpenVPN manager with ECM | ||||
|   DEPENDS:=+kmod-qca-nss-drv-ovpn-mgr +@PACKAGE_kmod-qca-nss-ecm-premium @!LINUX_3_18 \ | ||||
| 	  @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 | ||||
|   FILES:=$(PKG_BUILD_DIR)/openvpn/plugins/qca-nss-ovpn-link.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ovpn-link/Description | ||||
| This module registers with ECM and communicates with NSS OpenVPN manager for supporting OpenVPN offload. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pvxlanmgr | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 | ||||
|   TITLE:=NSS PVXLAN Manager for QCA NSS driver | ||||
|   FILES:=$(PKG_BUILD_DIR)/pvxlanmgr/qca-nss-pvxlanmgr.ko | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-pvxlanmgr/Description | ||||
| Kernel module for managing NSS PVxLAN | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev/qca-nss-clients | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-clients | ||||
| 	$(CP) $(PKG_BUILD_DIR)/netlink/include/* $(1)/usr/include/qca-nss-clients/ | ||||
| 	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/ | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	$(call Build/InstallDev/qca-nss-clients,$(1)) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ovpn-mgr/install | ||||
| 	$(INSTALL_DIR) $(1)/etc/init.d | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-ovpn.init $(1)/etc/init.d/qca-nss-ovpn | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv-ipsecmgr/install | ||||
| 	$(INSTALL_DIR) $(1)/etc/init.d | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-ipsec $(1)/etc/init.d/qca-nss-ipsec | ||||
| endef | ||||
|  | ||||
|  | ||||
| EXTRA_CFLAGS+= \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-drv \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-crypto \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-cfi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-gmac \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-ecm \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-ssdk \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-ssdk/fal \ | ||||
| 	-I$(STAGING_DIR)/usr/include/nat46 | ||||
|  | ||||
| # Build individual packages if selected | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-profile),) | ||||
| MAKE_OPTS+=profile=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-capwapmgr),) | ||||
| MAKE_OPTS+=capwapmgr=y | ||||
| EXTRA_CFLAGS += -DNSS_CAPWAPMGR_ONE_NETDEV | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tun6rd),) | ||||
| MAKE_OPTS+=tun6rd=m | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-dtlsmgr),) | ||||
| MAKE_OPTS+=dtlsmgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),) | ||||
| MAKE_OPTS+=l2tpv2=y | ||||
| EXTRA_CFLAGS += -DNSS_L2TPV2_ENABLED | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pptp),) | ||||
| MAKE_OPTS+=pptp=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-map-t),) | ||||
| MAKE_OPTS+=map-t=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tunipip6),) | ||||
| MAKE_OPTS+=tunipip6=m | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-qdisc),) | ||||
| MAKE_OPTS+=qdisc=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr),) | ||||
| EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports \ | ||||
| 		-I$(STAGING_DIR)/usr/include/qca-nss-ecm | ||||
| MAKE_OPTS+=ipsecmgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-bridge-mgr),) | ||||
| MAKE_OPTS+=bridge-mgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vlan-mgr),) | ||||
| MAKE_OPTS+=vlan-mgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-lag-mgr),) | ||||
| MAKE_OPTS+=lag-mgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-gre),) | ||||
| EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports | ||||
| MAKE_OPTS+=gre=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe),) | ||||
| MAKE_OPTS+=pppoe=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-netlink),) | ||||
| MAKE_OPTS+=netlink=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-mgr),) | ||||
| MAKE_OPTS+=ovpn-mgr=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-link),) | ||||
| MAKE_OPTS+=ovpn-link=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pvxlanmgr),) | ||||
| MAKE_OPTS+=pvxlanmgr=y | ||||
| endif | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(MAKE_OPTS)) \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||
| 		SoC="$(subtarget)" \ | ||||
| 		DTLSMGR_DIR="$(DTLSMGR_DIR)" \ | ||||
| 		IPSECMGR_DIR="$(IPSECMGR_DIR)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-drv-profile)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-capwapmgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-tun6rd)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-dtlsmgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-l2tpv2)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-pptp)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-pppoe)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-map-t)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-tunipip6)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-qdisc)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-netlink)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-ipsecmgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-bridge-mgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-vlan-mgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-lag-mgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-gre)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-ovpn-mgr)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-ovpn-link)) | ||||
| $(eval $(call KernelPackage,qca-nss-drv-pvxlanmgr)) | ||||
							
								
								
									
										92
									
								
								package/qca/qca-nss-clients/files/qca-nss-ipsec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								package/qca/qca-nss-clients/files/qca-nss-ipsec
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | ||||
| #!/bin/sh  /etc/rc.common | ||||
| # | ||||
| # Copyright (c) 2018-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. | ||||
|  | ||||
| NSS_IPSEC_LOG_FILE=/tmp/.nss_ipsec_log | ||||
| NSS_IPSEC_LOG_STR_ECM="ECM_Loaded" | ||||
|  | ||||
| ecm_load () { | ||||
| 	if [ ! -d /sys/module/ecm ]; then | ||||
| 		/etc/init.d/qca-nss-ecm start | ||||
| 		if [ -d /sys/module/ecm ]; then | ||||
| 			echo ${NSS_IPSEC_LOG_STR_ECM} >> ${NSS_IPSEC_LOG_FILE} | ||||
| 		fi | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| ecm_unload () { | ||||
| 	if [ -f /tmp/.nss_ipsec_log ]; then | ||||
| 		str=`grep ${NSS_IPSEC_LOG_STR_ECM} ${NSS_IPSEC_LOG_FILE}` | ||||
| 		if [[ $str == ${NSS_IPSEC_LOG_STR_ECM} ]]; then | ||||
| 			/etc/init.d/qca-nss-ecm stop | ||||
| 			`sed 's/${NSS_IPSEC_LOG_STR_ECM}/ /g' $NSS_IPSEC_LOG_FILE >  $NSS_IPSEC_LOG_FILE` | ||||
| 		fi | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| ecm_disable() { | ||||
|  | ||||
| 	if [ ! -d /sys/module/ecm ]; then | ||||
| 		return; | ||||
| 	fi | ||||
|  | ||||
| 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||
| 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||
| 	echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| 	sleep 2 | ||||
| } | ||||
|  | ||||
| ecm_enable() { | ||||
| 	if [ ! -d /sys/module/ecm ]; then | ||||
| 		return; | ||||
| 	fi | ||||
|  | ||||
| 	echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||
| 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||
| } | ||||
|  | ||||
| start() { | ||||
| 	ecm_load | ||||
|  | ||||
| 	local kernel_version=$(uname -r) | ||||
|  | ||||
| 	insmod /lib/modules/${kernel_version}/qca-nss-ipsec-klips.ko | ||||
| 	if [ "$?" -gt 0 ]; then | ||||
| 		echo "Failed to load plugin. Please start ecm if not done already" | ||||
| 		ecm_enable | ||||
| 		return | ||||
| 	fi | ||||
|  | ||||
| 	/etc/init.d/ipsec start | ||||
| 	sleep 2 | ||||
| 	ipsec eroute | ||||
|  | ||||
| 	ecm_enable | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| 	ecm_disable | ||||
|  | ||||
| 	/etc/init.d/ipsec stop | ||||
| 	rmmod qca-nss-ipsec-klips | ||||
|  | ||||
| 	ecm_unload | ||||
| } | ||||
|  | ||||
| restart() { | ||||
| 	stop | ||||
| 	start | ||||
| } | ||||
							
								
								
									
										28
									
								
								package/qca/qca-nss-clients/files/qca-nss-mirred.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								package/qca/qca-nss-clients/files/qca-nss-mirred.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/bin/sh /etc/rc.common | ||||
|  | ||||
| ########################################################################### | ||||
| # 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. | ||||
| ########################################################################### | ||||
|  | ||||
| restart() { | ||||
| 	rmmod act_nssmirred.ko | ||||
| 	insmod act_nssmirred.ko | ||||
| } | ||||
|  | ||||
| start() { | ||||
| 	insmod act_nssmirred.ko | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| 	rmmod act_nssmirred.ko | ||||
| } | ||||
							
								
								
									
										69
									
								
								package/qca/qca-nss-clients/files/qca-nss-ovpn.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								package/qca/qca-nss-clients/files/qca-nss-ovpn.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| #!/bin/sh /etc/rc.common | ||||
|  | ||||
| ########################################################################### | ||||
| # 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. | ||||
| ########################################################################### | ||||
|  | ||||
| ecm_disable() { | ||||
| 	if [ ! -d /sys/module/ecm ]; then | ||||
| 	   return | ||||
| 	fi | ||||
|  | ||||
| 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||
| 	echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||
| 	echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| 	sleep 2 | ||||
| } | ||||
|  | ||||
| ecm_enable() { | ||||
| 	if [ ! -d /sys/module/ecm ]; then | ||||
| 	   return | ||||
| 	fi | ||||
|  | ||||
| 	echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||
| 	echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||
| } | ||||
|  | ||||
| restart() { | ||||
| 	ecm_disable | ||||
|  | ||||
| 	/etc/init.d/openvpn stop | ||||
| 	rmmod qca-nss-ovpn-link | ||||
| 	rmmod qca-nss-ovpn-mgr | ||||
|  | ||||
| 	insmod qca-nss-ovpn-mgr | ||||
| 	insmod qca-nss-ovpn-link | ||||
|  | ||||
| 	if [ "$?" -gt 0 ]; then | ||||
| 		echo "Failed to load plugin. Please start ecm if not done already" | ||||
| 		ecm_enable | ||||
| 		return | ||||
| 	fi | ||||
|  | ||||
| 	ecm_enable | ||||
| } | ||||
|  | ||||
| start() { | ||||
| 	restart | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| 	ecm_disable | ||||
|  | ||||
| 	/etc/init.d/openvpn stop | ||||
| 	rmmod qca-nss-ovpn-link | ||||
| 	rmmod qca-nss-ovpn-mgr | ||||
|  | ||||
| 	ecm_enable | ||||
| } | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,106 @@ | ||||
| From 7c89187ab2d165ccffed627742e7cb72cce375ef Mon Sep 17 00:00:00 2001 | ||||
| From: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| Date: Sun, 12 Jul 2020 22:49:30 +0200 | ||||
| Subject: [PATCH] kernel-5.4-support-gre | ||||
|  | ||||
| --- | ||||
|  gre/nss_connmgr_gre.c    | 16 +++++++--------- | ||||
|  gre/nss_connmgr_gre_v6.c |  4 ++-- | ||||
|  2 files changed, 9 insertions(+), 11 deletions(-) | ||||
|  | ||||
| diff --git a/gre/nss_connmgr_gre.c b/gre/nss_connmgr_gre.c | ||||
| index 52203b1..6de8f6e 100644 | ||||
| --- a/gre/nss_connmgr_gre.c | ||||
| +++ b/gre/nss_connmgr_gre.c | ||||
| @@ -88,7 +88,7 @@ static int nss_connmgr_gre_dev_init(struct net_device *dev) | ||||
|  		u64_stats_init(&stats->syncp); | ||||
|  	} | ||||
|   | ||||
| -	if ((dev->priv_flags & IFF_GRE_V4_TAP) || (dev->type == ARPHRD_IPGRE)) { | ||||
| +	if ((dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V4_TAP) || (dev->type == ARPHRD_IPGRE)) { | ||||
|  		dev->needed_headroom = sizeof(struct iphdr) + sizeof(struct ethhdr) + MAX_WIFI_HEADROOM + append; | ||||
|  		dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - append; | ||||
|  		dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA; | ||||
| @@ -169,7 +169,7 @@ fail: | ||||
|   * nss_connmgr_gre_dev_stats64() | ||||
|   *	Netdev ops function to retrieve stats. | ||||
|   */ | ||||
| -struct rtnl_link_stats64 *nss_connmgr_gre_dev_stats64(struct net_device *dev, | ||||
| +void nss_connmgr_gre_dev_stats64(struct net_device *dev, | ||||
|  						struct rtnl_link_stats64 *tot) | ||||
|  { | ||||
|  	uint64_t rx_packets, rx_bytes, tx_packets, tx_bytes; | ||||
| @@ -202,8 +202,6 @@ struct rtnl_link_stats64 *nss_connmgr_gre_dev_stats64(struct net_device *dev, | ||||
|  		tot->rx_dropped = dev->stats.rx_dropped; | ||||
|  		tot->tx_dropped = dev->stats.tx_dropped; | ||||
|  	} | ||||
| - | ||||
| -	return tot; | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| @@ -390,7 +388,7 @@ static int32_t nss_connmgr_gre_prepare_config_cmd(struct net_device *dev, | ||||
|  { | ||||
|  	struct nss_gre_config_msg *cmsg = &req->msg.cmsg; | ||||
|   | ||||
| -	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags & IFF_GRE_V4_TAP)) { | ||||
| +	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V4_TAP)) { | ||||
|  		cmsg->mode = NSS_GRE_MODE_TAP; | ||||
|  		cmsg->ip_type = NSS_GRE_IP_IPV4; | ||||
|  		if (enable_unalign) { | ||||
| @@ -399,7 +397,7 @@ static int32_t nss_connmgr_gre_prepare_config_cmd(struct net_device *dev, | ||||
|  		return nss_connmgr_gre_v4_get_config(dev, req, next_dev, hold); | ||||
|  	} | ||||
|   | ||||
| -	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags & IFF_GRE_V6_TAP)) { | ||||
| +	if ((dev->type == ARPHRD_ETHER) && (dev->priv_flags_qca_ecm & IFF_QCA_ECM_GRE_V6_TAP)) { | ||||
|  		cmsg->mode = NSS_GRE_MODE_TAP; | ||||
|  		cmsg->ip_type = NSS_GRE_IP_IPV6; | ||||
|  		if (enable_unalign) { | ||||
| @@ -605,7 +603,7 @@ static bool nss_connmgr_gre_is_gre(struct net_device *dev) | ||||
|  { | ||||
|  	if ((dev->type == ARPHRD_IPGRE) || | ||||
|  	      (dev->type == ARPHRD_IP6GRE) || ((dev->type == ARPHRD_ETHER) && | ||||
| -	      (dev->priv_flags & (IFF_GRE_V4_TAP | IFF_GRE_V6_TAP)))) { | ||||
| +	      (dev->priv_flags_qca_ecm & (IFF_QCA_ECM_GRE_V4_TAP | IFF_QCA_ECM_GRE_V6_TAP)))) { | ||||
|  		return true; | ||||
|  	} | ||||
|   | ||||
| @@ -692,10 +690,10 @@ static struct net_device *__nss_connmgr_gre_create_interface(struct nss_connmgr_ | ||||
|  		nss_connmgr_gre_tap_setup(dev); | ||||
|   | ||||
|  		if (cfg->is_ipv6) { | ||||
| -			dev->priv_flags |= IFF_GRE_V6_TAP; | ||||
| +			dev->priv_flags_qca_ecm |= IFF_QCA_ECM_GRE_V6_TAP; | ||||
|  			ret = nss_connmgr_gre_v6_set_config(dev, cfg); | ||||
|  		} else { | ||||
| -			dev->priv_flags |= IFF_GRE_V4_TAP; | ||||
| +			dev->priv_flags_qca_ecm |= IFF_QCA_ECM_GRE_V4_TAP; | ||||
|  			ret = nss_connmgr_gre_v4_set_config(dev, cfg); | ||||
|  		} | ||||
|  		break; | ||||
| diff --git a/gre/nss_connmgr_gre_v6.c b/gre/nss_connmgr_gre_v6.c | ||||
| index f9a8e58..e93c7e4 100644 | ||||
| --- a/gre/nss_connmgr_gre_v6.c | ||||
| +++ b/gre/nss_connmgr_gre_v6.c | ||||
| @@ -46,7 +46,7 @@ static struct net_device *nss_connmgr_gre_v6_get_tx_dev(uint8_t *dest_ip) | ||||
|  	struct net_device *dev; | ||||
|   | ||||
|  	memcpy(ipv6_addr.s6_addr, dest_ip, 16); | ||||
| -	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, 0); | ||||
| +	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, NULL, 0); | ||||
|  	if (!rt) { | ||||
|  		return NULL; | ||||
|  	} | ||||
| @@ -92,7 +92,7 @@ static int nss_connmgr_gre_v6_get_mac_address(uint8_t *src_ip, uint8_t *dest_ip, | ||||
|  	 * Find dest MAC address | ||||
|  	 */ | ||||
|  	memcpy(ipv6_addr.s6_addr, dest_ip, 16); | ||||
| -	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, 0); | ||||
| +	rt = rt6_lookup(&init_net, &ipv6_addr, NULL, 0, NULL, 0); | ||||
|  	if (!rt) { | ||||
|  		return GRE_ERR_NEIGH_LOOKUP; | ||||
|  	} | ||||
| --  | ||||
| 2.27.0 | ||||
|  | ||||
| @@ -0,0 +1,29 @@ | ||||
| --- a/ipsecmgr/v1.0/nss_ipsecmgr.c | ||||
| +++ b/ipsecmgr/v1.0/nss_ipsecmgr.c | ||||
| @@ -377,7 +377,7 @@ free: | ||||
|   * nss_ipsecmgr_tunnel_stats() | ||||
|   * 	get tunnel statistics | ||||
|   */ | ||||
| -static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) | ||||
| +void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) | ||||
|  { | ||||
|  	struct nss_ipsecmgr_priv *priv = netdev_priv(dev); | ||||
|   | ||||
| @@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips | ||||
|  	read_lock_bh(&ipsecmgr_ctx->lock); | ||||
|  	memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64)); | ||||
|  	read_unlock_bh(&ipsecmgr_ctx->lock); | ||||
| - | ||||
| -	return stats; | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| @@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st | ||||
|  	dev->header_ops = NULL; | ||||
|  	dev->netdev_ops = &nss_ipsecmgr_tunnel_ops; | ||||
|   | ||||
| -	dev->destructor = nss_ipsecmgr_tunnel_free; | ||||
| +	dev->priv_destructor = nss_ipsecmgr_tunnel_free; | ||||
|   | ||||
|  	/* | ||||
|  	 * get the MAC address from the ethernet device | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/dtls/v1.0/nss_connmgr_dtls_netdev.c | ||||
| +++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c | ||||
| @@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct | ||||
|  	dev->ethtool_ops = NULL; | ||||
|  	dev->header_ops = NULL; | ||||
|  	dev->netdev_ops = &nss_dtlsmgr_session_ops; | ||||
| -	dev->destructor = NULL; | ||||
| +	dev->priv_destructor = NULL; | ||||
|   | ||||
|  	memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len); | ||||
|  	memset(dev->broadcast, 0xff, dev->addr_len); | ||||
| @@ -0,0 +1,64 @@ | ||||
| --- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.h | ||||
| +++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.h | ||||
| @@ -30,10 +30,10 @@ | ||||
|   | ||||
|  #define L2TP_V_2 2 | ||||
|   | ||||
| -#define tunnel_hold(tunnel) atomic_inc(&tunnel->ref_count) | ||||
| -#define tunnel_put(tunnel)  atomic_dec(&tunnel->ref_count) | ||||
| -#define session_hold(session) atomic_inc(&session->ref_count) | ||||
| -#define session_put(session)  atomic_dec(&session->ref_count) | ||||
| +#define tunnel_hold(tunnel) refcount_inc(&tunnel->ref_count) | ||||
| +#define tunnel_put(tunnel)  refcount_dec(&tunnel->ref_count) | ||||
| +#define session_hold(session) refcount_inc(&session->ref_count) | ||||
| +#define session_put(session)  refcount_dec(&session->ref_count) | ||||
|   | ||||
|   /* | ||||
|    *		---------------------------------------------------------------------------------- | ||||
| --- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c | ||||
| +++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c | ||||
| @@ -244,7 +244,7 @@ static struct nss_connmgr_l2tpv2_session | ||||
|  	 */ | ||||
|  	data->l2tpv2.session.session_id = session->session_id; | ||||
|  	data->l2tpv2.session.peer_session_id = session->peer_session_id; | ||||
| -	data->l2tpv2.session.offset = session->offset; | ||||
| +	data->l2tpv2.session.offset = 0; | ||||
|  	data->l2tpv2.session.hdr_len = session->hdr_len; | ||||
|  	data->l2tpv2.session.reorder_timeout = session->reorder_timeout; | ||||
|  	data->l2tpv2.session.recv_seq = session->recv_seq; | ||||
| @@ -253,7 +253,7 @@ static struct nss_connmgr_l2tpv2_session | ||||
|  	nss_connmgr_l2tpv2_info("sess %u, peer=%u nr=%u ns=%u off=%u  hdr_len=%u timeout=%x" | ||||
|  	       " recv_seq=%x send_seq=%x\n", | ||||
|  	       session->session_id,  session->peer_session_id, session->nr, | ||||
| -	       session->ns,  session->offset, session->hdr_len, | ||||
| +	       session->ns, 0, session->hdr_len, | ||||
|  	       session->reorder_timeout, session->recv_seq, | ||||
|  	       session->send_seq); | ||||
|   | ||||
| --- a/l2tp/l2tpv2/nss_l2tpv2_stats.c | ||||
| +++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c | ||||
| @@ -21,6 +21,7 @@ | ||||
|   */ | ||||
|   | ||||
|  #include <linux/types.h> | ||||
| +#include <linux/netdevice.h> | ||||
|  #include <linux/ppp_channel.h> | ||||
|  #include <nss_api_if.h> | ||||
|  #include <nss_dynamic_interface.h> | ||||
| @@ -103,14 +104,14 @@ void nss_l2tpv2_update_dev_stats(struct | ||||
|  	/* | ||||
|  	 * Update tunnel & session stats | ||||
|  	 */ | ||||
| -	tunnel = l2tp_tunnel_find(dev_net(dev), data.l2tpv2.tunnel.tunnel_id); | ||||
| +	tunnel = l2tp_tunnel_get(dev_net(dev), data.l2tpv2.tunnel.tunnel_id); | ||||
|  	if (!tunnel) { | ||||
|  		dev_put(dev); | ||||
|  		return; | ||||
|  	} | ||||
|  	tunnel_hold(tunnel); | ||||
|   | ||||
| -	session = l2tp_session_find(dev_net(dev), tunnel, data.l2tpv2.session.session_id); | ||||
| +	session = l2tp_session_get(dev_net(dev), data.l2tpv2.session.session_id); | ||||
|  	if (!session) { | ||||
|  		tunnel_put(tunnel); | ||||
|  		dev_put(dev); | ||||
| @@ -0,0 +1,14 @@ | ||||
| --- a/nss_qdisc/nss_qdisc.c | ||||
| +++ b/nss_qdisc/nss_qdisc.c | ||||
| @@ -2708,9 +2708,11 @@ static int nss_qdisc_if_event_cb(struct | ||||
|  	case NETDEV_BR_JOIN: | ||||
|  		nss_qdisc_info("Reveived NETDEV_BR_JOIN on interface %s\n", | ||||
|  				dev->name); | ||||
| +		goto fall_through; | ||||
|  	case NETDEV_BR_LEAVE: | ||||
|  		nss_qdisc_info("Reveived NETDEV_BR_LEAVE on interface %s\n", | ||||
|  				dev->name); | ||||
| +fall_through: | ||||
|  		br = nss_qdisc_get_dev_master(dev); | ||||
|  		if_num = nss_cmn_get_interface_number(nss_qdisc_ctx, dev); | ||||
|   | ||||
| @@ -0,0 +1,48 @@ | ||||
| --- a/vlan/nss_vlan_mgr.c | ||||
| +++ b/vlan/nss_vlan_mgr.c | ||||
| @@ -820,8 +820,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr | ||||
|   */ | ||||
|  static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v) | ||||
|  { | ||||
| +#ifdef NSS_VLAN_MGR_PPE_SUPPORT | ||||
|  	int32_t i; | ||||
|  	int ret = 0; | ||||
| +#endif | ||||
|   | ||||
|  	spin_lock(&vlan_mgr_ctx.lock); | ||||
|  	BUG_ON(--v->refs); | ||||
| @@ -979,8 +981,11 @@ static int nss_vlan_mgr_register_event(s | ||||
|  	int ret; | ||||
|  #endif | ||||
|  	uint32_t vlan_tag; | ||||
| +#ifdef NSS_VLAN_MGR_PPE_SUPPORT | ||||
|  	struct net_device *slave; | ||||
| -	int32_t port, port_if; | ||||
| +	int32_t port; | ||||
| +#endif | ||||
| +	int32_t port_if; | ||||
|  	struct vlan_dev_priv *vlan; | ||||
|  	struct net_device *real_dev; | ||||
|  	bool is_bond_master = false; | ||||
| @@ -1354,8 +1359,10 @@ return_with_error: | ||||
|  int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi) | ||||
|  { | ||||
|  	struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); | ||||
| +#ifdef NSS_VLAN_MGR_PPE_SUPPORT | ||||
|  	struct net_device *real_dev; | ||||
|  	int ret; | ||||
| +#endif | ||||
|   | ||||
|  	if (!v) | ||||
|  		return 0; | ||||
| @@ -1415,8 +1422,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge); | ||||
|  int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi) | ||||
|  { | ||||
|  	struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev); | ||||
| +#ifdef NSS_VLAN_MGR_PPE_SUPPORT | ||||
|  	struct net_device *real_dev; | ||||
|  	int ret; | ||||
| +#endif | ||||
|   | ||||
|  	if (!v) | ||||
|  		return 0; | ||||
							
								
								
									
										74
									
								
								package/qca/qca-nss-crypto/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								package/qca/qca-nss-crypto/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-crypto | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-crypto | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=e7651c2986d30b5e8ca5ad6b9a72c47febdf3cca | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| ifeq ($(CONFIG_TARGET_ipq),y) | ||||
| subtarget:=$(SUBTARGET) | ||||
| else | ||||
| subtarget:=$(CONFIG_TARGET_BOARD) | ||||
| endif | ||||
|  | ||||
| # v1.0 is for Akronite | ||||
| # v2.0 is for Hawkeye/Cypress/Maple | ||||
| ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64")) | ||||
| NSS_CRYPTO_DIR:=v2.0 | ||||
| else | ||||
| NSS_CRYPTO_DIR:=v1.0 | ||||
| endif | ||||
|  | ||||
| define KernelPackage/qca-nss-crypto/Default | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64 \ | ||||
| 		+kmod-qca-nss-drv @!LINUX_3_18 | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-crypto | ||||
|   $(call KernelPackage/qca-nss-crypto/Default) | ||||
|   TITLE:=Kernel driver for NSS crypto driver | ||||
|   FILES:=$(PKG_BUILD_DIR)/$(NSS_CRYPTO_DIR)/src/qca-nss-crypto.ko \ | ||||
| 	$(PKG_BUILD_DIR)/$(NSS_CRYPTO_DIR)/tool/qca-nss-crypto-tool.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,52,qca-nss-crypto) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-crypto/Description | ||||
| This package contains a NSS crypto driver for QCA chipset | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev/qca-nss-crypto | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-crypto | ||||
| 	$(CP) $(PKG_BUILD_DIR)/$(NSS_CRYPTO_DIR)/include/* $(1)/usr/include/qca-nss-crypto | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	$(call Build/InstallDev/qca-nss-crypto,$(1)) | ||||
| endef | ||||
|  | ||||
| EXTRA_CFLAGS+= \ | ||||
| 	-DCONFIG_NSS_DEBUG_LEVEL=4 \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-crypto \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-drv \ | ||||
| 	-I$(PKG_BUILD_DIR)/$(NSS_CRYPTO_DIR)/include \ | ||||
| 	-I$(PKG_BUILD_DIR)/$(NSS_CRYPTO_DIR)/src | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||
| 		NSS_CRYPTO_DIR=$(NSS_CRYPTO_DIR) \ | ||||
| 		SoC="$(subtarget)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-crypto)) | ||||
| @@ -0,0 +1,42 @@ | ||||
| --- a/v1.0/tool/nss_crypto_bench.c | ||||
| +++ b/v1.0/tool/nss_crypto_bench.c | ||||
| @@ -75,8 +75,8 @@ static DECLARE_WAIT_QUEUE_HEAD(tx_comp); | ||||
|  static DECLARE_WAIT_QUEUE_HEAD(tx_start); | ||||
|  static struct task_struct *tx_thread = NULL; | ||||
|   | ||||
| -static struct timeval init_time; | ||||
| -static struct timeval comp_time; | ||||
| +static struct timespec64 init_time; | ||||
| +static struct timespec64 comp_time; | ||||
|  static spinlock_t op_lock; | ||||
|  static nss_crypto_handle_t crypto_hdl; | ||||
|   | ||||
| @@ -782,7 +782,7 @@ static int crypto_bench_tx(void *arg) | ||||
|  		crypto_bench_debug("#"); | ||||
|   | ||||
|  		/* get start time */ | ||||
| -		do_gettimeofday(&init_time); | ||||
| +		ktime_get_real_ts64(&init_time); | ||||
|   | ||||
|  		/** | ||||
|  		 * Request submission | ||||
| @@ -812,8 +812,8 @@ static int crypto_bench_tx(void *arg) | ||||
|  		 * Calculate time and output the Mbps | ||||
|  		 */ | ||||
|   | ||||
| -		init_usecs  = (init_time.tv_sec * 1000 * 1000) + init_time.tv_usec; | ||||
| -		comp_usecs  = (comp_time.tv_sec * 1000 * 1000) + comp_time.tv_usec; | ||||
| +		init_usecs  = (init_time.tv_sec * 1000 * 1000) + (init_time.tv_nsec / NSEC_PER_USEC); | ||||
| +		comp_usecs  = (comp_time.tv_sec * 1000 * 1000) + (comp_time.tv_nsec / NSEC_PER_USEC); | ||||
|  		delta_usecs = comp_usecs - init_usecs; | ||||
|   | ||||
|  		reqs_completed = param.num_reqs - atomic_read(&tx_reqs); | ||||
| @@ -870,7 +870,7 @@ static void crypto_bench_done(struct nss | ||||
|  	nss_crypto_buf_free(crypto_hdl, buf); | ||||
|   | ||||
|  	if (atomic_dec_and_test(&tx_reqs)) { | ||||
| -		do_gettimeofday(&comp_time); | ||||
| +		ktime_get_real_ts64(&comp_time); | ||||
|   | ||||
|  		wake_up_interruptible(&tx_comp); | ||||
|  		param.num_loops--; | ||||
| @@ -0,0 +1,54 @@ | ||||
| --- a/v1.0/src/nss_crypto_dtsi.c | ||||
| +++ b/v1.0/src/nss_crypto_dtsi.c | ||||
| @@ -310,11 +310,11 @@ static int nss_crypto_probe(struct platf | ||||
|  	e_ctrl->dev = &pdev->dev; | ||||
|   | ||||
|  	e_ctrl->cmd_base = crypto_res.start; | ||||
| -	e_ctrl->crypto_base = ioremap_nocache(e_ctrl->cmd_base, resource_size(&crypto_res)); | ||||
| +	e_ctrl->crypto_base = ioremap(e_ctrl->cmd_base, resource_size(&crypto_res)); | ||||
|  	nss_crypto_assert(e_ctrl->crypto_base); | ||||
|   | ||||
|  	e_ctrl->bam_pbase = bam_res.start; | ||||
| -	e_ctrl->bam_base = ioremap_nocache(e_ctrl->bam_pbase, resource_size(&bam_res)); | ||||
| +	e_ctrl->bam_base = ioremap(e_ctrl->bam_pbase, resource_size(&bam_res)); | ||||
|  	nss_crypto_assert(e_ctrl->bam_base); | ||||
|   | ||||
|  	e_ctrl->bam_ee = bam_ee; | ||||
| --- a/v1.0/src/nss_crypto_platform.c | ||||
| +++ b/v1.0/src/nss_crypto_platform.c | ||||
| @@ -134,11 +134,11 @@ static int nss_crypto_probe(struct platf | ||||
|  	e_ctrl->bam_ee = res->bam_ee; | ||||
|   | ||||
|  	e_ctrl->cmd_base = res->crypto_pbase; | ||||
| -	e_ctrl->crypto_base = ioremap_nocache(res->crypto_pbase, res->crypto_pbase_sz); | ||||
| +	e_ctrl->crypto_base = ioremap(res->crypto_pbase, res->crypto_pbase_sz); | ||||
|  	nss_crypto_assert(e_ctrl->crypto_base); | ||||
|   | ||||
|  	e_ctrl->bam_pbase = res->bam_pbase; | ||||
| -	e_ctrl->bam_base = ioremap_nocache(res->bam_pbase, res->bam_pbase_sz); | ||||
| +	e_ctrl->bam_base = ioremap(res->bam_pbase, res->bam_pbase_sz); | ||||
|  	nss_crypto_assert(e_ctrl->bam_base); | ||||
|   | ||||
|  	/* | ||||
| --- a/v2.0/src/hal/ipq60xx/nss_crypto_eip197.c | ||||
| +++ b/v2.0/src/hal/ipq60xx/nss_crypto_eip197.c | ||||
| @@ -413,7 +413,7 @@ int nss_crypto_eip197_engine_init(struct | ||||
|  	 * remap the I/O addresses | ||||
|  	 */ | ||||
|  	paddr = res->start + offset; | ||||
| -	vaddr = ioremap_nocache(paddr, resource_size(res)); | ||||
| +	vaddr = ioremap(paddr, resource_size(res)); | ||||
|  	if (!vaddr) { | ||||
|  		nss_crypto_warn("%p: unable to remap crypto_addr(0x%p)\n", node, (void *)paddr); | ||||
|  		return -EIO; | ||||
| --- a/v2.0/src/hal/ipq807x/nss_crypto_eip197.c | ||||
| +++ b/v2.0/src/hal/ipq807x/nss_crypto_eip197.c | ||||
| @@ -414,7 +414,7 @@ int nss_crypto_eip197_engine_init(struct | ||||
|  	 * remap the I/O addresses | ||||
|  	 */ | ||||
|  	paddr = res->start + offset; | ||||
| -	vaddr = ioremap_nocache(paddr, resource_size(res)); | ||||
| +	vaddr = ioremap(paddr, resource_size(res)); | ||||
|  	if (!vaddr) { | ||||
|  		nss_crypto_warn("%p: unable to remap crypto_addr(0x%p)\n", node, (void *)paddr); | ||||
|  		return -EIO; | ||||
| @@ -0,0 +1,57 @@ | ||||
| --- a/v1.0/src/nss_crypto_if.c | ||||
| +++ b/v1.0/src/nss_crypto_if.c | ||||
| @@ -370,15 +370,16 @@ void nss_crypto_transform_done(struct ne | ||||
|  	struct nss_crypto_buf *buf = (struct nss_crypto_buf *)skb->data; | ||||
|  	struct nss_crypto_buf_node *entry; | ||||
|  	void *addr; | ||||
| +	struct device *cdev = gbl_crypto_ctrl.eng[0].dev; | ||||
|   | ||||
|  	if (likely(buf->data_in == buf->data_out)) { | ||||
| -		dma_unmap_single(NULL, buf->data_in, buf->data_len, DMA_BIDIRECTIONAL); | ||||
| +		dma_unmap_single(cdev, buf->data_in, buf->data_len, DMA_BIDIRECTIONAL); | ||||
|  	} else { | ||||
| -		dma_unmap_single(NULL, buf->data_in, buf->data_len, DMA_TO_DEVICE); | ||||
| -		dma_unmap_single(NULL, buf->data_out, buf->data_len, DMA_FROM_DEVICE); | ||||
| +		dma_unmap_single(cdev, buf->data_in, buf->data_len, DMA_TO_DEVICE); | ||||
| +		dma_unmap_single(cdev, buf->data_out, buf->data_len, DMA_FROM_DEVICE); | ||||
|  	} | ||||
|   | ||||
| -	dma_unmap_single(NULL, buf->iv_addr,  L1_CACHE_BYTES, DMA_BIDIRECTIONAL); | ||||
| +	dma_unmap_single(cdev, buf->iv_addr,  L1_CACHE_BYTES, DMA_BIDIRECTIONAL); | ||||
|   | ||||
|  	addr = phys_to_virt(buf->iv_addr); | ||||
|  	entry = container_of(addr, struct nss_crypto_buf_node, results); | ||||
| @@ -531,6 +532,7 @@ nss_crypto_status_t nss_crypto_transform | ||||
|  	uint32_t paddr; | ||||
|  	void *vaddr; | ||||
|  	size_t len; | ||||
| +	struct device *cdev = gbl_crypto_ctrl.eng[0].dev; | ||||
|   | ||||
|  	if (!buf->cb_fn) { | ||||
|  		nss_crypto_warn("%p:no buffer(%p) callback present\n", crypto, buf); | ||||
| @@ -544,7 +546,7 @@ nss_crypto_status_t nss_crypto_transform | ||||
|  	 */ | ||||
|  	vaddr = (void *)buf->data_in; | ||||
|  	len = buf->data_len; | ||||
| -	paddr = dma_map_single(NULL, vaddr, len, DMA_TO_DEVICE); | ||||
| +	paddr = dma_map_single(cdev, vaddr, len, DMA_TO_DEVICE); | ||||
|  	buf->data_in = paddr; | ||||
|   | ||||
|  	if (vaddr == (void *)buf->data_out) { | ||||
| @@ -555,14 +557,14 @@ nss_crypto_status_t nss_crypto_transform | ||||
|  		 */ | ||||
|  		vaddr = (void *)buf->data_out; | ||||
|  		len = buf->data_len; | ||||
| -		paddr = dma_map_single(NULL, vaddr, len, DMA_FROM_DEVICE); | ||||
| +		paddr = dma_map_single(cdev, vaddr, len, DMA_FROM_DEVICE); | ||||
|  		buf->data_out = paddr; | ||||
|  	} | ||||
|   | ||||
|  	/* | ||||
|  	 * We need to map the results into IV | ||||
|  	 */ | ||||
| -	paddr = dma_map_single(NULL, entry->results, L1_CACHE_BYTES, DMA_BIDIRECTIONAL); | ||||
| +	paddr = dma_map_single(cdev, entry->results, L1_CACHE_BYTES, DMA_BIDIRECTIONAL); | ||||
|  	buf->hash_addr = paddr; | ||||
|  	buf->iv_addr = paddr; | ||||
|   | ||||
							
								
								
									
										124
									
								
								package/qca/qca-nss-drv/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								package/qca/qca-nss-drv/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-drv | ||||
| PKG_RELEASE:=2 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-drv | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=809a00deffe9f3d4ecd15965790a152757073437 | ||||
|  | ||||
| NSS_CLIENTS_DIR:=$(TOPDIR)/qca/src/qca-nss-clients | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/qca-nss-drv | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq807x||TARGET_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \ | ||||
| 		+PACKAGE_kmod-qca-nss-gmac:kmod-qca-nss-gmac @!LINUX_3_18 | ||||
|   TITLE:=Kernel driver for NSS (core driver) | ||||
|   FILES:=$(PKG_BUILD_DIR)/qca-nss-drv.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,32,qca-nss-drv) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv/install | ||||
| 	$(INSTALL_DIR) $(1)/lib/debug | ||||
| 	$(INSTALL_DIR) $(1)/etc/init.d | ||||
| 	$(INSTALL_DIR) $(1)/etc/sysctl.d | ||||
| 	$(INSTALL_DIR) $(1)/etc/hotplug.d/firmware | ||||
| 	$(INSTALL_DIR) $(1)/etc/config | ||||
| 	$(INSTALL_DIR) $(1)/lib/firmware | ||||
|  | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-drv.debug $(1)/lib/debug/qca-nss-drv | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-drv.init $(1)/etc/init.d/qca-nss-drv | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-drv.sysctl $(1)/etc/sysctl.d/qca-nss-drv.conf | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-drv.hotplug $(1)/etc/hotplug.d/firmware/10-qca-nss-fw | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-drv.conf $(1)/etc/config/nss | ||||
| 	$(INSTALL_BIN) ./files/nss-firmware/qca-nss0-retail.bin $(1)/lib/firmware/qca-nss0.bin | ||||
| 	$(INSTALL_BIN) ./files/nss-firmware/qca-nss1-retail.bin $(1)/lib/firmware/qca-nss1.bin | ||||
|  | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-drv/Description | ||||
| This package contains a NSS driver for QCA chipset | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	mkdir -p $(1)/usr/include/qca-nss-drv | ||||
| 	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-drv/ | ||||
| ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64")) | ||||
| 	$(RM) $(1)/usr/include/qca-nss-drv/nss_ipsecmgr.h | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-clients | ||||
| 	$(CP) $(NSS_CLIENTS_DIR)/exports/nss_ipsecmgr.h $(1)/usr/include/qca-nss-clients/. | ||||
| endif | ||||
| endef | ||||
|  | ||||
| EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-gmac | ||||
|  | ||||
| # Keeping default as ipq806x for branches that does not have subtarget framework | ||||
| ifeq ($(CONFIG_TARGET_ipq),y) | ||||
| subtarget:=$(SUBTARGET) | ||||
| else | ||||
| subtarget:=$(CONFIG_TARGET_BOARD) | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),256) | ||||
| EXTRA_CFLAGS+= -DNSS_MEM_PROFILE_LOW | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512) | ||||
| EXTRA_CFLAGS+= -DNSS_MEM_PROFILE_MEDIUM | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_KERNEL_SKB_FIXED_SIZE_2K),y) | ||||
| EXTRA_CFLAGS+= -DNSS_SKB_FIXED_SIZE_2K | ||||
| endif | ||||
|  | ||||
| DRV_MAKE_OPTS:= | ||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),256) | ||||
| DRV_MAKE_OPTS+=NSS_DRV_C2C_ENABLE=n \ | ||||
|         NSS_DRV_CAPWAP_ENABLE=n \ | ||||
|         NSS_DRV_CLMAP_ENABLE=n \ | ||||
|         NSS_DRV_CRYPTO_ENABLE=n \ | ||||
|         NSS_DRV_DTLS_ENABLE=n \ | ||||
|         NSS_DRV_GRE_ENABLE=n \ | ||||
|         NSS_DRV_GRE_REDIR_ENABLE=n \ | ||||
|         NSS_DRV_GRE_TUNNEL_ENABLE=n \ | ||||
|         NSS_DRV_IGS_ENABLE=n \ | ||||
|         NSS_DRV_IPSEC_ENABLE=n \ | ||||
|         NSS_DRV_LAG_ENABLE=n \ | ||||
|         NSS_DRV_L2TP_ENABLE=n \ | ||||
|         NSS_DRV_MAPT_ENABLE=n \ | ||||
|         NSS_DRV_OAM_ENABLE=n \ | ||||
|         NSS_DRV_PPTP_ENABLE=n \ | ||||
|         NSS_DRV_PORTID_ENABLE=n \ | ||||
|         NSS_DRV_PVXLAN_ENABLE=n \ | ||||
|         NSS_DRV_QRFS_ENABLE=n \ | ||||
|         NSS_DRV_QVPN_ENABLE=n \ | ||||
|         NSS_DRV_RMNET_ENABLE=n \ | ||||
|         NSS_DRV_SHAPER_ENABLE=n \ | ||||
|         NSS_DRV_SJACK_ENABLE=n \ | ||||
|         NSS_DRV_TLS_ENABLE=n \ | ||||
|         NSS_DRV_TRUSTSEC_ENABLE=n \ | ||||
|         NSS_DRV_TSTAMP_ENABLE=n \ | ||||
|         NSS_DRV_TUN6RD_ENABLE=n \ | ||||
|         NSS_DRV_TUNIPIP6_ENABLE=n \ | ||||
|         NSS_DRV_VXLAN_ENABLE=n | ||||
| endif | ||||
|  | ||||
| define Build/Configure | ||||
| 	$(LN) arch/nss_$(subtarget).h $(PKG_BUILD_DIR)/exports/nss_arch.h | ||||
| endef | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE)  $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(DRV_MAKE_OPTS)) \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(subtarget)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-drv)) | ||||
							
								
								
									
										45
									
								
								package/qca/qca-nss-drv/files/nss-firmware/LICENSE.TXT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								package/qca/qca-nss-drv/files/nss-firmware/LICENSE.TXT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| Copyright (c) 2014 Qualcomm Atheros, Inc. | ||||
|  | ||||
| All rights reserved. | ||||
|  | ||||
| Redistribution and use in binary forms, without | ||||
| modification, are permitted (subject to the limitations in the | ||||
| disclaimer below) provided that the following conditions are met: | ||||
|  | ||||
| *Redistributions must reproduce the above copyright | ||||
|  notice, this list of conditions, and the following disclaimer in the | ||||
|  documentation and/or other materials provided with the distribution. | ||||
|  | ||||
| *Neither the name of Qualcomm Atheros, Inc. nor the names of its | ||||
|  contributors may be used to endorse or promote products derived | ||||
|  from this software without specific prior written permission. | ||||
|  | ||||
| *No Reverse engineering, decompiling, decrypting, or disassembling of this | ||||
|  software is permitted. | ||||
|  | ||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||||
| A PARTICULAR PURPOSE ARE DISCLAIMED. NO LICENSES OR OTHER RIGHTS, | ||||
| WHETHER EXPRESS, IMPLIED, BASED ON ESTOPPEL OR OTHERWISE, ARE GRANTED | ||||
| TO ANY PARTY'S PATENTS, PATENT APPLICATIONS, OR PATENTABLE INVENTIONS | ||||
| BY VIRTUE OF THIS LICENSE OR THE DELIVERY OR PROVISION BY QUALCOMM | ||||
| ATHEROS, INC. OF THE SOFTWARE. | ||||
|  | ||||
| IN NO EVENT SHALL THE COPYRIGHT OWNER OR ANY CONTRIBUTOR BE LIABLE FOR | ||||
| ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||||
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
| HOWEVER CAUSED AND REGARDLESS OF ANY THEORY OF LIABILITY, WHETHER IN | ||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||||
| OTHERWISE) ARISING IN ANY WAY OUT OF OR RESULTING FROM THE USE OF THE | ||||
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY | ||||
| EVENT, THE TOTAL AGGREGATE LIABILITY THAT MAY BE IMPOSED ON QUALCOMM | ||||
| ATHEROS, INC. FOR ANY DIRECT DAMAGES ARISING UNDER OR RESULTING FROM | ||||
| THIS AGREEMENT OR IN CONNECTION WITH ANY USE OF THE SOFTWARE SHALL NOT | ||||
| EXCEED A TOTAL AMOUNT OF US$5.00. | ||||
|  | ||||
| IF ANY OF THE ABOVE PROVISIONS ARE HELD TO BE VOID, INVALID, | ||||
| UNENFORCEABLE, OR ILLEGAL, THE OTHER PROVISIONS SHALL CONTINUE IN FULL | ||||
| FORCE AND EFFECT. | ||||
|  | ||||
							
								
								
									
										217
									
								
								package/qca/qca-nss-drv/files/nss-firmware/NOTICE.TXT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										217
									
								
								package/qca/qca-nss-drv/files/nss-firmware/NOTICE.TXT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,217 @@ | ||||
| ============================================================================= | ||||
|  | ||||
| This Notice.txt file contains certain notices of software components included | ||||
| with the software that Qualcomm Atheros, Inc. ("Qualcomm Atheros") is required | ||||
| to provide you. Except where prohibited by the open source license, the content | ||||
| of this notices file is only provided to satisfy Qualcomm Atheros's attribution | ||||
| and notice requirement; your use of these software components together with the | ||||
| Qualcomm Atheros software (Qualcomm Atheros software hereinafter referred to as | ||||
| "Software") is subject to the terms of your license from Qualcomm Atheros. | ||||
| Compliance with all copyright laws and software license agreements included in | ||||
| the notice section of this file are the responsibility of the user.  Except as | ||||
| may be granted by separate express written agreement, this file provides no | ||||
| license to any Qualcomm Atheros patents, trademarks, copyrights, or other | ||||
| intellectual property. | ||||
|  | ||||
| Copyright (c) 2014 Qualcomm Atheros, Inc.  All rights reserved. | ||||
|  | ||||
| Qualcomm is a trademark of Qualcomm Incorporated, registered in the United | ||||
| States and other countries.  All Qualcomm Incorporated trademarks are used with | ||||
| permission.  Atheros is a trademark of Qualcomm Atheros, Inc., registered in the | ||||
| United States and other countries.  Other products and brand names may be | ||||
| trademarks or registered trademarks of their respective owners. | ||||
|  | ||||
| NOTICES: | ||||
|  | ||||
| ============================================================================= | ||||
|  | ||||
| /* | ||||
|  * doprint.c | ||||
|  *      Formatted string print support. | ||||
|  * | ||||
|  * Copyright <A9> 2001-2012 Qualcomm Atheros, Inc.  All Rights Reserved. | ||||
|  * | ||||
|  * Qualcomm Atheros Confidential and Proprietary. | ||||
|  * | ||||
|  * This code originates with BSD Unix however it has been extensively | ||||
|  * modified.  The original copyright is reproduced below: | ||||
|  * | ||||
|  * Copyright (c) 1988 Regents of the University of California. | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms are permitted provided | ||||
|  * that: (1) source distributions retain this entire copyright notice and | ||||
|  * comment, and (2) distributions including binaries display the following | ||||
|  * acknowledgement:  ``This product includes software developed by the | ||||
|  * University of California, Berkeley and its contributors'' in the | ||||
|  * documentation or other materials provided with the distribution and in | ||||
|  * all advertising materials mentioning features or use of this software. | ||||
|  * Neither the name of the University nor the names of its contributors may | ||||
|  * be used to endorse or promote products derived from this software without | ||||
|  * specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | ||||
|  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | ||||
|  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * math.c | ||||
|  *      Support for the standard C library. | ||||
|  * | ||||
|  * Copyright <A9> 2006-2012 Qualcomm Atheros, Inc.  All Rights Reserved. | ||||
|  * | ||||
|  * Qualcomm Atheros Confidential and Proprietary. | ||||
|  * | ||||
|  * Software contained within this file was originally released with the | ||||
|  * following | ||||
|  * copyright and license statement: | ||||
|  * | ||||
|  * ==================================================== | ||||
|  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||||
|  * | ||||
|  * Developed at SunPro, a Sun Microsystems, Inc. business. | ||||
|  * Permission to use, copy, modify, and distribute this | ||||
|  * software is freely granted, provided that this notice | ||||
|  * is preserved. | ||||
|  * ==================================================== | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * stdlib.c | ||||
|  *      Routines from stdlib.h. | ||||
|  * | ||||
|  * Copyright <A9> 2004-2012 Qualcomm Atheros, Inc.  All Rights Reserved. | ||||
|  * | ||||
|  * Qualcomm Atheros Confidential and Proprietary. | ||||
|  * | ||||
|  * The code for strtol() and strtoul() are also subject to the following: | ||||
|  * | ||||
|  * Copyright (c) 1990, 1993 | ||||
|  *      The Regents of the University of California. All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * 3. All advertising materials mentioning features or use of this software | ||||
|  *    must display the following acknowledgement: | ||||
|  *      This product includes software developed by the University of | ||||
|  *      California, Berkeley and its contributors. | ||||
|  * 4. Neither the name of the University nor the names of its contributors | ||||
|  *    may be used to endorse or promote products derived from this software | ||||
|  *    without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
|  | ||||
| drr_alg_utils.h: | ||||
| /****************************************************************************/ | ||||
| /*- | ||||
|  * Copyright (c) 1992, 1993 | ||||
|  *	The Regents of the University of California.  All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * 4. Neither the name of the University nor the names of its contributors | ||||
|  *    may be used to endorse or promote products derived from this software | ||||
|  *    without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| shaper_list_utils.h: | ||||
| /****************************************************************************/ | ||||
| /*- | ||||
|  * Copyright (c) 1992, 1993 | ||||
|  *	The Regents of the University of California.  All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * 4. Neither the name of the University nor the names of its contributors | ||||
|  *    may be used to endorse or promote products derived from this software | ||||
|  *    without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| codel_alg_inv_sqrt.h | ||||
| /****************************************************************************/ | ||||
| /*- | ||||
|  * Copyright (c) 1992, 1993 | ||||
|  *	The Regents of the University of California.  All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * 4. Neither the name of the University nor the names of its contributors | ||||
|  *    may be used to endorse or promote products derived from this software | ||||
|  *    without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
							
								
								
									
										10
									
								
								package/qca/qca-nss-drv/files/nss-firmware/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								package/qca/qca-nss-drv/files/nss-firmware/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| NSS FIRMWARE | ||||
| ============ | ||||
|  | ||||
| This repo contains firmware files to enable the NSS MAC on QCA IPQ806x SoC. | ||||
|  | ||||
| This product includes software developed by the University of California, | ||||
| Berkeley and its contributors. | ||||
|  | ||||
| NSS firmware extracted from Synology RT2600ac SRM 1.2 - Version: 1.2-7742-4 | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								package/qca/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								package/qca/qca-nss-drv/files/nss-firmware/qca-nss0-retail.bin
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								package/qca/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								package/qca/qca-nss-drv/files/nss-firmware/qca-nss1-retail.bin
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| config nss_firmware 'qca_nss_0' | ||||
|  | ||||
| config nss_firmware 'qca_nss_1' | ||||
|  | ||||
| config general | ||||
| 	option enable_rps	'1' | ||||
							
								
								
									
										26
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.debug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.debug
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| #!/bin/sh /sbin/sysdebug | ||||
| # | ||||
| # Copyright (c) 2015-2016, 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. | ||||
| # | ||||
|  | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/pppoe | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/n2h | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/ipv6 | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/ipv4 | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/gmac | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/drv | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/wifi | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/wifi_if | ||||
| log cat /sys/kernel/debug/qca-nss-drv/stats/eth_rx | ||||
							
								
								
									
										70
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.hotplug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.hotplug
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| # Copyright (c) 2015-2016, 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. | ||||
| # | ||||
|  | ||||
| KERNEL=`uname -r` | ||||
| case "${KERNEL}" in | ||||
| 	3.4*) | ||||
| 		select_or_load=load_nss_fw | ||||
| 		;; | ||||
| 	*) | ||||
| 		select_or_load=select_nss_fw | ||||
| 		;; | ||||
| esac | ||||
|  | ||||
| load_nss_fw () { | ||||
| 	ls -l $1 | awk ' { print $9,$5 } '> /dev/console | ||||
| 	echo 1 > /sys/class/firmware/$DEVICENAME/loading | ||||
| 	cat $1 > /sys/class/firmware/$DEVICENAME/data | ||||
| 	echo 0 > /sys/class/firmware/$DEVICENAME/loading | ||||
| } | ||||
|  | ||||
| select_nss_fw () { | ||||
| 	rm -f /lib/firmware/$DEVICENAME | ||||
| 	ln -s $1 /lib/firmware/$DEVICENAME | ||||
| 	ls -l /lib/firmware/$DEVICENAME | awk ' { print $9,$5 } '> /dev/console | ||||
| } | ||||
|  | ||||
| [ "$ACTION" != "add" ] && exit | ||||
|  | ||||
| # dev name for UCI, since it doesn't let you use . or - | ||||
| SDEVNAME=$(echo ${DEVICENAME} | sed s/[.-]/_/g) | ||||
|  | ||||
| SELECTED_FW=$(uci get nss.${SDEVNAME}.firmware 2>/dev/null) | ||||
| [ -e "${SELECTED_FW}" ] && { | ||||
| 	$select_or_load ${SELECTED_FW} | ||||
| 	exit | ||||
| } | ||||
|  | ||||
| case $DEVICENAME in | ||||
|         qca-nss0* | qca-nss.0*) | ||||
|                 if [ -e /lib/firmware/qca-nss0-enterprise.bin ] ; then | ||||
|                         $select_or_load /lib/firmware/qca-nss0-enterprise.bin | ||||
|                 else | ||||
|                         $select_or_load /lib/firmware/qca-nss0-retail.bin | ||||
|                 fi | ||||
|                 exit | ||||
|                 ;; | ||||
|         qca-nss1* | qca-nss.1*) | ||||
|                 if [ -e /lib/firmware/qca-nss1-enterprise.bin ] ; then | ||||
|                         $select_or_load /lib/firmware/qca-nss1-enterprise.bin | ||||
|                 else | ||||
|                         $select_or_load /lib/firmware/qca-nss1-retail.bin | ||||
|                 fi | ||||
|                 exit | ||||
|                 ;; | ||||
| esac | ||||
|  | ||||
							
								
								
									
										50
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| #!/bin/sh /etc/rc.common | ||||
| # | ||||
| # 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. | ||||
| # | ||||
|  | ||||
| START=70 | ||||
|  | ||||
| enable_rps() { | ||||
| 	irq_nss_rps=`grep nss_queue1 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` | ||||
| 	for entry in $irq_nss_rps | ||||
| 	do | ||||
| 		echo 2 > /proc/irq/$entry/smp_affinity | ||||
| 	done | ||||
|  | ||||
| 	irq_nss_rps=`grep nss_queue2 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` | ||||
| 	for entry in $irq_nss_rps | ||||
| 	do | ||||
| 		echo 4 > /proc/irq/$entry/smp_affinity | ||||
| 	done | ||||
|  | ||||
| 	irq_nss_rps=`grep nss_queue3 /proc/interrupts | cut -d ':' -f 1 | tr -d ' '` | ||||
| 	for entry in $irq_nss_rps | ||||
| 	do | ||||
| 		echo 8 > /proc/irq/$entry/smp_affinity | ||||
| 	done | ||||
|  | ||||
| 	# Enable NSS RPS | ||||
| 	sysctl -w dev.nss.rps.enable=1 >/dev/null 2>/dev/null | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| start() { | ||||
| 	local rps_enabled="$(uci_get nss @general[0] enable_rps)" | ||||
| 	if [ "$rps_enabled" -eq 1 ]; then | ||||
| 		enable_rps | ||||
| 	fi | ||||
| } | ||||
							
								
								
									
										4
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.sysctl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								package/qca/qca-nss-drv/files/qca-nss-drv.sysctl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| # Default Number of connection configuration | ||||
| dev.nss.ipv4cfg.ipv4_conn=4096 | ||||
| dev.nss.ipv6cfg.ipv6_conn=4096 | ||||
|  | ||||
							
								
								
									
										107
									
								
								package/qca/qca-nss-drv/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								package/qca/qca-nss-drv/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
| diff --git a/Makefile b/Makefile | ||||
| index d998548..b1a4a83 100644 | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -161,7 +161,7 @@ endif | ||||
|  ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1 | ||||
|   | ||||
|  ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1 | ||||
| -ccflags-y += -Werror | ||||
| +# ccflags-y += -Werror | ||||
|   | ||||
|  ifneq ($(findstring 3.4, $(KERNELVERSION)),) | ||||
|  NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 -DNSS_EMPTY_BUFFER_SIZE=1984 | ||||
| diff --git a/nss_core.c b/nss_core.c | ||||
| index 6c9716a..8956eb5 100644 | ||||
| --- a/nss_core.c | ||||
| +++ b/nss_core.c | ||||
| @@ -26,6 +26,7 @@ | ||||
|  #include <nss_hal.h> | ||||
|  #include <net/dst.h> | ||||
|  #include <linux/etherdevice.h> | ||||
| +#include <linux/kmemleak.h> | ||||
|  #include "nss_tx_rx_common.h" | ||||
|  #include "nss_data_plane.h" | ||||
|   | ||||
| @@ -45,7 +46,8 @@ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)))) || \ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \ | ||||
| -(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))))) | ||||
| +(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ | ||||
| +(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))))) | ||||
|  #error "Check skb recycle code in this file to match Linux version" | ||||
|  #endif | ||||
|   | ||||
| @@ -395,7 +397,11 @@ static void nss_get_ddr_info(struct nss_mmu_ddr_info *mmu, char *name) | ||||
|  	struct device_node *node; | ||||
|   | ||||
|  	si_meminfo(&vals); | ||||
| +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) | ||||
| +	cached = global_zone_page_state(NR_FILE_PAGES); | ||||
| +#else | ||||
|  	cached = global_page_state(NR_FILE_PAGES); | ||||
| +#endif /*KERNEL_VERSION(4, 14, 0)*/ | ||||
|  	avail_ddr = (vals.totalram + cached + vals.sharedram) * vals.mem_unit; | ||||
|   | ||||
|  	/* | ||||
| @@ -679,7 +685,11 @@ static inline void nss_core_handle_virt_if_pkt(struct nss_ctx_instance *nss_ctx, | ||||
|  	 * Mimic Linux behavior to allow multi-queue netdev choose which queue to use | ||||
|  	 */ | ||||
|  	if (ndev->netdev_ops->ndo_select_queue) { | ||||
| +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)) | ||||
| +		queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL); | ||||
| +#else | ||||
|  		queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL, NULL); | ||||
| +#endif /*KERNEL_VERSION(5, 3, 0)*/ | ||||
|  	} | ||||
|   | ||||
|  	skb_set_queue_mapping(nbuf, queue_offset); | ||||
| @@ -2269,7 +2279,11 @@ static inline bool nss_skb_can_reuse(struct nss_ctx_instance *nss_ctx, | ||||
|  	 * This check is added to avoid deadlock from nf_conntrack | ||||
|  	 * when ecm is trying to flush a rule. | ||||
|  	 */ | ||||
| +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) | ||||
| +	if (unlikely(skb_nfct(nbuf))) { | ||||
| +#else | ||||
|  	if (unlikely(nbuf->nfct)) { | ||||
| +#endif /*KERNEL_VERSION(4, 11, 0)*/ | ||||
|  		return false; | ||||
|  	} | ||||
|  #endif | ||||
| @@ -2279,7 +2285,11 @@ static inline bool nss_skb_can_reuse(struct nss_ctx_instance *nss_ctx, | ||||
|  	 * This check is added to avoid deadlock from nf_bridge | ||||
|  	 * when ecm is trying to flush a rule. | ||||
|  	 */ | ||||
| +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) | ||||
| +	if (unlikely(skb_ext_exist(nbuf, SKB_EXT_BRIDGE_NF))) { | ||||
| +#else | ||||
|  	if (unlikely(nbuf->nf_bridge)) { | ||||
| +#endif /*KERNEL_VERSION(4, 11, 0)*/ | ||||
|  		return false; | ||||
|  	} | ||||
|  #endif | ||||
| diff --git a/nss_n2h.c b/nss_n2h.c | ||||
| index 781ce2b..695ac13 100644 | ||||
| --- a/nss_n2h.c | ||||
| +++ b/nss_n2h.c | ||||
| @@ -19,6 +19,7 @@ | ||||
|   *	NSS N2H node APIs | ||||
|   */ | ||||
|   | ||||
| +#include <linux/kmemleak.h> | ||||
|  #include "nss_tx_rx_common.h" | ||||
|  #include "nss_n2h_stats.h" | ||||
|   | ||||
|  | ||||
| --- a/nss_data_plane/nss_data_plane_gmac.c | ||||
| +++ b/nss_data_plane/nss_data_plane_gmac.c | ||||
| @@ -20,7 +20,7 @@ | ||||
|  #include "nss_tx_rx_common.h" | ||||
|  #include <nss_gmac_api_if.h> | ||||
|   | ||||
| -#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) | ||||
| +#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6)) | ||||
|  #define NSS_DATA_PLANE_GMAC_MAX_INTERFACES 4 | ||||
|   | ||||
|  static DEFINE_SPINLOCK(nss_data_plane_gmac_stats_lock); | ||||
| @@ -0,0 +1,38 @@ | ||||
| From 40d4b080f17883ac6b39c74a5feb1af384ab6a51 Mon Sep 17 00:00:00 2001 | ||||
| From: Robert Marko <robert.marko@sartura.hr> | ||||
| Date: Thu, 11 Jun 2020 16:57:39 +0200 | ||||
| Subject: [PATCH] nss-drv: Control fab scaling from package Makefile | ||||
|  | ||||
| Lets control the fab scaling from the package Makefile | ||||
| instead of using kernel checks that dont work. | ||||
| Fab scaling in OpenWrt is done in a external way. | ||||
|  | ||||
| Signed-off-by: Robert Marko <robert.marko@sartura.hr> | ||||
| --- | ||||
|  Makefile | 9 --------- | ||||
|  1 file changed, 9 deletions(-) | ||||
|  | ||||
| diff --git a/Makefile b/Makefile | ||||
| index 20729ab..2567dd4 100644 | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -405,15 +405,8 @@ 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 | ||||
| +NSS_CCFLAGS += -DNSS_FABRIC_SCALING_SUPPORT=0 | ||||
|  | ||||
|  # Disable Frequency scaling | ||||
|  ifeq "$(NSS_FREQ_SCALE_DISABLE)" "y" | ||||
|  ccflags-y += -DNSS_FREQ_SCALE_SUPPORT=0 | ||||
| --  | ||||
| 2.26.2 | ||||
|  | ||||
							
								
								
									
										132
									
								
								package/qca/qca-nss-drv/patches/102-fix-ioremap-call.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								package/qca/qca-nss-drv/patches/102-fix-ioremap-call.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | ||||
| --- a/nss_meminfo.c | ||||
| +++ b/nss_meminfo.c | ||||
| @@ -687,7 +687,7 @@ bool nss_meminfo_init(struct nss_ctx_ins | ||||
|  	/* | ||||
|  	 * meminfo_start is the label where the start address of meminfo map is stored. | ||||
|  	 */ | ||||
| -	meminfo_start = (uint32_t *)ioremap_nocache(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET, | ||||
| +	meminfo_start = (uint32_t *)ioremap(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET, | ||||
|  							NSS_MEMINFO_RESERVE_AREA_SIZE); | ||||
|  	if (!meminfo_start) { | ||||
|  		nss_info_always("%p: cannot remap meminfo start\n", nss_ctx); | ||||
|  | ||||
| --- a/nss_hal/fsm9010/nss_hal_pvt.c | ||||
| +++ b/nss_hal/fsm9010/nss_hal_pvt.c | ||||
| @@ -145,7 +145,7 @@ static struct nss_platform_data *__nss_h | ||||
|  	npd->nphys = res_nphys.start; | ||||
|  	npd->vphys = res_vphys.start; | ||||
|   | ||||
| -	npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); | ||||
| +	npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); | ||||
|  	if (!npd->nmap) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
| --- a/nss_hal/ipq60xx/nss_hal_pvt.c | ||||
| +++ b/nss_hal/ipq60xx/nss_hal_pvt.c | ||||
| @@ -193,13 +193,13 @@ static struct nss_platform_data *__nss_h | ||||
|  	npd->nphys = res_nphys.start; | ||||
|  	npd->qgic_phys = res_qgic_phys.start; | ||||
|   | ||||
| -	npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); | ||||
| +	npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); | ||||
|  	if (!npd->nmap) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
|  	} | ||||
|   | ||||
| -	npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys)); | ||||
| +	npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); | ||||
|  	if (!npd->qgic_map) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
| @@ -401,13 +401,13 @@ static int __nss_hal_common_reset(struct | ||||
|   | ||||
|  	of_node_put(cmn); | ||||
|   | ||||
| -	nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); | ||||
| +	nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); | ||||
|  	if (!nss_misc_reset) { | ||||
|  		pr_err("%p: ioremap fail for nss_misc_reset\n", nss_dev); | ||||
|  		return -EFAULT; | ||||
|  	} | ||||
|   | ||||
| -	nss_misc_reset_flag = ioremap_nocache(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag)); | ||||
| +	nss_misc_reset_flag = ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag)); | ||||
|  	if (!nss_misc_reset_flag) { | ||||
|  		pr_err("%p: ioremap fail for nss_misc_reset_flag\n", nss_dev); | ||||
|  		return -EFAULT; | ||||
| --- a/nss_hal/ipq806x/nss_hal_pvt.c | ||||
| +++ b/nss_hal/ipq806x/nss_hal_pvt.c | ||||
| @@ -458,7 +458,7 @@ static struct nss_platform_data *__nss_h | ||||
|  	npd->nphys = res_nphys.start; | ||||
|  	npd->vphys = res_vphys.start; | ||||
|   | ||||
| -	npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); | ||||
| +	npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); | ||||
|  	if (!npd->nmap) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
| @@ -710,7 +710,7 @@ static int __nss_hal_common_reset(struct | ||||
|  	} | ||||
|  	of_node_put(cmn); | ||||
|   | ||||
| -	fpb_base = ioremap_nocache(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base)); | ||||
| +	fpb_base = ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base)); | ||||
|  	if (!fpb_base) { | ||||
|  		pr_err("%p: ioremap fail for nss_fpb_base\n", nss_dev); | ||||
|  		return -EFAULT; | ||||
| --- a/nss_hal/ipq807x/nss_hal_pvt.c | ||||
| +++ b/nss_hal/ipq807x/nss_hal_pvt.c | ||||
| @@ -233,7 +233,7 @@ static struct nss_platform_data *__nss_h | ||||
|  	npd->vphys = res_vphys.start; | ||||
|  	npd->qgic_phys = res_qgic_phys.start; | ||||
|   | ||||
| -	npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys)); | ||||
| +	npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys)); | ||||
|  	if (!npd->nmap) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
| @@ -245,7 +245,7 @@ static struct nss_platform_data *__nss_h | ||||
|  		goto out; | ||||
|  	} | ||||
|   | ||||
| -	npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys)); | ||||
| +	npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys)); | ||||
|  	if (!npd->qgic_map) { | ||||
|  		nss_info_always("%p: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id); | ||||
|  		goto out; | ||||
| @@ -463,7 +463,7 @@ static int __nss_hal_common_reset(struct | ||||
|  	} | ||||
|  	of_node_put(cmn); | ||||
|   | ||||
| -	nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); | ||||
| +	nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset)); | ||||
|  	if (!nss_misc_reset) { | ||||
|  		pr_err("%p: ioremap fail for nss_misc_reset\n", nss_dev); | ||||
|  		return -EFAULT; | ||||
| --- a/nss_hal/nss_hal.c | ||||
| +++ b/nss_hal/nss_hal.c | ||||
| @@ -78,9 +78,9 @@ int nss_hal_firmware_load(struct nss_ctx | ||||
|  		return rc; | ||||
|  	} | ||||
|   | ||||
| -	load_mem = ioremap_nocache(npd->load_addr, nss_fw->size); | ||||
| +	load_mem = ioremap(npd->load_addr, nss_fw->size); | ||||
|  	if (!load_mem) { | ||||
| -		nss_info_always("%p: ioremap_nocache failed: %x", nss_ctx, npd->load_addr); | ||||
| +		nss_info_always("%p: ioremap failed: %x", nss_ctx, npd->load_addr); | ||||
|  		release_firmware(nss_fw); | ||||
|  		return rc; | ||||
|  	} | ||||
| --- a/nss_ppe.c | ||||
| +++ b/nss_ppe.c | ||||
| @@ -354,7 +354,7 @@ void nss_ppe_init(void) | ||||
|  	/* | ||||
|  	 * Get the PPE base address | ||||
|  	 */ | ||||
| -	ppe_pvt.ppe_base = ioremap_nocache(PPE_BASE_ADDR, PPE_REG_SIZE); | ||||
| +	ppe_pvt.ppe_base = ioremap(PPE_BASE_ADDR, PPE_REG_SIZE); | ||||
|  	if (!ppe_pvt.ppe_base) { | ||||
|  		nss_warning("DRV can't get PPE base address\n"); | ||||
|  		return; | ||||
|  | ||||
| @@ -0,0 +1,11 @@ | ||||
| --- a/nss_core.c | ||||
| +++ b/nss_core.c | ||||
| @@ -1599,7 +1599,7 @@ static int32_t nss_core_handle_cause_que | ||||
|  		 * | ||||
|  		 */ | ||||
|  		if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) { | ||||
| -			dma_unmap_single(NULL, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE); | ||||
| +			dma_unmap_single(nss_ctx->dev, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE); | ||||
|  			goto consume; | ||||
|  		} | ||||
|   | ||||
| @@ -0,0 +1,82 @@ | ||||
| From 89949decfd9a0f86427b502aae4fbc3a3ef399f0 Mon Sep 17 00:00:00 2001 | ||||
| From: Ansuel Smith <ansuelsmth@gmail.com> | ||||
| Date: Tue, 23 Jun 2020 19:50:28 +0200 | ||||
| Subject: [PATCH] Fix Kernel Panic dma with NULL dev | ||||
|  | ||||
| --- | ||||
|  nss_coredump.c | 4 ++-- | ||||
|  nss_log.c      | 8 +++++--- | ||||
|  2 files changed, 8 insertions(+), 6 deletions(-) | ||||
|  | ||||
| diff --git a/nss_coredump.c b/nss_coredump.c | ||||
| index aa4ba82..957eca0 100644 | ||||
| --- a/nss_coredump.c | ||||
| +++ b/nss_coredump.c | ||||
| @@ -154,7 +154,7 @@ void nss_fw_coredump_notify(struct nss_ctx_instance *nss_own, | ||||
|  		dma_addr = nss_own->meminfo_ctx.logbuffer_dma; | ||||
|  	} | ||||
|   | ||||
| -	dma_sync_single_for_cpu(NULL, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); | ||||
| +	dma_sync_single_for_cpu(nss_own->dev, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); | ||||
|   | ||||
|  	/* | ||||
|  	 * If the current entry is smaller than or equal to the number of NSS_LOG_COREDUMP_LINE_NUM, | ||||
| @@ -181,7 +181,7 @@ void nss_fw_coredump_notify(struct nss_ctx_instance *nss_own, | ||||
|   | ||||
|  		offset = (index * sizeof(struct nss_log_entry)) | ||||
|  			+ offsetof(struct nss_log_descriptor, log_ring_buffer); | ||||
| -		dma_sync_single_for_cpu(NULL, dma_addr + offset, | ||||
| +		dma_sync_single_for_cpu(nss_own->dev, dma_addr + offset, | ||||
|  				sizeof(struct nss_log_entry), DMA_FROM_DEVICE); | ||||
|  		nss_info_always("%p: %s\n", nss_own, nle_print->message); | ||||
|  		nle_print++; | ||||
| diff --git a/nss_log.c b/nss_log.c | ||||
| index 06ebba4..f9bd6c8 100644 | ||||
| --- a/nss_log.c | ||||
| +++ b/nss_log.c | ||||
| @@ -44,6 +44,7 @@ struct nss_log_data { | ||||
|  	uint32_t last_entry;	/* Last known sampled entry (or index) */ | ||||
|  	uint32_t nentries;	/* Caches the total number of entries of log buffer */ | ||||
|  	int nss_id;		/* NSS Core id being used */ | ||||
| +	struct device *nss_dev; | ||||
|  }; | ||||
|   | ||||
|  struct nss_log_ring_buffer_addr nss_rbe[NSS_MAX_CORES]; | ||||
| @@ -125,6 +126,7 @@ static int nss_log_open(struct inode *inode, struct file *filp) | ||||
|  	data->last_entry = 0; | ||||
|  	data->nentries = nss_rbe[nss_id].nentries; | ||||
|  	data->dma_addr = nss_rbe[nss_id].dma_addr; | ||||
| +	data->nss_dev = nss_ctx->dev; | ||||
|   | ||||
|  	/* | ||||
|  	 * Increment the reference count so that we don't free | ||||
| @@ -207,7 +209,7 @@ static ssize_t nss_log_read(struct file *filp, char __user *buf, size_t size, lo | ||||
|  	/* | ||||
|  	 * Get the current index | ||||
|  	 */ | ||||
| -	dma_sync_single_for_cpu(NULL, data->dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); | ||||
| +	dma_sync_single_for_cpu(data->nss_dev, data->dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE); | ||||
|  	entry = nss_log_current_entry(desc); | ||||
|   | ||||
|  	/* | ||||
| @@ -251,7 +253,7 @@ static ssize_t nss_log_read(struct file *filp, char __user *buf, size_t size, lo | ||||
|  		offset = (offset * sizeof(struct nss_log_entry)) | ||||
|  			 + offsetof(struct nss_log_descriptor, log_ring_buffer); | ||||
|   | ||||
| -		dma_sync_single_for_cpu(NULL, data->dma_addr + offset, | ||||
| +		dma_sync_single_for_cpu(data->nss_dev, data->dma_addr + offset, | ||||
|  			sizeof(struct nss_log_entry), DMA_FROM_DEVICE); | ||||
|  		rb = &desc->log_ring_buffer[index]; | ||||
|   | ||||
| @@ -510,7 +512,7 @@ bool nss_debug_log_buffer_alloc(uint8_t nss_id, uint32_t nentry) | ||||
|  	return true; | ||||
|   | ||||
|  fail: | ||||
| -	dma_unmap_single(NULL, dma_addr, size, DMA_FROM_DEVICE); | ||||
| +	dma_unmap_single(nss_ctx->dev, dma_addr, size, DMA_FROM_DEVICE); | ||||
|  	kfree(addr); | ||||
|  	wake_up(&nss_log_wq); | ||||
|  	return false; | ||||
| --  | ||||
| 2.27.0 | ||||
|  | ||||
| @@ -0,0 +1,54 @@ | ||||
| From f8cf061454a3707c0c84d0fca685e84455f91362 Mon Sep 17 00:00:00 2001 | ||||
| From: Suruchi Suman <surusuma@codeaurora.org> | ||||
| Date: Tue, 3 Dec 2019 12:57:38 +0530 | ||||
| Subject: [qca-nss-drv] Exported set nexhop function from drv. | ||||
|  | ||||
| Change-Id: I3df6658bef72fe574ac9acfb7aac61785769766f | ||||
| Signed-off-by: Suruchi Suman <surusuma@codeaurora.org> | ||||
| --- | ||||
|  nss_phys_if.c | 9 ++++++++- | ||||
|  1 file changed, 8 insertions(+), 1 deletion(-) | ||||
|  | ||||
| --- a/nss_phys_if.c | ||||
| +++ b/nss_phys_if.c | ||||
| @@ -1,6 +1,6 @@ | ||||
|  /* | ||||
|   ************************************************************************** | ||||
| - * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. | ||||
| + * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. | ||||
|   * Permission to use, copy, modify, and/or distribute this software for | ||||
|   * any purpose with or without fee is hereby granted, provided that the | ||||
|   * above copyright notice and this permission notice appear in all copies. | ||||
| @@ -583,6 +583,12 @@ nss_tx_status_t nss_phys_if_set_nexthop( | ||||
|  	struct nss_phys_if_msg nim; | ||||
|   | ||||
|  	NSS_VERIFY_CTX_MAGIC(nss_ctx); | ||||
| + | ||||
| +	if (nexthop >= NSS_MAX_NET_INTERFACES) { | ||||
| +		nss_warning("%p: Invalid nexthop interface number: %d", nss_ctx, nexthop); | ||||
| +		return NSS_TX_FAILURE_BAD_PARAM; | ||||
| +	} | ||||
| + | ||||
|  	nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num); | ||||
|   | ||||
|  	nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP, | ||||
| @@ -591,6 +597,7 @@ nss_tx_status_t nss_phys_if_set_nexthop( | ||||
|   | ||||
|  	return nss_phys_if_msg_sync(nss_ctx, &nim); | ||||
|  } | ||||
| +EXPORT_SYMBOL(nss_phys_if_set_nexthop); | ||||
|   | ||||
|  /* | ||||
|   * nss_get_state() | ||||
| --- a/nss_core.c | ||||
| +++ b/nss_core.c | ||||
| @@ -47,7 +47,8 @@ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \ | ||||
|  (((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ | ||||
| -(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))))) | ||||
| +(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \ | ||||
| +(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) | ||||
|  #error "Check skb recycle code in this file to match Linux version" | ||||
|  #endif | ||||
|   | ||||
							
								
								
									
										270
									
								
								package/qca/qca-nss-ecm/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										270
									
								
								package/qca/qca-nss-ecm/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,270 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-ecm | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/qca-nss-ecm | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=9228212b4238c0d8c296f795948ede8f2ca0242e | ||||
|  | ||||
| LOCAL_VARIANT=$(patsubst qca-nss-ecm-%,%,$(patsubst qca-nss-ecm-%,%,$(BUILD_VARIANT))) | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| ifeq ($(CONFIG_QCA_NSS_ECM_EXAMPLES_PCC),y) | ||||
|        FILES_EXAMPLES=$(PKG_BUILD_DIR)/examples/ecm_pcc_test.ko | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_QCA_NSS_ECM_EXAMPLES_MARK),y) | ||||
|        FILES_EXAMPLES+=$(PKG_BUILD_DIR)/examples/ecm_mark_test.ko | ||||
| endif | ||||
|  | ||||
| #Explicitly enable OVS external module, if ovsmgr is enabled. | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),) | ||||
| CONFIG_QCA_NSS_ECM_OVS=y | ||||
| endif | ||||
|  | ||||
| ifeq ($(CONFIG_QCA_NSS_ECM_OVS),y) | ||||
|        FILES_EXAMPLES+=$(PKG_BUILD_DIR)/examples/ecm_ovs.ko | ||||
| endif | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm/Default | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Support | ||||
|   DEPENDS:=+TARGET_ipq806x:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq806x:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq807x:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq807x_64:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq807x:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq807x_64:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq60xx:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq60xx_64:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq50xx:kmod-qca-nss-drv \ | ||||
| 	+TARGET_ipq_ipq50xx_64:kmod-qca-nss-drv \ | ||||
| 	+iptables-mod-extra +kmod-ipt-conntrack \ | ||||
| 	+kmod-pppoe @!LINUX_3_18 \ | ||||
| 	+kmod-ipsec | ||||
|   TITLE:=QCA NSS Enhanced Connection Manager (ECM) | ||||
|   FILES:=$(PKG_BUILD_DIR)/*.ko $(FILES_EXAMPLES) | ||||
|   KCONFIG:=CONFIG_BRIDGE_NETFILTER=y \ | ||||
| 	CONFIG_NF_CONNTRACK_EVENTS=y \ | ||||
| 	CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y \ | ||||
| 	CONFIG_NF_CONNTRACK_DSCPREMARK_EXT=y | ||||
|   MENU:=1 | ||||
|   PROVIDES:=kmod-qca-nss-ecm | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm/Description/Default | ||||
| This package contains the QCA NSS Enhanced Connection Manager | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm/Default/install | ||||
| 	$(INSTALL_DIR) $(1)/etc/firewall.d $(1)/etc/init.d $(1)/usr/bin $(1)/lib/netifd/offload $(1)/etc/config $(1)/etc/uci-defaults $(1)/etc/sysctl.d | ||||
| 	$(INSTALL_DATA) ./files/qca-nss-ecm.firewall $(1)/etc/firewall.d/qca-nss-ecm | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-ecm.init $(1)/etc/init.d/qca-nss-ecm | ||||
| 	$(INSTALL_BIN) ./files/ecm_dump.sh $(1)/usr/bin/ | ||||
| 	$(INSTALL_BIN) ./files/on-demand-down $(1)/lib/netifd/offload/on-demand-down | ||||
| 	$(INSTALL_DATA) ./files/qca-nss-ecm.uci $(1)/etc/config/ecm | ||||
| 	$(INSTALL_DATA) ./files/qca-nss-ecm.defaults $(1)/etc/uci-defaults/99-qca-nss-ecm | ||||
| 	$(INSTALL_BIN) ./files/qca-nss-ecm.sysctl $(1)/etc/sysctl.d/qca-nss-ecm.conf | ||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),256) | ||||
| 	echo 'net.netfilter.nf_conntrack_max=2048' >> $(1)/etc/sysctl.d/qca-nss-ecm.conf | ||||
| endif | ||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512) | ||||
| 	echo 'net.netfilter.nf_conntrack_max=8192' >> $(1)/etc/sysctl.d/qca-nss-ecm.conf | ||||
| endif | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-standard | ||||
|   $(call KernelPackage/qca-nss-ecm/Default) | ||||
|   VARIANT:=standard | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-standard/Description | ||||
|   $(call KernelPackage/qca-nss-ecm/Description/Default) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-standard/install | ||||
| $(call KernelPackage/qca-nss-ecm/Default/install, $(1)) | ||||
| endef | ||||
|  | ||||
| # Variant with additional features enabled for premium profile | ||||
| define KernelPackage/qca-nss-ecm-premium/Default | ||||
| $(call KernelPackage/qca-nss-ecm/Default) | ||||
|   TITLE+= (with premium features) | ||||
|   VARIANT:=premium | ||||
|   DEPENDS+=+kmod-nat46 \ | ||||
| 	+kmod-l2tp +kmod-pppol2tp +kmod-pptp \ | ||||
| 	+kmod-bonding | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium/Description/Default | ||||
| $(call KernelPackage/qca-nss-ecm/Description/Default) | ||||
| with the premium features enabled | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium/Default/install | ||||
| $(call KernelPackage/qca-nss-ecm/install) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium | ||||
| $(call KernelPackage/qca-nss-ecm-premium/Default) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium/Description | ||||
| $(call KernelPackage/qca-nss-ecm-premium/Description/Default) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium/install | ||||
| $(call KernelPackage/qca-nss-ecm-standard/install, $(1)) | ||||
| endef | ||||
|  | ||||
| # Variant with additional features enabled for noload profile | ||||
| define KernelPackage/qca-nss-ecm-noload | ||||
|   $(call KernelPackage/qca-nss-ecm/Default) | ||||
|   TITLE+= (with noload features) | ||||
|   PROVIDES:=kmod-qca-nss-ecm | ||||
|   VARIANT:=noload | ||||
|   DEPENDS+=+kmod-l2tp +kmod-pppol2tp +kmod-pptp \ | ||||
| 	   +kmod-bonding | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-noload/Description | ||||
|   $(call KernelPackage/qca-nss-ecm/Description/Default) | ||||
|   When selected, this package installs the driver but does not load it at init. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-noload/install | ||||
| $(call KernelPackage/qca-nss-ecm/Default/install, $(1)) | ||||
| 	# | ||||
| 	# Remove the START line from the init script, so that the symlink | ||||
| 	# in the /etc/rc.d directory is not created. | ||||
| 	# | ||||
| 	sed -i '/START=/d' $(1)/etc/init.d/qca-nss-ecm | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium-noload | ||||
|   $(call KernelPackage/qca-nss-ecm-premium/Default) | ||||
|   PROVIDES:=kmod-qca-nss-ecm-premium | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium-noload/Description | ||||
|   $(call KernelPackage/qca-nss-ecm-premium/Description/Default) | ||||
|   When selected, this package installs the driver but does not load it at init. | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium-noload/install | ||||
| $(call KernelPackage/qca-nss-ecm-premium/Default/install, $(1)) | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev/qca-nss-ecm | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-ecm | ||||
| 	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-ecm/ | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	$(call Build/InstallDev/qca-nss-ecm,$(1)) | ||||
| endef | ||||
|  | ||||
| EXTRA_CFLAGS+= \ | ||||
| 	-I$(STAGING_DIR)/usr/include/hyfibr \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-mcs \ | ||||
| 	-I$(STAGING_DIR)/usr/include/qca-nss-drv \ | ||||
| 	-I$(STAGING_DIR)/usr/include/shortcut-fe \ | ||||
| 	-I$(STAGING_DIR)/usr/include/nat46 | ||||
|  | ||||
| ECM_MAKE_OPTS:=ECM_CLASSIFIER_HYFI_ENABLE=y | ||||
| ifneq ($(LOCAL_VARIANT),standard) | ||||
| ECM_MAKE_OPTS+=ECM_MULTICAST_ENABLE=y \ | ||||
| 		ECM_INTERFACE_IPSEC_ENABLE=y \ | ||||
| 		# ECM_INTERFACE_PPTP_ENABLE=y \ | ||||
| 		ECM_INTERFACE_L2TPV2_ENABLE=y \ | ||||
| 		ECM_INTERFACE_GRE_TAP_ENABLE=y \ | ||||
| 		ECM_INTERFACE_GRE_TUN_ENABLE=y \ | ||||
| 		ECM_INTERFACE_SIT_ENABLE=y \ | ||||
| 		ECM_INTERFACE_TUNIPIP6_ENABLE=y \ | ||||
| 		ECM_INTERFACE_RAWIP_ENABLE=y | ||||
|  | ||||
| ifeq ($(CONFIG_TARGET_ipq_ipq40xx)$(CONFIG_TARGET_ipq40xx),) | ||||
| ECM_MAKE_OPTS+=ECM_INTERFACE_BOND_ENABLE=y | ||||
| endif | ||||
| endif | ||||
|  | ||||
| ifeq ($(filter $(CONFIG_KERNEL_IPQ_MEM_PROFILE), 256),) | ||||
| ECM_MAKE_OPTS+=ECM_XFRM_ENABLE=y | ||||
| endif | ||||
|  | ||||
| # ifneq ($(CONFIG_PACKAGE_kmod-nat46),) | ||||
| # ECM_MAKE_OPTS+=ECM_INTERFACE_MAP_T_ENABLE=y | ||||
| # endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-link),) | ||||
| ECM_MAKE_OPTS+=ECM_INTERFACE_OVPN_ENABLE=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vxlanmgr),) | ||||
| ECM_MAKE_OPTS+=ECM_INTERFACE_VXLAN_ENABLE=y | ||||
| endif | ||||
|  | ||||
| ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),) | ||||
| ECM_MAKE_OPTS+=ECM_INTERFACE_OVS_BRIDGE_ENABLE=y \ | ||||
| 		ECM_CLASSIFIER_OVS_ENABLE=y | ||||
| EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-ovsmgr | ||||
| endif | ||||
|  | ||||
| # Keeping default as ipq806x for branches that does not have subtarget framework | ||||
| ifeq ($(CONFIG_TARGET_ipq),y) | ||||
| subtarget:=$(SUBTARGET) | ||||
| else | ||||
| subtarget:=$(CONFIG_TARGET_BOARD) | ||||
| endif | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	$(INSTALL_DIR) $(1)/usr/include/qca-nss-ecm | ||||
| 	$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-ecm | ||||
| endef | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(ECM_MAKE_OPTS)) \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(subtarget)" \ | ||||
| 		EXAMPLES_BUILD_PCC="$(CONFIG_QCA_NSS_ECM_EXAMPLES_PCC)" \ | ||||
| 		EXAMPLES_BUILD_MARK="$(CONFIG_QCA_NSS_ECM_EXAMPLES_MARK)" \ | ||||
| 		EXAMPLES_BUILD_OVS="$(CONFIG_QCA_NSS_ECM_OVS)" \ | ||||
| 		ECM_FRONT_END_SFE_ENABLE="$(CONFIG_QCA_ECM_SFE_SUPPORT)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-ecm-premium/config | ||||
| menu "ECM Configuration" | ||||
| 	config QCA_NSS_ECM_EXAMPLES_PCC | ||||
| 		bool "Build PCC usage example" | ||||
| 		help | ||||
| 			Selecting this will build the PCC classifier usage example module. | ||||
| 		default n | ||||
|  | ||||
| 	config QCA_NSS_ECM_EXAMPLES_MARK | ||||
| 		bool "Build Mark classifier usage example" | ||||
| 		help | ||||
| 			Selecting this will build the Mark classifier usage example module. | ||||
| 		default n | ||||
|  | ||||
| 	config QCA_NSS_ECM_OVS | ||||
| 		bool "Build OVS classifier external module" | ||||
| 		help | ||||
| 			Selecting this will build the OVS classifier external module. | ||||
| 		default n | ||||
|  | ||||
| 	config QCA_ECM_SFE_SUPPORT | ||||
| 		bool "Add SFE support to ECM driver" | ||||
| 		default n | ||||
| endmenu | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-ecm-noload)) | ||||
| $(eval $(call KernelPackage,qca-nss-ecm-standard)) | ||||
| $(eval $(call KernelPackage,qca-nss-ecm-premium-noload)) | ||||
| $(eval $(call KernelPackage,qca-nss-ecm-premium)) | ||||
							
								
								
									
										95
									
								
								package/qca/qca-nss-ecm/files/ecm_dump.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								package/qca/qca-nss-ecm/files/ecm_dump.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,95 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| # Copyright (c) 2015-2016, 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. | ||||
| # | ||||
|  | ||||
| ECM_MODULE=${1:-ecm_state} | ||||
| MOUNT_ROOT=/dev/ecm | ||||
|  | ||||
| # | ||||
| # usage: ecm_dump.sh [module=ecm_db] | ||||
| # | ||||
| # with no parameters, ecm_dump.sh will attempt to mount the | ||||
| # ecm_db state file and cat its contents. | ||||
| # | ||||
| # example with a parameter: ecm_dump.sh ecm_classifier_default | ||||
| # | ||||
| # this will cause ecm_dump to attempt to find and mount the state | ||||
| # file for the ecm_classifier_default module, and if successful | ||||
| # cat the contents. | ||||
| # | ||||
|  | ||||
| # this is one of the state files, which happens to be the | ||||
| # last module started in ecm | ||||
| ECM_STATE=/sys/kernel/debug/ecm/ecm_state/state_dev_major | ||||
|  | ||||
| # tests to see if ECM is up and ready to receive commands. | ||||
| # returns 0 if ECM is fully up and ready, else 1 | ||||
| ecm_is_ready() { | ||||
| 	if [ ! -e "${ECM_STATE}" ] | ||||
| 	then | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # | ||||
| # module_state_mount(module_name) | ||||
| #      Mounts the state file of the module, if supported | ||||
| # | ||||
| module_state_mount() { | ||||
| 	local module_name=$1 | ||||
| 	local mount_dir=$2 | ||||
| 	local state_file="/sys/kernel/debug/ecm/${module_name}/state_dev_major" | ||||
|  | ||||
| 	if [ -e "${mount_dir}/${module_name}" ] | ||||
| 	then | ||||
| 		# already mounted | ||||
| 		return 0 | ||||
| 	fi | ||||
|  | ||||
| 	#echo "Mount state file for $module_name ..." | ||||
| 	if [ ! -e "$state_file" ] | ||||
| 	then | ||||
| 		#echo "... $module_name does not support state" | ||||
| 		return 1 | ||||
| 	fi | ||||
|  | ||||
| 	local major="`cat $state_file`" | ||||
| 	#echo "... Mounting state $state_file with major: $major" | ||||
| 	mknod "${mount_dir}/${module_name}" c $major 0 | ||||
| } | ||||
|  | ||||
| # | ||||
| # main | ||||
| # | ||||
| ecm_is_ready || { | ||||
| 	#echo "ECM is not running" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| # all state files are mounted under MOUNT_ROOT, so make sure it exists | ||||
| mkdir -p ${MOUNT_ROOT} | ||||
|  | ||||
| # | ||||
| # attempt to mount state files for the requested module and cat it | ||||
| # if the mount succeeded | ||||
| # | ||||
| module_state_mount ${ECM_MODULE} ${MOUNT_ROOT} && { | ||||
| 	cat ${MOUNT_ROOT}/${ECM_MODULE} | ||||
| 	exit 0 | ||||
| } | ||||
|  | ||||
| exit 2 | ||||
							
								
								
									
										6
									
								
								package/qca/qca-nss-ecm/files/on-demand-down
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								package/qca/qca-nss-ecm/files/on-demand-down
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2016 The Linux Foundation. All rights reserved. | ||||
|  | ||||
| [ -e "/sys/kernel/debug/ecm/ecm_db/defunct_all" ] && { | ||||
| 	echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| } | ||||
							
								
								
									
										28
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.defaults
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.defaults
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| # Copyright (c) 2015-2016, 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. | ||||
| # | ||||
|  | ||||
| uci -q batch << EOF | ||||
| 	delete firewall.qcanssecm | ||||
| 	set firewall.qcanssecm=include | ||||
| 	set firewall.qcanssecm.type=script | ||||
| 	set firewall.qcanssecm.path=/etc/firewall.d/qca-nss-ecm | ||||
| 	set firewall.qcanssecm.family=any | ||||
| 	set firewall.qcanssecm.reload=1 | ||||
| 	commit firewall | ||||
| EOF | ||||
|  | ||||
| exit 0 | ||||
							
								
								
									
										18
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.firewall
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.firewall
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| # Copyright (c) 2015-2016, 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. | ||||
| # | ||||
|  | ||||
| iptables -A FORWARD -m physdev --physdev-is-bridged -j ACCEPT | ||||
							
								
								
									
										118
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| #!/bin/sh  /etc/rc.common | ||||
| # | ||||
| # Copyright (c) 2014, 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. | ||||
|  | ||||
| # The shebang above has an extra space intentially to avoid having | ||||
| # openwrt build scripts automatically enable this package starting | ||||
| # at boot. | ||||
|  | ||||
| START=19 | ||||
|  | ||||
| get_front_end_mode() { | ||||
| 	config_load "ecm" | ||||
| 	config_get front_end global acceleration_engine "auto" | ||||
|  | ||||
| 	case $front_end in | ||||
| 	auto) | ||||
| 		echo '0' | ||||
| 		;; | ||||
| 	nss) | ||||
| 		echo '1' | ||||
| 		;; | ||||
| 	sfe) | ||||
| 		echo '2' | ||||
| 		;; | ||||
| 	*) | ||||
| 		echo 'uci_option_acceleration_engine is invalid' | ||||
| 	esac | ||||
| } | ||||
|  | ||||
| support_bridge() { | ||||
| 	#NSS support bridge acceleration | ||||
| 	[ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && return 0 | ||||
| 	#SFE doesn't support bridge acceleration | ||||
| 	[ -d /sys/kernel/debug/ecm/ecm_sfe_ipv4 ] && return 1 | ||||
| } | ||||
|  | ||||
| load_sfe() { | ||||
| 	[ -d /sys/module/shortcut_fe ] || insmod shortcut-fe | ||||
| 	[ -d /sys/module/shortcut_fe_ipv6 ] || insmod shortcut-fe-ipv6 | ||||
| 	[ -d /sys/module/shortcut_fe_drv ] || insmod shortcut-fe-drv | ||||
| } | ||||
|  | ||||
| load_ecm() { | ||||
| 	[ -d /sys/module/ecm ] || { | ||||
| 		[ ! -e /proc/device-tree/MP_256 ] && load_sfe | ||||
| 		insmod ecm front_end_selection=$(get_front_end_mode) | ||||
| 	} | ||||
|  | ||||
| 	support_bridge && { | ||||
| 		sysctl -w net.bridge.bridge-nf-call-ip6tables=1 | ||||
| 		sysctl -w net.bridge.bridge-nf-call-iptables=1 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| unload_ecm() { | ||||
| 	sysctl -w net.bridge.bridge-nf-call-ip6tables=0 | ||||
| 	sysctl -w net.bridge.bridge-nf-call-iptables=0 | ||||
|  | ||||
| 	if [ -d /sys/module/ecm ]; then | ||||
| 		# | ||||
| 		# Stop ECM frontends | ||||
| 		# | ||||
| 		echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop | ||||
| 		echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop | ||||
|  | ||||
| 		# | ||||
| 		# Defunct the connections | ||||
| 		# | ||||
| 	        echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all | ||||
| 		sleep 5; | ||||
|  | ||||
| 		rmmod ecm | ||||
| 		sleep 1 | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| start() { | ||||
| 	load_ecm | ||||
|  | ||||
| 	# If the acceleration engine is NSS, enable wifi redirect. | ||||
| 	[ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && sysctl -w dev.nss.general.redirect=1 | ||||
|  | ||||
| 	support_bridge && { | ||||
| 		echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.d/qca-nss-ecm.conf | ||||
| 		echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.d/qca-nss-ecm.conf | ||||
| 	} | ||||
|  | ||||
| 	if [ -d /sys/module/qca_ovsmgr ]; then | ||||
| 		insmod ecm_ovs | ||||
| 	fi | ||||
|  | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| 	# If the acceleration engine is NSS, disable wifi redirect. | ||||
| 	[ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ] && sysctl -w dev.nss.general.redirect=0 | ||||
|  | ||||
| 	sed '/net.bridge.bridge-nf-call-ip6tables=1/d' -i /etc/sysctl.d/qca-nss-ecm.conf | ||||
| 	sed '/net.bridge.bridge-nf-call-iptables=1/d' -i /etc/sysctl.d/qca-nss-ecm.conf | ||||
|  | ||||
| 	if [ -d /sys/module/ecm_ovs ]; then | ||||
| 		rmmod ecm_ovs | ||||
| 	fi | ||||
|  | ||||
| 	unload_ecm | ||||
| } | ||||
							
								
								
									
										2
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.sysctl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.sysctl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| # nf_conntrack_tcp_no_window_check is 0 by default, set it to 1 | ||||
| net.netfilter.nf_conntrack_tcp_no_window_check=1 | ||||
							
								
								
									
										2
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.uci
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								package/qca/qca-nss-ecm/files/qca-nss-ecm.uci
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| config ecm 'global' | ||||
| 	option acceleration_engine 'auto' | ||||
							
								
								
									
										12
									
								
								package/qca/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								package/qca/qca-nss-ecm/patches/001-Drop_SFE_from_ecm.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -66,8 +66,7 @@ endif | ||||
|  # Define ECM_FRONT_END_SFE_ENABLE=y in order to select | ||||
|  # sfe as ECM's front end. | ||||
|  # ############################################################################# | ||||
| -ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx)) | ||||
| -ECM_FRONT_END_SFE_ENABLE=y | ||||
| +ifeq ($(ECM_FRONT_END_SFE_ENABLE), y) | ||||
|  ecm-$(ECM_FRONT_END_SFE_ENABLE) += frontends/sfe/ecm_sfe_ipv4.o | ||||
|  ecm-$(ECM_FRONT_END_SFE_ENABLE) += frontends/sfe/ecm_sfe_ported_ipv4.o | ||||
|  ccflags-$(ECM_FRONT_END_SFE_ENABLE) += -DECM_FRONT_END_SFE_ENABLE | ||||
							
								
								
									
										1276
									
								
								package/qca/qca-nss-ecm/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1276
									
								
								package/qca/qca-nss-ecm/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,60 @@ | ||||
| diff --git a/frontends/nss/ecm_nss_ipv4.c b/frontends/nss/ecm_nss_ipv4.c | ||||
| index 1ce4b61..29e70ba 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv4.c | ||||
| @@ -2171,6 +2171,10 @@ sync_conntrack: | ||||
|   | ||||
|  				timeouts = nf_ct_timeout_lookup(ct); | ||||
|   | ||||
| +				/* Copy of udp_get_timeouts in kernel */ | ||||
| +				if (!timeouts) | ||||
| +					timeouts = nf_udp_pernet(nf_ct_net(ct))->timeouts; | ||||
| + | ||||
|  				spin_lock_bh(&ct->lock); | ||||
|  				ct->timeout = jiffies + timeouts[UDP_CT_REPLIED]; | ||||
|  				spin_unlock_bh(&ct->lock); | ||||
| diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c | ||||
| index 2adc5ec..08253b6 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -1883,6 +1883,10 @@ sync_conntrack: | ||||
|   | ||||
|  				timeouts = nf_ct_timeout_lookup(ct); | ||||
|   | ||||
| +				/* Copy of udp_get_timeouts in kernel */ | ||||
| +				if (!timeouts) | ||||
| +					timeouts = nf_udp_pernet(nf_ct_net(ct))->timeouts; | ||||
| + | ||||
|  				spin_lock_bh(&ct->lock); | ||||
|  				ct->timeout = jiffies + timeouts[UDP_CT_REPLIED]; | ||||
|  				spin_unlock_bh(&ct->lock); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ipv4.c b/frontends/sfe/ecm_sfe_ipv4.c | ||||
| index 7cfe4fc..8f525ee 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ipv4.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv4.c | ||||
| @@ -1608,6 +1608,10 @@ sync_conntrack: | ||||
|   | ||||
|  				timeouts = nf_ct_timeout_lookup(ct); | ||||
|   | ||||
| +				/* Copy of udp_get_timeouts in kernel */ | ||||
| +				if (!timeouts) | ||||
| +					timeouts = nf_udp_pernet(nf_ct_net(ct))->timeouts; | ||||
| + | ||||
|  				spin_lock_bh(&ct->lock); | ||||
|  				ct->timeout = jiffies + timeouts[UDP_CT_REPLIED]; | ||||
|  				spin_unlock_bh(&ct->lock); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ipv6.c b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| index dfde309..47c531a 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| @@ -1321,6 +1321,10 @@ sync_conntrack: | ||||
|   | ||||
|  				timeouts = nf_ct_timeout_lookup(ct); | ||||
|   | ||||
| +				/* Copy of udp_get_timeouts in kernel */ | ||||
| +				if (!timeouts) | ||||
| +					timeouts = nf_udp_pernet(nf_ct_net(ct))->timeouts; | ||||
| + | ||||
|  				spin_lock_bh(&ct->lock); | ||||
|  				ct->timeout = jiffies + timeouts[UDP_CT_REPLIED]; | ||||
|  				spin_unlock_bh(&ct->lock); | ||||
							
								
								
									
										44
									
								
								package/qca/qca-nss-ecm/patches/200-resolve-high-load.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								package/qca/qca-nss-ecm/patches/200-resolve-high-load.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| The sync update work queue tasks is calling uninterruptible sleep function, which is | ||||
| causing high CPU load.  Changed to interruptible sleep function.  The stats update | ||||
| task should be interruptible. | ||||
|  | ||||
| --- a/frontends/nss/ecm_nss_ipv4.c | ||||
| +++ b.frontends/nss/ecm_nss_ipv4.c | ||||
| @@ -2411,7 +2411,7 @@ static void ecm_nss_ipv4_stats_sync_req_ | ||||
|  	} | ||||
|  	spin_unlock_bh(&ecm_nss_ipv4_lock); | ||||
|   | ||||
| -	usleep_range(ECM_NSS_IPV4_STATS_SYNC_UDELAY - 100, ECM_NSS_IPV4_STATS_SYNC_UDELAY); | ||||
| +	msleep_interruptible(ECM_NSS_IPV4_STATS_SYNC_UDELAY / 1000); | ||||
|   | ||||
|  	/* | ||||
|  	 * If index is 0, we are starting a new round, but if we still have time remain | ||||
| @@ -2425,7 +2425,7 @@ static void ecm_nss_ipv4_stats_sync_req_ | ||||
|  		} | ||||
|   | ||||
|  		if (ecm_nss_ipv4_next_req_time > current_jiffies) { | ||||
| -			msleep(jiffies_to_msecs(ecm_nss_ipv4_next_req_time - current_jiffies)); | ||||
| +			msleep_interruptible(jiffies_to_msecs(ecm_nss_ipv4_next_req_time - current_jiffies)); | ||||
|  		} | ||||
|  		ecm_nss_ipv4_roll_check_jiffies = jiffies; | ||||
|  		ecm_nss_ipv4_next_req_time = ecm_nss_ipv4_roll_check_jiffies + ECM_NSS_IPV4_STATS_SYNC_PERIOD; | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b.frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -2128,7 +2128,7 @@ static void ecm_nss_ipv6_stats_sync_req_ | ||||
|  	} | ||||
|  	spin_unlock_bh(&ecm_nss_ipv6_lock); | ||||
|   | ||||
| -	usleep_range(ECM_NSS_IPV6_STATS_SYNC_UDELAY - 100, ECM_NSS_IPV6_STATS_SYNC_UDELAY); | ||||
| +	msleep_interruptible(ECM_NSS_IPV6_STATS_SYNC_UDELAY / 1000); | ||||
|   | ||||
|  	/* | ||||
|  	 * If index is 0, we are starting a new round, but if we still have time remain | ||||
| @@ -2142,7 +2142,7 @@ static void ecm_nss_ipv6_stats_sync_req_ | ||||
|  		} | ||||
|   | ||||
|  		if (ecm_nss_ipv6_next_req_time > current_jiffies) { | ||||
| -			msleep(jiffies_to_msecs(ecm_nss_ipv6_next_req_time - current_jiffies)); | ||||
| +			msleep_interruptible(jiffies_to_msecs(ecm_nss_ipv6_next_req_time - current_jiffies)); | ||||
|  		} | ||||
|  		ecm_nss_ipv6_roll_check_jiffies = jiffies; | ||||
|  		ecm_nss_ipv6_next_req_time = ecm_nss_ipv6_roll_check_jiffies + ECM_NSS_IPV6_STATS_SYNC_PERIOD; | ||||
| @@ -0,0 +1,20 @@ | ||||
| --- a/ecm_conntrack_notifier.c | ||||
| +++ b/ecm_conntrack_notifier.c | ||||
| @@ -411,7 +411,7 @@ int ecm_conntrack_notifier_init(struct d | ||||
|  	/* | ||||
|  	 * Eventing subsystem is available so we register a notifier hook to get fast notifications of expired connections | ||||
|  	 */ | ||||
| -	result = nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier); | ||||
| +	result = nf_conntrack_register_chain_notifier(&init_net, &ecm_conntrack_notifier); | ||||
|  	if (result < 0) { | ||||
|  		DEBUG_ERROR("Can't register nf notifier hook.\n"); | ||||
|  		debugfs_remove_recursive(ecm_conntrack_notifier_dentry); | ||||
| @@ -430,7 +430,7 @@ void ecm_conntrack_notifier_exit(void) | ||||
|  { | ||||
|  	DEBUG_INFO("ECM Conntrack Notifier exit\n"); | ||||
|  #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||||
| -	nf_conntrack_unregister_notifier(&init_net, &ecm_conntrack_notifier); | ||||
| +	nf_conntrack_unregister_chain_notifier(&init_net, &ecm_conntrack_notifier); | ||||
|  #endif | ||||
|  	/* | ||||
|  	 * Remove the debugfs files recursively. | ||||
| @@ -0,0 +1,236 @@ | ||||
| From 90cace88a342e77ee8ca1e961cf7b7a7930d4c89 Mon Sep 17 00:00:00 2001 | ||||
| From: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Date: Mon, 9 Mar 2020 12:51:03 -0700 | ||||
| Subject: [qca-nss-ecm] Check TCP/UDP conntrack state earlier | ||||
|  | ||||
| Check the conntrack state before processing the flow | ||||
| and adding it to the database. The unconfirmed | ||||
| connections can be changed after the confirmation. | ||||
|  | ||||
| Changed the TCP tracker connection state matrix to set the | ||||
| state of the connection as ESTABLISHED when any of the src or | ||||
| dest side is set as ESTABLISHED. With this change ECM will not | ||||
| handle the SYN and SYN-ACK packets of the TCP handshake. Only the | ||||
| ACK and FIN flaged packets will be used during the creation and | ||||
| closing the connection respectively. | ||||
|  | ||||
| Signed-off-by: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Change-Id: I3e0a58d604df4c6a85478ca9c05f24d50cd8c894 | ||||
| --- | ||||
|  ecm_classifier_default.c            | 36 ++++++++---------------------------- | ||||
|  ecm_tracker_tcp.c                   |  4 ++-- | ||||
|  frontends/nss/ecm_nss_ported_ipv4.c | 17 +++++++++++++++++ | ||||
|  frontends/nss/ecm_nss_ported_ipv6.c | 17 +++++++++++++++++ | ||||
|  frontends/sfe/ecm_sfe_ported_ipv4.c | 17 +++++++++++++++++ | ||||
|  frontends/sfe/ecm_sfe_ported_ipv6.c | 17 +++++++++++++++++ | ||||
|  6 files changed, 78 insertions(+), 30 deletions(-) | ||||
|  | ||||
| diff --git a/ecm_classifier_default.c b/ecm_classifier_default.c | ||||
| index 22c4bec..d04cdfa 100644 | ||||
| --- a/ecm_classifier_default.c | ||||
| +++ b/ecm_classifier_default.c | ||||
| @@ -1,6 +1,6 @@ | ||||
|  /* | ||||
|   ************************************************************************** | ||||
| - * Copyright (c) 2014-2016, The Linux Foundation.  All rights reserved. | ||||
| + * Copyright (c) 2014-2016, 2020, The Linux Foundation.  All rights reserved. | ||||
|   * Permission to use, copy, modify, and/or distribute this software for | ||||
|   * any purpose with or without fee is hereby granted, provided that the | ||||
|   * above copyright notice and this permission notice appear in all copies. | ||||
| @@ -285,12 +285,12 @@ static void ecm_classifier_default_process(struct ecm_classifier_instance *aci, | ||||
|  	} | ||||
|   | ||||
|  	/* | ||||
| -	 * Check the TCP connection state. | ||||
| +	 * Check the TCP connection state, when the ct is NULL. | ||||
| +	 * ct valid case was already checked in the ecm_nss{sfe}_ported_ipv4{6}_process functions. | ||||
|  	 * If we are not established then we deny acceleration. | ||||
| -	 * Take lead from conntrack if exists. | ||||
|  	 */ | ||||
|  	ct = nf_ct_get(skb, &ctinfo); | ||||
| -	if (ct == NULL) { | ||||
| +	if (!ct) { | ||||
|  		DEBUG_TRACE("%p: No Conntrack found for packet, using ECM tracker state\n", cdii); | ||||
|  		if (unlikely(prevailing_state != ECM_TRACKER_CONNECTION_STATE_ESTABLISHED)) { | ||||
|  			cdii->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO; | ||||
| @@ -298,29 +298,10 @@ static void ecm_classifier_default_process(struct ecm_classifier_instance *aci, | ||||
|  		} | ||||
|  	} else { | ||||
|  		/* | ||||
| -		 * Unconfirmed connection may be dropped by Linux at the final step, | ||||
| -		 * So we don't allow acceleration for the unconfirmed connections. | ||||
| -		 */ | ||||
| -		if (!nf_ct_is_confirmed(ct)) { | ||||
| -			DEBUG_TRACE("%p: Unconfirmed connection\n", ct); | ||||
| -			cdii->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO; | ||||
| -			goto return_response; | ||||
| -		} | ||||
| - | ||||
| -		/* | ||||
| -		 * Don't try to manage a non-established connection. | ||||
| -		 */ | ||||
| -		if (!test_bit(IPS_ASSURED_BIT, &ct->status)) { | ||||
| -			DEBUG_TRACE("%p: Non-established connection\n", ct); | ||||
| -			cdii->process_response.accel_mode = ECM_CLASSIFIER_ACCELERATION_MODE_NO; | ||||
| -			goto return_response; | ||||
| -		} | ||||
| - | ||||
| -		/* | ||||
| -		 * If the connection is shutting down do not manage it. | ||||
| -		 * state can not be SYN_SENT, SYN_RECV because connection is assured | ||||
| -		 * Not managed states: FIN_WAIT, CLOSE_WAIT, LAST_ACK, TIME_WAIT, CLOSE. | ||||
| -		 */ | ||||
| +		* If the connection is shutting down do not manage it. | ||||
| +		* state can not be SYN_SENT, SYN_RECV because connection is assured | ||||
| +		* Not managed states: FIN_WAIT, CLOSE_WAIT, LAST_ACK, TIME_WAIT, CLOSE. | ||||
| +		*/ | ||||
|  		spin_lock_bh(&ct->lock); | ||||
|  		if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED) { | ||||
|  			spin_unlock_bh(&ct->lock); | ||||
| @@ -333,7 +314,6 @@ static void ecm_classifier_default_process(struct ecm_classifier_instance *aci, | ||||
|   | ||||
|  return_response: | ||||
|  	; | ||||
| - | ||||
|  	/* | ||||
|  	 * Return the process response | ||||
|  	 */ | ||||
| diff --git a/ecm_tracker_tcp.c b/ecm_tracker_tcp.c | ||||
| index f073c36..e5b327a 100644 | ||||
| --- a/ecm_tracker_tcp.c | ||||
| +++ b/ecm_tracker_tcp.c | ||||
| @@ -257,9 +257,9 @@ static  DEFINE_SPINLOCK(ecm_tracker_tcp_lock);	/* Global lock for the tracker gl | ||||
|   */ | ||||
|  static ecm_tracker_connection_state_t ecm_tracker_tcp_connection_state_matrix[ECM_TRACKER_SENDER_STATE_MAX][ECM_TRACKER_SENDER_STATE_MAX] = | ||||
|  {	/* 			Unknown						Establishing					Established					Closing					Closed					Fault */ | ||||
| -	/* Unknown */		{ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
| +	/* Unknown */		{ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHED,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
|  	/* Establishing */	{ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
| -	/* Established */	{ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHED,	ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
| +	/* Established */	{ECM_TRACKER_CONNECTION_STATE_ESTABLISHED,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHING,	ECM_TRACKER_CONNECTION_STATE_ESTABLISHED,	ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
|  	/* Closing */		{ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_CLOSING,		ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
|  	/* Closed */		{ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_CLOSING,		ECM_TRACKER_CONNECTION_STATE_CLOSING,	ECM_TRACKER_CONNECTION_STATE_CLOSED, 	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
|  	/* Fault */		{ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_FAULT,		ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT,	ECM_TRACKER_CONNECTION_STATE_FAULT}, | ||||
| diff --git a/frontends/nss/ecm_nss_ported_ipv4.c b/frontends/nss/ecm_nss_ported_ipv4.c | ||||
| index 1435ec0..34c056f 100644 | ||||
| --- a/frontends/nss/ecm_nss_ported_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ported_ipv4.c | ||||
| @@ -2002,8 +2002,25 @@ unsigned int ecm_nss_ported_ipv4_process(struct net_device *out_dev, struct net_ | ||||
|  	int protocol = (int)orig_tuple->dst.protonum; | ||||
|  	__be16 *layer4hdr = NULL; | ||||
|   | ||||
| +	/* | ||||
| +	 * Unconfirmed connection may be dropped by Linux at the final step, | ||||
| +	 * So we don't allow acceleration for the unconfirmed connections. | ||||
| +	 */ | ||||
| +	if (likely(ct) && !nf_ct_is_confirmed(ct)) { | ||||
| +		DEBUG_WARN("%p: Unconfirmed connection\n", ct); | ||||
| +		return NF_ACCEPT; | ||||
| +	} | ||||
| + | ||||
|  	if (protocol == IPPROTO_TCP) { | ||||
|  		/* | ||||
| +		 * Don't try to manage a non-established connection. | ||||
| +		 */ | ||||
| +		if (likely(ct) && !test_bit(IPS_ASSURED_BIT, &ct->status)) { | ||||
| +			DEBUG_WARN("%p: Non-established TCP connection\n", ct); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| + | ||||
| +		/* | ||||
|  		 * Extract TCP header to obtain port information | ||||
|  		 */ | ||||
|  		tcp_hdr = ecm_tracker_tcp_check_header_and_read(skb, iph, &tcp_hdr_buff); | ||||
| diff --git a/frontends/nss/ecm_nss_ported_ipv6.c b/frontends/nss/ecm_nss_ported_ipv6.c | ||||
| index 4c154a6..bd6349b 100644 | ||||
| --- a/frontends/nss/ecm_nss_ported_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ported_ipv6.c | ||||
| @@ -1914,8 +1914,25 @@ unsigned int ecm_nss_ported_ipv6_process(struct net_device *out_dev, | ||||
|  	int protocol = (int)orig_tuple->dst.protonum; | ||||
|  	__be16 *layer4hdr = NULL; | ||||
|   | ||||
| +	/* | ||||
| +	 * Unconfirmed connection may be dropped by Linux at the final step, | ||||
| +	 * So we don't allow acceleration for the unconfirmed connections. | ||||
| +	 */ | ||||
| +	if (likely(ct) && !nf_ct_is_confirmed(ct)) { | ||||
| +		DEBUG_WARN("%p: Unconfirmed connection\n", ct); | ||||
| +		return NF_ACCEPT; | ||||
| +	} | ||||
| + | ||||
|  	if (protocol == IPPROTO_TCP) { | ||||
|  		/* | ||||
| +		 * Don't try to manage a non-established connection. | ||||
| +		 */ | ||||
| +		if (likely(ct) && !test_bit(IPS_ASSURED_BIT, &ct->status)) { | ||||
| +			DEBUG_WARN("%p: Non-established TCP connection\n", ct); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| + | ||||
| +		/* | ||||
|  		 * Extract TCP header to obtain port information | ||||
|  		 */ | ||||
|  		tcp_hdr = ecm_tracker_tcp_check_header_and_read(skb, iph, &tcp_hdr_buff); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ported_ipv4.c b/frontends/sfe/ecm_sfe_ported_ipv4.c | ||||
| index e034cde..df1ce57 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ported_ipv4.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ported_ipv4.c | ||||
| @@ -1805,8 +1805,25 @@ unsigned int ecm_sfe_ported_ipv4_process(struct net_device *out_dev, struct net_ | ||||
|  	int protocol = (int)orig_tuple->dst.protonum; | ||||
|  	__be16 *layer4hdr = NULL; | ||||
|   | ||||
| +	/* | ||||
| +	 * Unconfirmed connection may be dropped by Linux at the final step, | ||||
| +	 * So we don't allow acceleration for the unconfirmed connections. | ||||
| +	 */ | ||||
| +	if (likely(ct) && !nf_ct_is_confirmed(ct)) { | ||||
| +		DEBUG_WARN("%p: Unconfirmed connection\n", ct); | ||||
| +		return NF_ACCEPT; | ||||
| +	} | ||||
| + | ||||
|  	if (protocol == IPPROTO_TCP) { | ||||
|  		/* | ||||
| +		 * Don't try to manage a non-established connection. | ||||
| +		 */ | ||||
| +		if (likely(ct) && !test_bit(IPS_ASSURED_BIT, &ct->status)) { | ||||
| +			DEBUG_WARN("%p: Non-established TCP connection\n", ct); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| + | ||||
| +		/* | ||||
|  		 * Extract TCP header to obtain port information | ||||
|  		 */ | ||||
|  		tcp_hdr = ecm_tracker_tcp_check_header_and_read(skb, iph, &tcp_hdr_buff); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ported_ipv6.c b/frontends/sfe/ecm_sfe_ported_ipv6.c | ||||
| index 6ac05ad..657a1c7 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ported_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ported_ipv6.c | ||||
| @@ -1746,8 +1746,25 @@ unsigned int ecm_sfe_ported_ipv6_process(struct net_device *out_dev, | ||||
|  	int protocol = (int)orig_tuple->dst.protonum; | ||||
|  	__be16 *layer4hdr = NULL; | ||||
|   | ||||
| +	/* | ||||
| +	 * Unconfirmed connection may be dropped by Linux at the final step, | ||||
| +	 * So we don't allow acceleration for the unconfirmed connections. | ||||
| +	 */ | ||||
| +	if (likely(ct) && !nf_ct_is_confirmed(ct)) { | ||||
| +		DEBUG_WARN("%p: Unconfirmed connection\n", ct); | ||||
| +		return NF_ACCEPT; | ||||
| +	} | ||||
| + | ||||
|  	if (protocol == IPPROTO_TCP) { | ||||
|  		/* | ||||
| +		 * Don't try to manage a non-established connection. | ||||
| +		 */ | ||||
| +		if (likely(ct) && !test_bit(IPS_ASSURED_BIT, &ct->status)) { | ||||
| +			DEBUG_WARN("%p: Non-established TCP connection\n", ct); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| + | ||||
| +		/* | ||||
|  		 * Extract TCP header to obtain port information | ||||
|  		 */ | ||||
|  		tcp_hdr = ecm_tracker_tcp_check_header_and_read(skb, iph, &tcp_hdr_buff); | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,52 @@ | ||||
| From 9ad19ffdcfdf77baf3abd4fcc933fd3dc8e791a5 Mon Sep 17 00:00:00 2001 | ||||
| From: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Date: Sat, 20 Jun 2020 09:41:01 -0700 | ||||
| Subject: [qca-nss-ecm] Fix NSS stats request roll over issue | ||||
|  | ||||
| Use the correct timer API to check the next request time | ||||
| when jiffies wrap happens. | ||||
|  | ||||
| Signed-off-by: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Change-Id: I18646d28df7e17daeff2986dfe4bd73866d47668 | ||||
| --- | ||||
|  frontends/nss/ecm_nss_ipv4.c | 4 ++-- | ||||
|  frontends/nss/ecm_nss_ipv6.c | 4 ++-- | ||||
|  2 files changed, 4 insertions(+), 4 deletions(-) | ||||
|  | ||||
| diff --git a/frontends/nss/ecm_nss_ipv4.c b/frontends/nss/ecm_nss_ipv4.c | ||||
| index 3eaf5d8..80e1aee 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv4.c | ||||
| @@ -2421,10 +2421,10 @@ static void ecm_nss_ipv4_stats_sync_req_work(struct work_struct *work) | ||||
|  		current_jiffies = jiffies; | ||||
|   | ||||
|  		if (time_is_after_jiffies(ecm_nss_ipv4_roll_check_jiffies))  { | ||||
| -			ecm_nss_ipv4_next_req_time = 0; | ||||
| +			ecm_nss_ipv4_next_req_time = jiffies + ECM_NSS_IPV4_STATS_SYNC_PERIOD; | ||||
|  		} | ||||
|   | ||||
| -		if (ecm_nss_ipv4_next_req_time > current_jiffies) { | ||||
| +		if (time_after(ecm_nss_ipv4_next_req_time, current_jiffies)) { | ||||
|  			msleep_interruptible(jiffies_to_msecs(ecm_nss_ipv4_next_req_time - current_jiffies)); | ||||
|  		} | ||||
|  		ecm_nss_ipv4_roll_check_jiffies = jiffies; | ||||
| diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c | ||||
| index 288dc55..483421e 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -2135,10 +2135,10 @@ static void ecm_nss_ipv6_stats_sync_req_work(struct work_struct *work) | ||||
|  		current_jiffies = jiffies; | ||||
|   | ||||
|  		if (time_is_after_jiffies(ecm_nss_ipv6_roll_check_jiffies))  { | ||||
| -			ecm_nss_ipv6_next_req_time = 0; | ||||
| +			ecm_nss_ipv6_next_req_time = jiffies + ECM_NSS_IPV6_STATS_SYNC_PERIOD; | ||||
|  		} | ||||
|   | ||||
| -		if (ecm_nss_ipv6_next_req_time > current_jiffies) { | ||||
| +		if (time_after(ecm_nss_ipv6_next_req_time, current_jiffies)) { | ||||
|  			msleep_interruptible(jiffies_to_msecs(ecm_nss_ipv6_next_req_time - current_jiffies)); | ||||
|  		} | ||||
|  		ecm_nss_ipv6_roll_check_jiffies = jiffies; | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,112 @@ | ||||
| From 4b41703a181b7187d9ff8cb744eb96d09997387c Mon Sep 17 00:00:00 2001 | ||||
| From: Suman Ghosh <sumaghos@codeaurora.org> | ||||
| Date: Wed, 19 Feb 2020 15:09:19 +0530 | ||||
| Subject: [qca-nss-ecm] Fix for ref leak during multicast 'to' hierarchy | ||||
|  creation | ||||
|  | ||||
| Change-Id: I89df9dbe5ea054cf3b87d55ce68a751cb1d6c24f | ||||
| Signed-off-by: Suman Ghosh <sumaghos@codeaurora.org> | ||||
| --- | ||||
|  ecm_interface.c | 34 ++++++++++++++++++++++++++++++---- | ||||
|  1 file changed, 30 insertions(+), 4 deletions(-) | ||||
|  | ||||
| diff --git a/ecm_interface.c b/ecm_interface.c | ||||
| index 4f7a886..2a0ca5b 100644 | ||||
| --- a/ecm_interface.c | ||||
| +++ b/ecm_interface.c | ||||
| @@ -3885,13 +3885,13 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  		dest_dev = dev_get_by_index(&init_net, *dst_if_index); | ||||
|  		if (!dest_dev) { | ||||
|  			if (!src_dev_is_bridge) { | ||||
| -				int i; | ||||
| - | ||||
|  				/* | ||||
|  				 * If already constructed any interface heirarchies before hitting | ||||
|  				 * this error condition then Deref all interface heirarchies. | ||||
|  				 */ | ||||
|  				if (valid_if > 0) { | ||||
| +					int i; | ||||
| + | ||||
|  					for (i = 0; i < valid_if; i++) { | ||||
|  						ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
|  						ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| @@ -3902,11 +3902,14 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  				/* | ||||
|  				 * If valid netdev not found, Return 0 | ||||
|  				 */ | ||||
| +				if (br_dev_src) { | ||||
| +					dev_put(br_dev_src); | ||||
| +				} | ||||
| + | ||||
|  				return 0; | ||||
|  			} | ||||
|   | ||||
|  			dest_dev = br_dev_src; | ||||
| - | ||||
|  		} | ||||
|   | ||||
|  		dest_dev_type = dest_dev->type; | ||||
| @@ -3945,6 +3948,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  					} | ||||
|  				} | ||||
|   | ||||
| +				if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| +					dev_put(br_dev_src); | ||||
| +				} | ||||
| + | ||||
|  				dev_put(dest_dev); | ||||
|  				return 0; | ||||
|  			} | ||||
| @@ -3972,6 +3979,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  						ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
|  					} | ||||
|   | ||||
| +					if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| +						dev_put(br_dev_src); | ||||
| +					} | ||||
| + | ||||
|  					dev_put(dest_dev); | ||||
|  					dev_put(mc_br_slave_dev); | ||||
|  					return 0; | ||||
| @@ -3997,6 +4008,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  						} | ||||
|  					} | ||||
|   | ||||
| +					if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| +						dev_put(br_dev_src); | ||||
| +					} | ||||
| + | ||||
|  					dev_put(dest_dev); | ||||
|  					dev_put(mc_br_slave_dev); | ||||
|  					return 0; | ||||
| @@ -4032,6 +4047,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  					} | ||||
|  				} | ||||
|   | ||||
| +				if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| +					dev_put(br_dev_src); | ||||
| +				} | ||||
| + | ||||
|  				dev_put(dest_dev); | ||||
|  				return 0; | ||||
|  			} | ||||
| @@ -4042,8 +4061,15 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  			valid_if++; | ||||
|  		} | ||||
|   | ||||
| -		dev_put(dest_dev); | ||||
| +		if (dest_dev != br_dev_src) { | ||||
| +			dev_put(dest_dev); | ||||
| +		} | ||||
|  	} | ||||
| + | ||||
| +	if (br_dev_src) { | ||||
| +		dev_put(br_dev_src); | ||||
| +	} | ||||
| + | ||||
|  	return total_ii_count; | ||||
|  } | ||||
|  EXPORT_SYMBOL(ecm_interface_multicast_heirarchy_construct_routed); | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,33 @@ | ||||
| From 72e3ae508906553e7bc982bf3c0d99bb1cbe9008 Mon Sep 17 00:00:00 2001 | ||||
| From: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Date: Wed, 20 Nov 2019 16:23:06 -0800 | ||||
| Subject: [qca-nss-ecm] Fix neighbour solicitation send function. | ||||
|  | ||||
| dst_ops->neigh_lookup function pointer is set to the | ||||
| ip6_neigh_lookup function. This function returns an | ||||
| error pointer with the ERR_PTR() macro. So, we should | ||||
| check the return value of this function pointer with | ||||
| the IS_ERR() macro. | ||||
|  | ||||
| Change-Id: I188a6e53278faaa68f1854524f612efc1f7451fe | ||||
| Signed-off-by: Murat Sezgin <msezgin@codeaurora.org> | ||||
| --- | ||||
|  ecm_interface.c | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
|  | ||||
| diff --git a/ecm_interface.c b/ecm_interface.c | ||||
| index 3f8554b..36509f0 100644 | ||||
| --- a/ecm_interface.c | ||||
| +++ b/ecm_interface.c | ||||
| @@ -1100,7 +1100,7 @@ void ecm_interface_send_neighbour_solicitation(struct net_device *dev, ip_addr_t | ||||
|  #else | ||||
|  	neigh = rt6i->dst.ops->neigh_lookup(&rt6i->dst, NULL, &dst_addr); | ||||
|  #endif | ||||
| -	if (neigh == NULL) { | ||||
| +	if (IS_ERR(neigh)) { | ||||
|  		DEBUG_TRACE("Neighbour lookup failure for destination IPv6 address " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr)); | ||||
|  		dst_release(&rt6i->dst); | ||||
|  		return; | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,260 @@ | ||||
| From 7c0610828b835b2aab96dd50ec841a3a28689112 Mon Sep 17 00:00:00 2001 | ||||
| From: Suman Ghosh <sumaghos@codeaurora.org> | ||||
| Date: Mon, 16 Mar 2020 15:22:18 +0530 | ||||
| Subject: [qca-nss-ecm] Reference leak during multicast + PPPoE bridge | ||||
|  | ||||
| Signed-off-by: Suman Ghosh <sumaghos@codeaurora.org> | ||||
| Change-Id: I4472035f1bbb087e637169762ae2648c0fda792a | ||||
| --- | ||||
|  ecm_interface.c | 136 +++++++++++++++++++++++++------------------------------- | ||||
|  1 file changed, 60 insertions(+), 76 deletions(-) | ||||
|  | ||||
| diff --git a/ecm_interface.c b/ecm_interface.c | ||||
| index 1614336..c0d2357 100644 | ||||
| --- a/ecm_interface.c | ||||
| +++ b/ecm_interface.c | ||||
| @@ -3796,6 +3796,25 @@ fail: | ||||
|  } | ||||
|   | ||||
|  /* | ||||
| + * ecm_interface_hierarchy_delete() | ||||
| + * 	Delete hierarchy of the requested interfaces. | ||||
| + */ | ||||
| +static inline void ecm_interface_hierarchy_delete(struct ecm_db_iface_instance *interfaces, | ||||
| +							uint32_t *interface_first_base, | ||||
| +							int valid_if) | ||||
| +{ | ||||
| +	struct ecm_db_iface_instance *to_list_single[ECM_DB_IFACE_HEIRARCHY_MAX]; | ||||
| +	struct ecm_db_iface_instance *ifaces; | ||||
| +	int i; | ||||
| + | ||||
| +	for (i = 0; i < valid_if; i++) { | ||||
| +		ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| +		ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| +		ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| +	} | ||||
| +} | ||||
| + | ||||
| +/* | ||||
|   * ecm_interface_multicast_heirarchy_construct_routed() | ||||
|   * 	Create destination interface heirarchy for a routed multicast connectiona | ||||
|   * | ||||
| @@ -3816,7 +3835,6 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  								uint32_t *interface_first_base, bool mfc_update, | ||||
|  								__be16 *layer4hdr, struct sk_buff *skb) | ||||
|  { | ||||
| -	struct ecm_db_iface_instance *to_list_single[ECM_DB_IFACE_HEIRARCHY_MAX]; | ||||
|  	struct ecm_db_iface_instance *ifaces; | ||||
|  	struct net_device *dest_dev = NULL; | ||||
|  	struct net_device *br_dev_src = NULL; | ||||
| @@ -3829,7 +3847,7 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  	int if_index; | ||||
|  	int ii_cnt; | ||||
|  	int total_ii_count = 0; | ||||
| -	bool src_dev_is_bridge = false; | ||||
| +	bool src_dev_is_bridge = false, dest_dev_is_br_dev_src = false; | ||||
|   | ||||
|  	DEBUG_TRACE("Construct interface heirarchy for dest_addr: " ECM_IP_ADDR_DOT_FMT " src_addr: " ECM_IP_ADDR_DOT_FMT "total destination ifs %d\n", | ||||
|  			ECM_IP_ADDR_TO_DOT(packet_dest_addr), ECM_IP_ADDR_TO_DOT(packet_src_addr), max_if); | ||||
| @@ -3876,6 +3894,7 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  			continue; | ||||
|  		} | ||||
|   | ||||
| +		dest_dev_is_br_dev_src = false; | ||||
|  		dest_dev = dev_get_by_index(&init_net, *dst_if_index); | ||||
|  		if (!dest_dev) { | ||||
|  			if (!src_dev_is_bridge) { | ||||
| @@ -3884,26 +3903,23 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  				 * this error condition then Deref all interface heirarchies. | ||||
|  				 */ | ||||
|  				if (valid_if > 0) { | ||||
| -					int i; | ||||
| - | ||||
| -					for (i = 0; i < valid_if; i++) { | ||||
| -						ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| -						ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| -						ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| -					} | ||||
| +					ecm_interface_hierarchy_delete(interfaces, interface_first_base, valid_if); | ||||
|  				} | ||||
|   | ||||
| -				/* | ||||
| -				 * If valid netdev not found, Return 0 | ||||
| -				 */ | ||||
| -				if (br_dev_src) { | ||||
| -					dev_put(br_dev_src); | ||||
| -				} | ||||
| - | ||||
| -				return 0; | ||||
| +				goto fail1; | ||||
|  			} | ||||
|   | ||||
|  			dest_dev = br_dev_src; | ||||
| + | ||||
| +			/* | ||||
| +			 * In some cases when WAN interface is added to bridge and traffic is downstream, | ||||
| +			 * the bridge device is part of the destination list from MFC, and at the same time | ||||
| +			 * 'src_dev_is_bridge' will be true as well. In such cases we will need to release | ||||
| +			 * the hold on the bridge device separately for dest_dev and br_dev_src. | ||||
| +			 * Setting this flag to true indicates that this is not the case, | ||||
| +			 * and that releasing the hold once is enough | ||||
| +			 */ | ||||
| +			dest_dev_is_br_dev_src = true; | ||||
|  		} | ||||
|   | ||||
|  		dest_dev_type = dest_dev->type; | ||||
| @@ -3927,7 +3943,6 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  			} | ||||
|   | ||||
|  			if ((if_num < 0) || (if_num > ECM_DB_MULTICAST_IF_MAX)) { | ||||
| -				int i; | ||||
|  				DEBUG_WARN("MCS is not ready\n"); | ||||
|   | ||||
|  				/* | ||||
| @@ -3935,19 +3950,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  				 * this error condition then Deref all interface heirarchies. | ||||
|  				 */ | ||||
|  				if (valid_if > 0) { | ||||
| -					for (i = 0; i < valid_if; i++) { | ||||
| -						ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| -						ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| -						ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| -					} | ||||
| +					ecm_interface_hierarchy_delete(interfaces, interface_first_base, valid_if); | ||||
|  				} | ||||
|   | ||||
| -				if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| -					dev_put(br_dev_src); | ||||
| -				} | ||||
| - | ||||
| -				dev_put(dest_dev); | ||||
| -				return 0; | ||||
| +				goto fail2; | ||||
|  			} | ||||
|   | ||||
|  			if (in_dev && !mfc_update) { | ||||
| @@ -3955,34 +3961,20 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  			} | ||||
|   | ||||
|  			for (br_if = 0; br_if < if_num; br_if++) { | ||||
| +				int total_if = valid_if + br_if; | ||||
| + | ||||
|  				mc_br_slave_dev = dev_get_by_index(&init_net, mc_dst_if_index[br_if]); | ||||
|  				if (!mc_br_slave_dev) { | ||||
|  					continue; | ||||
|  				} | ||||
|   | ||||
| -				if ((valid_if + br_if) > ECM_DB_MULTICAST_IF_MAX) { | ||||
| -					int i; | ||||
| - | ||||
| -					/* | ||||
| -					 * If already constructed any interface heirarchies before hitting | ||||
| -					 * this error condition then Deref all interface heirarchies. | ||||
| -					 */ | ||||
| -					for (i = 0; i < (valid_if + br_if); i++) { | ||||
| -						ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| -						ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| -						ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| -					} | ||||
| - | ||||
| -					if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| -						dev_put(br_dev_src); | ||||
| -					} | ||||
| - | ||||
| -					dev_put(dest_dev); | ||||
| +				if (total_if > ECM_DB_MULTICAST_IF_MAX) { | ||||
| +					ecm_interface_hierarchy_delete(interfaces, interface_first_base, total_if); | ||||
|  					dev_put(mc_br_slave_dev); | ||||
| -					return 0; | ||||
| +					goto fail2; | ||||
|  				} | ||||
|   | ||||
| -				ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, valid_if + br_if); | ||||
| +				ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, total_if); | ||||
|  				/* | ||||
|  				 * Construct a single interface heirarchy of a multicast dev. | ||||
|  				 */ | ||||
| @@ -3993,25 +3985,15 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  					 * If already constructed any interface heirarchies before hitting | ||||
|  					 * this error condition then Deref all interface heirarchies. | ||||
|  					 */ | ||||
| -					if ((valid_if + br_if) > 0) { | ||||
| -						int i; | ||||
| -						for (i = 0; i < (valid_if + br_if); i++) { | ||||
| -							ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| -							ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| -							ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| -						} | ||||
| -					} | ||||
| - | ||||
| -					if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| -						dev_put(br_dev_src); | ||||
| +					if (total_if > 0) { | ||||
| +						ecm_interface_hierarchy_delete(interfaces, interface_first_base, total_if); | ||||
|  					} | ||||
|   | ||||
| -					dev_put(dest_dev); | ||||
|  					dev_put(mc_br_slave_dev); | ||||
| -					return 0; | ||||
| +					goto fail2; | ||||
|  				} | ||||
|   | ||||
| -				interface_first = ecm_db_multicast_if_first_get_at_index(interface_first_base, (valid_if + br_if)); | ||||
| +				interface_first = ecm_db_multicast_if_first_get_at_index(interface_first_base, total_if); | ||||
|  				*interface_first = ii_cnt; | ||||
|  				total_ii_count += ii_cnt; | ||||
|  				dev_put(mc_br_slave_dev); | ||||
| @@ -4033,20 +4015,10 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  				 * this error condition then Deref all interface heirarchies. | ||||
|  				 */ | ||||
|  				if (valid_if > 0) { | ||||
| -					int i; | ||||
| -					for (i = 0; i < valid_if; i++) { | ||||
| -						ifaces = ecm_db_multicast_if_heirarchy_get(interfaces, i); | ||||
| -						ecm_db_multicast_copy_if_heirarchy(to_list_single, ifaces); | ||||
| -						ecm_db_connection_interfaces_deref(to_list_single, interface_first_base[i]); | ||||
| -					} | ||||
| -				} | ||||
| - | ||||
| -				if (br_dev_src && (dest_dev != br_dev_src)) { | ||||
| -					dev_put(br_dev_src); | ||||
| +					ecm_interface_hierarchy_delete(interfaces, interface_first_base, valid_if); | ||||
|  				} | ||||
|   | ||||
| -				dev_put(dest_dev); | ||||
| -				return 0; | ||||
| +				goto fail2; | ||||
|  			} | ||||
|   | ||||
|  			interface_first = ecm_db_multicast_if_first_get_at_index(interface_first_base, valid_if); | ||||
| @@ -4055,7 +4027,7 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  			valid_if++; | ||||
|  		} | ||||
|   | ||||
| -		if (dest_dev != br_dev_src) { | ||||
| +		if (!dest_dev_is_br_dev_src) { | ||||
|  			dev_put(dest_dev); | ||||
|  		} | ||||
|  	} | ||||
| @@ -4065,6 +4037,18 @@ int32_t ecm_interface_multicast_heirarchy_construct_routed(struct ecm_front_end_ | ||||
|  	} | ||||
|   | ||||
|  	return total_ii_count; | ||||
| + | ||||
| +fail2: | ||||
| +	if (!dest_dev_is_br_dev_src) { | ||||
| +		dev_put(dest_dev); | ||||
| +	} | ||||
| + | ||||
| +fail1: | ||||
| +	if (br_dev_src) { | ||||
| +		dev_put(br_dev_src); | ||||
| +	} | ||||
| + | ||||
| +	return 0; | ||||
|  } | ||||
|  EXPORT_SYMBOL(ecm_interface_multicast_heirarchy_construct_routed); | ||||
|   | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,59 @@ | ||||
| From 65a49ebd1bd12b9952dfa214de0a2da43ba2abed Mon Sep 17 00:00:00 2001 | ||||
| From: Bhaskar Valaboju <bhaskarv@codeaurora.org> | ||||
| Date: Tue, 13 Aug 2019 14:21:03 +0530 | ||||
| Subject: [qca-nss-ecm]: Access global ipv4/ipv6 accelerated count under lock | ||||
|  | ||||
| Flow accelerated count maintained as global variables are accessed | ||||
| in multiple kernel contexts.  These counters are updated under lock, | ||||
| but read without lock.  Read is in kernel thread context (workqueue) | ||||
| and sometimes it is taking stale entry (0) and doesn't change. | ||||
| Lock is added to read correct value. | ||||
|  | ||||
| Change-Id: I74cf27fe5097c6ae7dfcc06319762a8a322d79a3 | ||||
| Signed-off-by: Bhaskar Valaboju <bhaskarv@codeaurora.org> | ||||
| --- | ||||
|  frontends/nss/ecm_nss_ipv4.c | 3 +++ | ||||
|  frontends/nss/ecm_nss_ipv6.c | 3 +++ | ||||
|  2 files changed, 6 insertions(+) | ||||
|  | ||||
| (limited to 'frontends') | ||||
|  | ||||
| diff --git a/frontends/nss/ecm_nss_ipv4.c b/frontends/nss/ecm_nss_ipv4.c | ||||
| index afd660e..4e66cdf 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv4.c | ||||
| @@ -2288,10 +2288,13 @@ static void ecm_nss_ipv4_stats_sync_req_work(struct work_struct *work) | ||||
|  	int retry = 3; | ||||
|  	unsigned long int current_jiffies; | ||||
|   | ||||
| +	spin_lock_bh(&ecm_nss_ipv4_lock); | ||||
|  	if (ecm_nss_ipv4_accelerated_count == 0) { | ||||
| +		spin_unlock_bh(&ecm_nss_ipv4_lock); | ||||
|  		DEBUG_TRACE("There is no accelerated IPv4 connection\n"); | ||||
|  		goto reschedule; | ||||
|  	} | ||||
| +	spin_unlock_bh(&ecm_nss_ipv4_lock); | ||||
|   | ||||
|  	usleep_range(ECM_NSS_IPV4_STATS_SYNC_UDELAY - 100, ECM_NSS_IPV4_STATS_SYNC_UDELAY); | ||||
|   | ||||
| diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c | ||||
| index 1f7f51e..55849e7 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -1998,10 +1998,13 @@ static void ecm_nss_ipv6_stats_sync_req_work(struct work_struct *work) | ||||
|  	int retry = 3; | ||||
|  	unsigned long int current_jiffies; | ||||
|   | ||||
| +	spin_lock_bh(&ecm_nss_ipv6_lock); | ||||
|  	if (ecm_nss_ipv6_accelerated_count == 0) { | ||||
| +		spin_unlock_bh(&ecm_nss_ipv6_lock); | ||||
|  		DEBUG_TRACE("There is no accelerated IPv6 connection\n"); | ||||
|  		goto reschedule; | ||||
|  	} | ||||
| +	spin_unlock_bh(&ecm_nss_ipv6_lock); | ||||
|   | ||||
|  	usleep_range(ECM_NSS_IPV6_STATS_SYNC_UDELAY - 100, ECM_NSS_IPV6_STATS_SYNC_UDELAY); | ||||
|   | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,83 @@ | ||||
| From b96002061178f399c1e58a9ad821e5096a64f788 Mon Sep 17 00:00:00 2001 | ||||
| From: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Date: Mon, 23 Mar 2020 10:59:39 -0700 | ||||
| Subject: [qca-nss-ecm] Fix IPv6 neighbor solicitation request | ||||
|  | ||||
| Send the solicitation request to the GW address, when | ||||
| a GW address is found, while establishing the node instance. | ||||
|  | ||||
| Signed-off-by: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Change-Id: I2187569bcfd05b0d091cf8c79171ee3c41c39cb9 | ||||
| --- | ||||
|  frontends/nss/ecm_nss_ipv6.c           | 7 ++++--- | ||||
|  frontends/nss/ecm_nss_multicast_ipv6.c | 9 +++++++++ | ||||
|  frontends/sfe/ecm_sfe_ipv6.c           | 7 ++++--- | ||||
|  3 files changed, 17 insertions(+), 6 deletions(-) | ||||
|  | ||||
| diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c | ||||
| index c7dd37f..9011e18 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -527,13 +527,14 @@ struct ecm_db_node_instance *ecm_nss_ipv6_node_establish_and_ref(struct ecm_fron | ||||
|  					struct net_device *master; | ||||
|  					master = ecm_interface_get_and_hold_dev_master(dev); | ||||
|  					DEBUG_ASSERT(master, "Expected a master\n"); | ||||
| -					ecm_interface_send_neighbour_solicitation(master, addr); | ||||
| +					ecm_interface_send_neighbour_solicitation(master, gw_addr); | ||||
|  					dev_put(master); | ||||
|  				} else { | ||||
| -					ecm_interface_send_neighbour_solicitation(dev, addr); | ||||
| +					ecm_interface_send_neighbour_solicitation(dev, gw_addr); | ||||
|  				} | ||||
|   | ||||
| -				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr)); | ||||
| +				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT " gw: " ECM_IP_ADDR_OCTAL_FMT "\n", | ||||
| +					    ECM_IP_ADDR_TO_OCTAL(addr), ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
|  				return NULL; | ||||
|  			} | ||||
|  done: | ||||
| diff --git a/frontends/nss/ecm_nss_multicast_ipv6.c b/frontends/nss/ecm_nss_multicast_ipv6.c | ||||
| index a361eec..38fde95 100644 | ||||
| --- a/frontends/nss/ecm_nss_multicast_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_multicast_ipv6.c | ||||
| @@ -2558,6 +2558,15 @@ static struct ecm_db_node_instance *ecm_nss_multicast_ipv6_node_establish_and_re | ||||
|  #endif | ||||
|  			if (!ecm_interface_mac_addr_get(addr, node_addr, &on_link, gw_addr)) { | ||||
|  				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr)); | ||||
| + | ||||
| +				/* | ||||
| +				 * If there is a gw_addr found during the lookup, use that address | ||||
| +				 * for neighbour solicitation request. | ||||
| +				 */ | ||||
| +				if (!ECM_IP_ADDR_IS_NULL(gw_addr)) { | ||||
| +					ECM_IP_ADDR_COPY(addr, gw_addr); | ||||
| +				} | ||||
| + | ||||
|  				if (ecm_front_end_is_bridge_port(dev)) { | ||||
|  					struct net_device *master; | ||||
|  					master = ecm_interface_get_and_hold_dev_master(dev); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ipv6.c b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| index 3fd5d46..51a9ccb 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| @@ -256,13 +256,14 @@ struct ecm_db_node_instance *ecm_sfe_ipv6_node_establish_and_ref(struct ecm_fron | ||||
|  					struct net_device *master; | ||||
|  					master = ecm_interface_get_and_hold_dev_master(dev); | ||||
|  					DEBUG_ASSERT(master, "Expected a master\n"); | ||||
| -					ecm_interface_send_neighbour_solicitation(master, addr); | ||||
| +					ecm_interface_send_neighbour_solicitation(master, gw_addr); | ||||
|  					dev_put(master); | ||||
|  				} else { | ||||
| -					ecm_interface_send_neighbour_solicitation(dev, addr); | ||||
| +					ecm_interface_send_neighbour_solicitation(dev, gw_addr); | ||||
|  				} | ||||
|   | ||||
| -				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(addr)); | ||||
| +				DEBUG_TRACE("Failed to obtain mac for host " ECM_IP_ADDR_OCTAL_FMT " gw: " ECM_IP_ADDR_OCTAL_FMT "\n", | ||||
| +					    ECM_IP_ADDR_TO_OCTAL(addr), ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
|  				return NULL; | ||||
|  			} | ||||
|  done: | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,63 @@ | ||||
| From 5b51ae2f1eca61c6f68e40a05333da5a362ff327 Mon Sep 17 00:00:00 2001 | ||||
| From: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Date: Mon, 13 Apr 2020 09:01:48 -0700 | ||||
| Subject: [qca-nss-ecm] IPv6 solicitation fix with zero gateway address | ||||
|  | ||||
| The ECM function can find a zero gateway address for | ||||
| a host IP address. In this case, we need to use the | ||||
| host IP address while sending the solicitation request. | ||||
|  | ||||
| Signed-off-by: Murat Sezgin <msezgin@codeaurora.org> | ||||
| Change-Id: I1979834088ddfe1843566f51f64348f79e2df0fc | ||||
| --- | ||||
|  frontends/nss/ecm_nss_ipv6.c | 11 ++++++++++- | ||||
|  frontends/sfe/ecm_sfe_ipv6.c | 11 ++++++++++- | ||||
|  2 files changed, 20 insertions(+), 2 deletions(-) | ||||
|  | ||||
| diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c | ||||
| index a05781b..9eb591c 100644 | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -516,7 +516,16 @@ struct ecm_db_node_instance *ecm_nss_ipv6_node_establish_and_ref(struct ecm_fron | ||||
|  					return NULL; | ||||
|  				} | ||||
|   | ||||
| -				DEBUG_TRACE("Have a gw address " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
| +				/* | ||||
| +				 * The found gateway address can be all zeros, | ||||
| +				 * so in this case use the host address. | ||||
| +				 */ | ||||
| +				if (ECM_IP_ADDR_IS_NULL(gw_addr)) { | ||||
| +					DEBUG_TRACE("GW address is found as zeros, so use host IP\n"); | ||||
| +					ECM_IP_ADDR_COPY(gw_addr, addr); | ||||
| +				} else { | ||||
| +					DEBUG_TRACE("Have a gw address " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
| +				} | ||||
|   | ||||
|  				if (ecm_interface_mac_addr_get_no_route(dev, gw_addr, node_addr)) { | ||||
|  					DEBUG_TRACE("Found the mac address for gateway\n"); | ||||
| diff --git a/frontends/sfe/ecm_sfe_ipv6.c b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| index 51a9ccb..e609df7 100644 | ||||
| --- a/frontends/sfe/ecm_sfe_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| @@ -245,7 +245,16 @@ struct ecm_db_node_instance *ecm_sfe_ipv6_node_establish_and_ref(struct ecm_fron | ||||
|  					return NULL; | ||||
|  				} | ||||
|   | ||||
| -				DEBUG_TRACE("Have a gw address " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
| +				/* | ||||
| +				 * The found gateway address can be all zeros, | ||||
| +				 * so in this case use the host address. | ||||
| +				 */ | ||||
| +				if (ECM_IP_ADDR_IS_NULL(gw_addr)) { | ||||
| +					DEBUG_TRACE("GW address is found as zeros, so use host IP\n"); | ||||
| +					ECM_IP_ADDR_COPY(gw_addr, addr); | ||||
| +				} else { | ||||
| +					DEBUG_TRACE("Have a gw address " ECM_IP_ADDR_OCTAL_FMT "\n", ECM_IP_ADDR_TO_OCTAL(gw_addr)); | ||||
| +				} | ||||
|   | ||||
|  				if (ecm_interface_mac_addr_get_no_route(dev, gw_addr, node_addr)) { | ||||
|  					DEBUG_TRACE("Found the mac address for gateway\n"); | ||||
| --  | ||||
| cgit v1.1 | ||||
|  | ||||
| @@ -0,0 +1,875 @@ | ||||
| From e23eabd570eabde1d1fc803127a97fd101642467 Mon Sep 17 00:00:00 2001 | ||||
| From: Varsha Mishra <varsham@codeaurora.org> | ||||
| Date: Fri, 12 Jun 2020 01:06:58 +0530 | ||||
| Subject: [qca-nss-ecm] Allow egress on same port when bridge hairpin is | ||||
|  enabled. | ||||
|  | ||||
| When bridge hairpin is enabled, allow egress on same port. Wi-Fi intrabss | ||||
| frames are getting exceptioned to stack. Bridge gets to make the decision | ||||
| whether these frames need to be forwarded or dropped. | ||||
|  | ||||
| Signed-off-by: Varsha Mishra <varsham@codeaurora.org> | ||||
| Change-Id: Ibdd72264d8887330ba0297ed12cbcfc390065bff | ||||
| --- | ||||
|  frontends/nss/ecm_nss_ipv4.c | 28 ++++++++++++++++++++++------ | ||||
|  frontends/nss/ecm_nss_ipv6.c | 28 ++++++++++++++++++++++------ | ||||
|  2 files changed, 44 insertions(+), 12 deletions(-) | ||||
|  | ||||
| --- a/frontends/nss/ecm_nss_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv4.c | ||||
| @@ -1712,7 +1712,9 @@ static unsigned int ecm_nss_ipv4_bridge_ | ||||
|  	 * Case 2: | ||||
|  	 *	For routed packets the skb will have the src mac matching the bridge mac. | ||||
|  	 * Case 3: | ||||
| -	 *	If the packet was not local (case 1) or routed (case 2) then we process. | ||||
| +	 *	If the packet was not local (case 1) or routed (case 2) then | ||||
| +	 *	we process. There is an exception to case 2: when hairpin mode | ||||
| +	 *	is enabled, we process. | ||||
|  	 */ | ||||
|   | ||||
|  	/* | ||||
| @@ -1724,16 +1726,30 @@ static unsigned int ecm_nss_ipv4_bridge_ | ||||
|  		dev_put(bridge); | ||||
|  		return NF_ACCEPT; | ||||
|  	} | ||||
| + | ||||
| +	/* | ||||
| +	 * This flag needs to be checked in slave port(eth0/ath0) | ||||
| +	 * and not on master interface(br-lan). Hairpin flag can be | ||||
| +	 * enabled/disabled for ports individually. | ||||
| +	 */ | ||||
|  	if (in == out) { | ||||
| -		DEBUG_TRACE("skb: %p, bridge: %p (%s), port bounce on %p (%s)\n", skb, bridge, bridge->name, out, out->name); | ||||
| -		dev_put(in); | ||||
| -		dev_put(bridge); | ||||
| -		return NF_ACCEPT; | ||||
| +		if (!br_is_hairpin_enabled(in)) { | ||||
| +			DEBUG_TRACE("skb: %p, bridge: %p (%s), ignoring" | ||||
| +					"the packet, hairpin not enabled" | ||||
| +					"on port %p (%s)\n", skb, bridge, | ||||
| +					bridge->name, out, out->name); | ||||
| +			dev_put(in); | ||||
| +			dev_put(bridge); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| +		DEBUG_TRACE("skb: %p, bridge: %p (%s), hairpin enabled on port" | ||||
| +				"%p (%s)\n", skb, bridge, bridge->name, out, out->name); | ||||
|  	} | ||||
| + | ||||
| +	/* | ||||
| +	 * Case 2: Routed trafffic would be handled by the INET post routing. | ||||
| +	 */ | ||||
|  	if (!ecm_mac_addr_equal(skb_eth_hdr->h_source, bridge->dev_addr)) { | ||||
| -		/* | ||||
| -		 * Case 2: Routed trafffic would be handled by the INET post routing. | ||||
| -		 */ | ||||
|  		DEBUG_TRACE("skb: %p, Ignoring routed packet to bridge: %p (%s)\n", skb, bridge, bridge->name); | ||||
|  		dev_put(in); | ||||
|  		dev_put(bridge); | ||||
| @@ -2598,41 +2614,23 @@ int ecm_nss_ipv4_init(struct dentry *den | ||||
|  		return result; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_no_action_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 no_action_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_no_action_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_driver_fail_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 driver_fail_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_driver_fail_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_nack_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 nack_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_nack_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 accelerated_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_accelerated_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_pending_accel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 pending_accel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_pending_accel_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_pending_decel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 pending_decel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_pending_decel_count); | ||||
|   | ||||
|  	if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
|  					NULL, &ecm_nss_ipv4_accel_limit_mode_fops)) { | ||||
| @@ -2663,11 +2661,8 @@ int ecm_nss_ipv4_init(struct dentry *den | ||||
|  		goto task_cleanup; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv4_vlan_passthrough_enable)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 vlan passthrough file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv4_vlan_passthrough_enable); | ||||
|   | ||||
|  #ifdef ECM_NON_PORTED_SUPPORT_ENABLE | ||||
|  	if (!ecm_nss_non_ported_ipv4_debugfs_init(ecm_nss_ipv4_dentry)) { | ||||
| --- a/frontends/nss/ecm_nss_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ipv6.c | ||||
| @@ -1458,7 +1458,9 @@ static unsigned int ecm_nss_ipv6_bridge_ | ||||
|  	 * Case 2: | ||||
|  	 *	For routed packets the skb will have the src mac matching the bridge mac. | ||||
|  	 * Case 3: | ||||
| -	 *	If the packet was not local (case 1) or routed (case 2) then we process. | ||||
| +	 *	If the packet was not local (case 1) or routed (case 2) then | ||||
| +	 *	we process. There is an exception to case 2: when hairpin mode | ||||
| +	 *	is enabled, we process. | ||||
|  	 */ | ||||
|   | ||||
|  	/* | ||||
| @@ -1470,16 +1472,30 @@ static unsigned int ecm_nss_ipv6_bridge_ | ||||
|  		dev_put(bridge); | ||||
|  		return NF_ACCEPT; | ||||
|  	} | ||||
| + | ||||
| +	/* | ||||
| +	 * This flag needs to be checked in slave port(eth0/ath0) | ||||
| +	 * and not on master interface(br-lan). Hairpin flag can be | ||||
| +	 * enabled/disabled for ports individually. | ||||
| +	 */ | ||||
|  	if (in == out) { | ||||
| -		DEBUG_TRACE("skb: %p, bridge: %p (%s), port bounce on %p (%s)\n", skb, bridge, bridge->name, out, out->name); | ||||
| -		dev_put(in); | ||||
| -		dev_put(bridge); | ||||
| -		return NF_ACCEPT; | ||||
| +		if (!br_is_hairpin_enabled(in)) { | ||||
| +			DEBUG_TRACE("skb: %p, bridge: %p (%s), ignoring" | ||||
| +					"the packet, hairpin not enabled" | ||||
| +					"on port %p (%s)\n", skb, bridge, | ||||
| +					bridge->name, out, out->name); | ||||
| +			dev_put(in); | ||||
| +			dev_put(bridge); | ||||
| +			return NF_ACCEPT; | ||||
| +		} | ||||
| +		DEBUG_TRACE("skb: %p, bridge: %p (%s), hairpin enabled on port" | ||||
| +				"%p (%s)\n", skb, bridge, bridge->name, out, out->name); | ||||
|  	} | ||||
| + | ||||
| +	/* | ||||
| +	 * Case 2: Routed trafffic would be handled by the INET post routing. | ||||
| +	 */ | ||||
|  	if (!ecm_mac_addr_equal(skb_eth_hdr->h_source, bridge->dev_addr)) { | ||||
| -		/* | ||||
| -		 * Case 2: Routed trafffic would be handled by the INET post routing. | ||||
| -		 */ | ||||
|  		DEBUG_TRACE("skb: %p, Ignoring routed packet to bridge: %p (%s)\n", skb, bridge, bridge->name); | ||||
|  		dev_put(in); | ||||
|  		dev_put(bridge); | ||||
| @@ -2320,41 +2336,23 @@ int ecm_nss_ipv6_init(struct dentry *den | ||||
|  		return result; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_no_action_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 no_action_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_no_action_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_driver_fail_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 driver_fail_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_driver_fail_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_nack_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 nack_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_nack_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 accelerated_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("accelerated_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_accelerated_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_pending_accel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 pending_accel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_pending_accel_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_pending_decel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 pending_decel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_pending_decel_count); | ||||
|   | ||||
|  	if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
|  					NULL, &ecm_nss_ipv6_accel_limit_mode_fops)) { | ||||
| @@ -2385,11 +2383,8 @@ int ecm_nss_ipv6_init(struct dentry *den | ||||
|  		goto task_cleanup; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| -					(u32 *)&ecm_nss_ipv6_vlan_passthrough_enable)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 vlan passthrough file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("vlan_passthrough_set", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, | ||||
| +					(u32 *)&ecm_nss_ipv6_vlan_passthrough_enable); | ||||
|   | ||||
|  #ifdef ECM_NON_PORTED_SUPPORT_ENABLE | ||||
|  	if (!ecm_nss_non_ported_ipv6_debugfs_init(ecm_nss_ipv6_dentry)) { | ||||
| --- a/ecm_classifier_default.c | ||||
| +++ b/ecm_classifier_default.c | ||||
| @@ -639,19 +639,11 @@ int ecm_classifier_default_init(struct d | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, | ||||
| -					(u32 *)&ecm_classifier_default_enabled)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm deafult classifier enabled file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_classifier_default_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, | ||||
| +					(u32 *)&ecm_classifier_default_enabled); | ||||
|   | ||||
| -	if (!debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, | ||||
| -					(u32 *)&ecm_classifier_default_accel_mode)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm deafult classifier accel_mode file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_classifier_default_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("accel_mode", S_IRUGO | S_IWUSR, ecm_classifier_default_dentry, | ||||
| +					(u32 *)&ecm_classifier_default_accel_mode); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| --- a/ecm_classifier_dscp.c | ||||
| +++ b/ecm_classifier_dscp.c | ||||
| @@ -644,12 +644,8 @@ int ecm_classifier_dscp_init(struct dent | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry, | ||||
| -					(u32 *)&ecm_classifier_dscp_enabled)) { | ||||
| -		DEBUG_ERROR("Failed to create dscp enabled file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_classifier_dscp_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_dscp_dentry, | ||||
| +					(u32 *)&ecm_classifier_dscp_enabled); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| --- a/ecm_classifier_hyfi.c | ||||
| +++ b/ecm_classifier_hyfi.c | ||||
| @@ -1100,11 +1100,8 @@ int ecm_classifier_hyfi_rules_init(struc | ||||
|  		goto classifier_task_cleanup; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry, | ||||
| -					(u32 *)&ecm_classifier_hyfi_enabled)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm hyfi classifier enabled file in debugfs\n"); | ||||
| -		goto classifier_task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_hyfi_dentry, | ||||
| +					(u32 *)&ecm_classifier_hyfi_enabled); | ||||
|   | ||||
|  	if (!debugfs_create_file("cmd", S_IWUSR, ecm_classifier_hyfi_dentry, | ||||
|  					NULL, &ecm_classifier_hyfi_cmd_fops)) { | ||||
| --- a/ecm_classifier_mark.c | ||||
| +++ b/ecm_classifier_mark.c | ||||
| @@ -753,12 +753,8 @@ int ecm_classifier_mark_init(struct dent | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry, | ||||
| -					(u32 *)&ecm_classifier_mark_enabled)) { | ||||
| -		DEBUG_ERROR("Failed to create mark enabled file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_classifier_mark_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("enabled", S_IRUGO | S_IWUSR, ecm_classifier_mark_dentry, | ||||
| +					(u32 *)&ecm_classifier_mark_enabled); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| --- a/ecm_classifier_pcc.c | ||||
| +++ b/ecm_classifier_pcc.c | ||||
| @@ -1065,12 +1065,8 @@ int ecm_classifier_pcc_init(struct dentr | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry, | ||||
| -					(u32 *)&ecm_classifier_pcc_enabled)) { | ||||
| -		DEBUG_ERROR("Failed to create pcc enabled file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_classifier_pcc_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("enabled", S_IRUGO, ecm_classifier_pcc_dentry, | ||||
| +					(u32 *)&ecm_classifier_pcc_enabled); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| --- a/ecm_conntrack_notifier.c | ||||
| +++ b/ecm_conntrack_notifier.c | ||||
| @@ -400,12 +400,8 @@ int ecm_conntrack_notifier_init(struct d | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry, | ||||
| -					(u32 *)&ecm_conntrack_notifier_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm conntrack notifier stopped file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_conntrack_notifier_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_conntrack_notifier_dentry, | ||||
| +					(u32 *)&ecm_conntrack_notifier_stopped); | ||||
|   | ||||
|  #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||||
|  	/* | ||||
| --- a/ecm_db/ecm_db_connection.c | ||||
| +++ b/ecm_db/ecm_db_connection.c | ||||
| @@ -3266,11 +3266,8 @@ static struct file_operations ecm_db_con | ||||
|   */ | ||||
|  bool ecm_db_connection_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("connection_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_db_connection_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm db connection count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("connection_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_db_connection_count); | ||||
|   | ||||
|  	if (!debugfs_create_file("connection_count_simple", S_IRUGO, dentry, | ||||
|  					NULL, &ecm_db_connection_count_simple_fops)) { | ||||
| --- a/ecm_db/ecm_db_host.c | ||||
| +++ b/ecm_db/ecm_db_host.c | ||||
| @@ -630,11 +630,8 @@ EXPORT_SYMBOL(ecm_db_host_alloc); | ||||
|  bool ecm_db_host_init(struct dentry *dentry) | ||||
|  { | ||||
|   | ||||
| -	if (!debugfs_create_u32("host_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_db_host_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm db host count file in debugfs\n"); | ||||
| -		return false;; | ||||
| -	} | ||||
| +	debugfs_create_u32("host_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_db_host_count); | ||||
|   | ||||
|  	ecm_db_host_table = vzalloc(sizeof(struct ecm_db_host_instance *) * ECM_DB_HOST_HASH_SLOTS); | ||||
|  	if (!ecm_db_host_table) { | ||||
| --- a/ecm_db/ecm_db_iface.c | ||||
| +++ b/ecm_db/ecm_db_iface.c | ||||
| @@ -3254,11 +3254,8 @@ EXPORT_SYMBOL(ecm_db_iface_alloc); | ||||
|   */ | ||||
|  bool ecm_db_iface_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("iface_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_db_iface_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm db iface count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("iface_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_db_iface_count); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/ecm_db/ecm_db_mapping.c | ||||
| +++ b/ecm_db/ecm_db_mapping.c | ||||
| @@ -806,11 +806,8 @@ EXPORT_SYMBOL(ecm_db_mapping_alloc); | ||||
|   */ | ||||
|  bool ecm_db_mapping_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("mapping_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_db_mapping_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm db mapping count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("mapping_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_db_mapping_count); | ||||
|   | ||||
|  	ecm_db_mapping_table = vzalloc(sizeof(struct ecm_db_mapping_instance *) * ECM_DB_MAPPING_HASH_SLOTS); | ||||
|  	if (!ecm_db_mapping_table) { | ||||
| --- a/ecm_db/ecm_db_node.c | ||||
| +++ b/ecm_db/ecm_db_node.c | ||||
| @@ -856,11 +856,8 @@ void ecm_db_traverse_node_connection_lis | ||||
|   */ | ||||
|  bool ecm_db_node_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("node_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_db_node_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm db node count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("node_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_db_node_count); | ||||
|   | ||||
|  	ecm_db_node_table = vzalloc(sizeof(struct ecm_db_node_instance *) * ECM_DB_NODE_HASH_SLOTS); | ||||
|  	if (!ecm_db_node_table) { | ||||
| --- a/ecm_state.c | ||||
| +++ b/ecm_state.c | ||||
| @@ -899,17 +899,11 @@ int ecm_state_init(struct dentry *dentry | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry, | ||||
| -					(u32 *)&ecm_state_dev_major_id)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm state dev major file in debugfs\n"); | ||||
| -		goto init_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("state_dev_major", S_IRUGO, ecm_state_dentry, | ||||
| +					(u32 *)&ecm_state_dev_major_id); | ||||
|   | ||||
| -	if (!debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry, | ||||
| -					(u32 *)&ecm_state_file_output_mask)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm state output mask file in debugfs\n"); | ||||
| -		goto init_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("state_file_output_mask", S_IRUGO | S_IWUSR, ecm_state_dentry, | ||||
| +					(u32 *)&ecm_state_file_output_mask); | ||||
|   | ||||
|  	/* | ||||
|  	 * Register a char device that we will use to provide a dump of our state | ||||
| --- a/frontends/ecm_front_end_ipv4.c | ||||
| +++ b/frontends/ecm_front_end_ipv4.c | ||||
| @@ -356,11 +356,8 @@ void ecm_front_end_ipv4_stop(int num) | ||||
|   */ | ||||
|  int ecm_front_end_ipv4_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| -					(u32 *)&ecm_front_end_ipv4_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm front end ipv4 stop file in debugfs\n"); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| +					(u32 *)&ecm_front_end_ipv4_stopped); | ||||
|   | ||||
|  	switch (ecm_front_end_type_get()) { | ||||
|  	case ECM_FRONT_END_TYPE_NSS: | ||||
| --- a/frontends/ecm_front_end_ipv6.c | ||||
| +++ b/frontends/ecm_front_end_ipv6.c | ||||
| @@ -226,11 +226,8 @@ void ecm_front_end_ipv6_stop(int num) | ||||
|   */ | ||||
|  int ecm_front_end_ipv6_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| -					(u32 *)&ecm_front_end_ipv6_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm front end ipv6 stop file in debugfs\n"); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| +					(u32 *)&ecm_front_end_ipv6_stopped); | ||||
|   | ||||
|  	switch (ecm_front_end_type_get()) { | ||||
|  	case ECM_FRONT_END_TYPE_NSS: | ||||
| --- a/frontends/nss/ecm_nss_bond_notifier.c | ||||
| +++ b/frontends/nss/ecm_nss_bond_notifier.c | ||||
| @@ -240,12 +240,8 @@ int ecm_nss_bond_notifier_init(struct de | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, | ||||
| -					(u32 *)&ecm_nss_bond_notifier_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm bond notifier stopped file in debugfs\n"); | ||||
| -		debugfs_remove_recursive(ecm_nss_bond_notifier_dentry); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, | ||||
| +					(u32 *)&ecm_nss_bond_notifier_stopped); | ||||
|   | ||||
|  	/* | ||||
|  	 * Register Link Aggregation callbacks with the bonding driver | ||||
| --- a/frontends/nss/ecm_nss_multicast_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_multicast_ipv4.c | ||||
| @@ -3935,11 +3935,8 @@ void ecm_nss_multicast_ipv4_stop(int num | ||||
|   */ | ||||
|  int ecm_nss_multicast_ipv4_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| -					(u32 *)&ecm_front_end_ipv4_mc_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm front end ipv4 mc stop file in debugfs\n"); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("ecm_nss_multicast_ipv4_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| +					(u32 *)&ecm_front_end_ipv4_mc_stopped); | ||||
|   | ||||
|  	/* | ||||
|  	 * Register multicast update callback to MCS snooper | ||||
| --- a/frontends/nss/ecm_nss_multicast_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_multicast_ipv6.c | ||||
| @@ -3734,11 +3734,8 @@ void ecm_nss_multicast_ipv6_stop(int num | ||||
|   */ | ||||
|  int ecm_nss_multicast_ipv6_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| -					(u32 *)&ecm_front_end_ipv6_mc_stopped)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm front end ipv6 mc stop file in debugfs\n"); | ||||
| -		return -1; | ||||
| -	} | ||||
| +	debugfs_create_u32("ecm_nss_multicast_ipv6_stop", S_IRUGO | S_IWUSR, dentry, | ||||
| +					(u32 *)&ecm_front_end_ipv6_mc_stopped); | ||||
|   | ||||
|  	/* | ||||
|  	 * Register multicast update callback to MCS snooper | ||||
| --- a/frontends/nss/ecm_nss_non_ported_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_non_ported_ipv4.c | ||||
| @@ -2440,11 +2440,8 @@ done: | ||||
|   */ | ||||
|  bool ecm_nss_non_ported_ipv4_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_nss_non_ported_ipv4_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 non_ported_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_nss_non_ported_ipv4_accelerated_count); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/nss/ecm_nss_non_ported_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_non_ported_ipv6.c | ||||
| @@ -2163,11 +2163,8 @@ done: | ||||
|   */ | ||||
|  bool ecm_nss_non_ported_ipv6_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_nss_non_ported_ipv6_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 non_ported_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_nss_non_ported_ipv6_accelerated_count); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/nss/ecm_nss_ported_ipv4.c | ||||
| +++ b/frontends/nss/ecm_nss_ported_ipv4.c | ||||
| @@ -2586,21 +2586,11 @@ done: | ||||
|   */ | ||||
|  bool ecm_nss_ported_ipv4_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	struct dentry *udp_dentry; | ||||
|   | ||||
| -	udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, | ||||
| +	debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, | ||||
|  						&ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_UDP]); | ||||
| -	if (!udp_dentry) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 udp_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| - | ||||
| -	if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| -					&ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP])) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv4 tcp_accelerated_count file in debugfs\n"); | ||||
| -		debugfs_remove(udp_dentry); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| +					&ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP]); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/nss/ecm_nss_ported_ipv6.c | ||||
| +++ b/frontends/nss/ecm_nss_ported_ipv6.c | ||||
| @@ -2375,21 +2375,12 @@ done: | ||||
|   */ | ||||
|  bool ecm_nss_ported_ipv6_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	struct dentry *udp_dentry; | ||||
|   | ||||
| -	udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, | ||||
| +	debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, | ||||
|  						&ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_UDP]); | ||||
| -	if (!udp_dentry) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 udp_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| -					&ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP])) { | ||||
| -		DEBUG_ERROR("Failed to create ecm nss ipv6 tcp_accelerated_count file in debugfs\n"); | ||||
| -		debugfs_remove(udp_dentry); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| +					&ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP]); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/sfe/ecm_sfe_ipv4.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv4.c | ||||
| @@ -1805,50 +1805,29 @@ int ecm_sfe_ipv4_init(struct dentry *den | ||||
|  	} | ||||
|   | ||||
|  #ifdef CONFIG_XFRM | ||||
| -	if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 reject_acceleration_for_ipsec file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_reject_acceleration_for_ipsec) ; | ||||
|  #endif | ||||
|   | ||||
| -	if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_no_action_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 no_action_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_no_action_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_driver_fail_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 driver_fail_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_driver_fail_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_nack_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 nack_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_nack_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 accelerated_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_accelerated_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_pending_accel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_accel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_pending_accel_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv4_pending_decel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 pending_decel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv4_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv4_pending_decel_count); | ||||
|   | ||||
| -	if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
| +	if(!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv4_dentry, | ||||
|  					NULL, &ecm_sfe_ipv4_accel_limit_mode_fops)) { | ||||
|  		DEBUG_ERROR("Failed to create ecm sfe ipv4 accel_limit_mode file in debugfs\n"); | ||||
|  		goto task_cleanup; | ||||
| --- a/frontends/sfe/ecm_sfe_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ipv6.c | ||||
| @@ -1528,48 +1528,27 @@ int ecm_sfe_ipv6_init(struct dentry *den | ||||
|  	} | ||||
|   | ||||
|  #ifdef CONFIG_XFRM | ||||
| -	if (!debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 reject_acceleration_for_ipsec file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("reject_acceleration_for_ipsec", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_reject_acceleration_for_ipsec); | ||||
|  #endif | ||||
|   | ||||
| -	if (!debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_no_action_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 no_action_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("no_action_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_no_action_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_driver_fail_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 driver_fail_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("driver_fail_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_driver_fail_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_nack_limit_default)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 nack_limit_default file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("nack_limit_default", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_nack_limit_default); | ||||
|   | ||||
| -	if (!debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 accelerated_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("accelerated_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_accelerated_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_pending_accel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_accel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_accel_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_pending_accel_count); | ||||
|   | ||||
| -	if (!debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| -					(u32 *)&ecm_sfe_ipv6_pending_decel_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 pending_decel_count file in debugfs\n"); | ||||
| -		goto task_cleanup; | ||||
| -	} | ||||
| +	debugfs_create_u32("pending_decel_count", S_IRUGO, ecm_sfe_ipv6_dentry, | ||||
| +					(u32 *)&ecm_sfe_ipv6_pending_decel_count); | ||||
|   | ||||
|  	if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_sfe_ipv6_dentry, | ||||
|  					NULL, &ecm_sfe_ipv6_accel_limit_mode_fops)) { | ||||
| --- a/frontends/sfe/ecm_sfe_non_ported_ipv4.c | ||||
| +++ b/frontends/sfe/ecm_sfe_non_ported_ipv4.c | ||||
| @@ -2239,11 +2239,8 @@ done: | ||||
|   */ | ||||
|  bool ecm_sfe_non_ported_ipv4_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 non_ported_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_sfe_non_ported_ipv4_accelerated_count); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/sfe/ecm_sfe_non_ported_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_non_ported_ipv6.c | ||||
| @@ -2039,11 +2039,8 @@ done: | ||||
|   */ | ||||
|  bool ecm_sfe_non_ported_ipv6_debugfs_init(struct dentry *dentry) | ||||
|  { | ||||
| -	if (!debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| -					(u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count)) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 non_ported_accelerated_count file in debugfs\n"); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("non_ported_accelerated_count", S_IRUGO, dentry, | ||||
| +					(u32 *)&ecm_sfe_non_ported_ipv6_accelerated_count); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/sfe/ecm_sfe_ported_ipv4.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ported_ipv4.c | ||||
| @@ -2451,12 +2451,8 @@ bool ecm_sfe_ported_ipv4_debugfs_init(st | ||||
|  		return false; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| -					&ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP])) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv4 tcp_accelerated_count file in debugfs\n"); | ||||
| -		debugfs_remove(udp_dentry); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| +					&ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP]); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/frontends/sfe/ecm_sfe_ported_ipv6.c | ||||
| +++ b/frontends/sfe/ecm_sfe_ported_ipv6.c | ||||
| @@ -2295,12 +2295,8 @@ bool ecm_sfe_ported_ipv6_debugfs_init(st | ||||
|  		return false; | ||||
|  	} | ||||
|   | ||||
| -	if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| -					&ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP])) { | ||||
| -		DEBUG_ERROR("Failed to create ecm sfe ipv6 tcp_accelerated_count file in debugfs\n"); | ||||
| -		debugfs_remove(udp_dentry); | ||||
| -		return false; | ||||
| -	} | ||||
| +	debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, | ||||
| +					&ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP]); | ||||
|   | ||||
|  	return true; | ||||
|  } | ||||
| --- a/ecm_interface.c | ||||
| +++ b/ecm_interface.c | ||||
| @@ -136,7 +136,7 @@ static struct ecm_interface_wifi_event _ | ||||
|  /* | ||||
|   * TODO: Remove once the Linux image and headers get propogated. | ||||
|   */ | ||||
| -struct net_device *ipv6_dev_find(struct net *net, struct in6_addr *addr, int strict); | ||||
| +struct net_device *qca_ipv6_dev_find(struct net *net, struct in6_addr *addr, int strict); | ||||
|  #endif | ||||
|   | ||||
|  #ifdef ECM_INTERFACE_IPSEC_GLUE_LAYER_SUPPORT_ENABLE | ||||
| @@ -301,7 +301,7 @@ static struct net_device *ecm_interface_ | ||||
|  	struct net_device *dev; | ||||
|   | ||||
|  	ECM_IP_ADDR_TO_NIN6_ADDR(addr6, addr); | ||||
| -	dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, 1); | ||||
| +	dev = (struct net_device *)qca_ipv6_dev_find(&init_net, &addr6, 1); | ||||
|  	return dev; | ||||
|  } | ||||
|  #endif | ||||
| @@ -716,7 +716,7 @@ static bool ecm_interface_mac_addr_get_i | ||||
|  	 * Get the MAC address that corresponds to IP address given. | ||||
|  	 */ | ||||
|  	ECM_IP_ADDR_TO_NIN6_ADDR(daddr, addr); | ||||
| -	local_dev = ipv6_dev_find(&init_net, &daddr, 1); | ||||
| +	local_dev = qca_ipv6_dev_find(&init_net, &daddr, 1); | ||||
|  	if (local_dev) { | ||||
|  		DEBUG_TRACE("%pi6 is a local address\n", &daddr); | ||||
|  		memcpy(mac_addr, dev->dev_addr, ETH_ALEN); | ||||
| --- a/Makefile | ||||
| +++ b/Makefile | ||||
| @@ -218,7 +218,7 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += - | ||||
|  # ############################################################################# | ||||
|  # Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier. | ||||
|  # ############################################################################# | ||||
| -ECM_CLASSIFIER_DSCP_ENABLE=y | ||||
| +ECM_CLASSIFIER_DSCP_ENABLE=n | ||||
|  ecm-$(ECM_CLASSIFIER_DSCP_ENABLE) += ecm_classifier_dscp.o | ||||
|  ccflags-$(ECM_CLASSIFIER_DSCP_ENABLE) += -DECM_CLASSIFIER_DSCP_ENABLE | ||||
|   | ||||
							
								
								
									
										46
									
								
								package/qca/qca-nss-gmac/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								package/qca/qca-nss-gmac/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
|  | ||||
| PKG_NAME:=qca-nss-gmac | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-gmac | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=9b74deef2816d91e58926e6fab7a6ff931eb3b22 | ||||
|  | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/qca-nss-gmac | ||||
|   SECTION:=kernel | ||||
|   CATEGORY:=Kernel modules | ||||
|   SUBMENU:=Network Devices | ||||
|   DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x @!LINUX_3_18 | ||||
|   TITLE:=Kernel driver for NSS gmac | ||||
|   FILES:=$(PKG_BUILD_DIR)/ipq806x/qca-nss-gmac.ko | ||||
|   AUTOLOAD:=$(call AutoLoad,31,qca-nss-gmac) | ||||
| endef | ||||
|  | ||||
| define KernelPackage/qca-nss-gmac/Description | ||||
| This package contains a NSS driver for QCA chipset | ||||
| endef | ||||
|  | ||||
| define Build/InstallDev | ||||
| 	mkdir -p $(1)/usr/include/qca-nss-gmac | ||||
| 	$(CP) $(PKG_BUILD_DIR)/ipq806x/exports/* $(1)/usr/include/qca-nss-gmac/ | ||||
| endef | ||||
|  | ||||
| EXTRA_CFLAGS+= \ | ||||
| 	-DCONFIG_NSS_DEBUG_LEVEL=4 \ | ||||
| 	-I$(PKG_BUILD_DIR)/nss_hal/include \ | ||||
| 	-I$(PKG_BUILD_DIR)/nss_hal/$(BOARD) | ||||
|  | ||||
| define Build/Compile | ||||
| 	$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		$(PKG_MAKE_FLAGS) \ | ||||
| 		M="$(PKG_BUILD_DIR)" \ | ||||
| 		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,qca-nss-gmac)) | ||||
							
								
								
									
										279
									
								
								package/qca/qca-nss-gmac/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										279
									
								
								package/qca/qca-nss-gmac/patches/100-kernel-5.4-support.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,279 @@ | ||||
| --- a/ipq806x/nss_gmac_ctrl.c | ||||
| +++ b/ipq806x/nss_gmac_ctrl.c | ||||
| @@ -322,16 +322,15 @@ void nss_gmac_tx_rx_desc_init(struct nss | ||||
|   * (for example "ifconfig eth0"). | ||||
|   * @param[in] pointer to net_device structure. | ||||
|   * @param[in] pointer to net_device_stats64 structure. | ||||
| - * @return Returns pointer to net_device_stats64 structure. | ||||
|   */ | ||||
| -struct rtnl_link_stats64 *nss_gmac_get_stats64(struct net_device *netdev, | ||||
| +void nss_gmac_get_stats64(struct net_device *netdev, | ||||
|  						struct rtnl_link_stats64 *stats) | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	BUG_ON(gmacdev == NULL); | ||||
|   | ||||
|  	if (!gmacdev->data_plane_ops) | ||||
| -		return stats; | ||||
| +		return; | ||||
|   | ||||
|  	spin_lock_bh(&gmacdev->stats_lock); | ||||
|  	gmacdev->data_plane_ops->get_stats(gmacdev->data_plane_ctx, &gmacdev->nss_stats); | ||||
| @@ -354,8 +353,6 @@ struct rtnl_link_stats64 *nss_gmac_get_s | ||||
|  	stats->tx_fifo_errors = gmacdev->nss_stats.tx_underflow_errors; | ||||
|  	stats->tx_window_errors = gmacdev->nss_stats.tx_late_collision_errors; | ||||
|  	spin_unlock_bh(&gmacdev->stats_lock); | ||||
| - | ||||
| -	return stats; | ||||
|  } | ||||
|   | ||||
|   | ||||
| @@ -439,7 +436,7 @@ static int nss_gmac_mtnp_show(struct dev | ||||
|  static int nss_gmac_tstamp_show(struct device *dev, struct device_attribute *attr, char *buf) | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(to_net_dev(dev)); | ||||
| -	struct timeval tv; | ||||
| +	struct timespec64 ts64; | ||||
|  	uint32_t ret, timeout; | ||||
|  	uint32_t ts_hi, ts_lo; | ||||
|   | ||||
| @@ -459,11 +456,12 @@ static int nss_gmac_tstamp_show(struct d | ||||
|  		return -1; | ||||
|  	} | ||||
|   | ||||
| -	do_gettimeofday(&tv); | ||||
| +	ktime_get_real_ts64(&ts64); | ||||
|   | ||||
|  	ret = snprintf( | ||||
|  		buf, PAGE_SIZE, | ||||
| -		"sec:%u nsec:%u time-of-day: %12d.%06d \n", ts_hi, ts_lo, (int)tv.tv_sec, (int)tv.tv_usec); | ||||
| +		"sec:%u nsec:%u time-of-day: %12d.%06d \n", \ | ||||
| +		ts_hi, ts_lo, (int)ts64.tv_sec, (int)(ts64.tv_nsec / NSEC_PER_USEC)); | ||||
|   | ||||
|  	return ret; | ||||
|  } | ||||
| @@ -951,7 +949,7 @@ static const struct net_device_ops nss_g | ||||
|   * @param[in] pointer to advertised features | ||||
|   * @return void | ||||
|   */ | ||||
| -static void nss_gmac_update_features(uint32_t *supp, uint32_t *adv) | ||||
| +static void nss_gmac_update_features(long unsigned int *supp, long unsigned int *adv) | ||||
|  { | ||||
|  	*supp |= NSS_GMAC_SUPPORTED_FEATURES; | ||||
|  	*adv |= NSS_GMAC_ADVERTISED_FEATURES; | ||||
| @@ -1409,8 +1407,8 @@ static int32_t nss_gmac_probe(struct pla | ||||
|  			goto nss_gmac_phy_attach_fail; | ||||
|  		} | ||||
|   | ||||
| -		nss_gmac_update_features(&(gmacdev->phydev->supported), | ||||
| -					&(gmacdev->phydev->advertising)); | ||||
| +		nss_gmac_update_features(gmacdev->phydev->supported, | ||||
| +					 gmacdev->phydev->advertising); | ||||
|  		gmacdev->phydev->irq = PHY_POLL; | ||||
|  		netdev_dbg(netdev, "PHY %s attach OK\n", phy_id); | ||||
|   | ||||
| @@ -1440,6 +1438,8 @@ static int32_t nss_gmac_probe(struct pla | ||||
|  		netdev_dbg(netdev, "%s MII_PHYSID2 - 0x%04x\n", netdev->name, | ||||
|  		      nss_gmac_mii_rd_reg(gmacdev, gmacdev->phy_base, MII_PHYSID2)); | ||||
|  	} else if (gmacdev->phy_base != NSS_GMAC_NO_MDIO_PHY) { | ||||
| +		SET_NETDEV_DEV(netdev, gmacdev->miibus->parent); | ||||
| + | ||||
|  		/* | ||||
|  		 * Issue a phy_attach for the interface connected to a switch | ||||
|  		 */ | ||||
| --- a/ipq806x/nss_gmac_ethtool.c | ||||
| +++ b/ipq806x/nss_gmac_ethtool.c | ||||
| @@ -143,9 +143,9 @@ static const struct nss_gmac_ethtool_sta | ||||
|  /** | ||||
|   * @brief Array of strings describing private flag names | ||||
|   */ | ||||
| -static const char *gmac_strings_priv_flags[] = { | ||||
| -	"linkpoll", | ||||
| -	"tstamp", | ||||
| +static const char *gmac_strings_priv_flags[][ETH_GSTRING_LEN] = { | ||||
| +	{"linkpoll"}, | ||||
| +	{"tstamp"}, | ||||
|  }; | ||||
|   | ||||
|  #define NSS_GMAC_STATS_LEN	ARRAY_SIZE(gmac_gstrings_stats) | ||||
| @@ -292,6 +292,7 @@ static int nss_gmac_set_pauseparam(struc | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	struct phy_device *phydev; | ||||
| +	long unsigned int *advertising; | ||||
|   | ||||
|  	BUG_ON(gmacdev == NULL); | ||||
|  	BUG_ON(gmacdev->netdev != netdev); | ||||
| @@ -327,14 +328,15 @@ static int nss_gmac_set_pauseparam(struc | ||||
|  	phydev = gmacdev->phydev; | ||||
|   | ||||
|  	/* Update flow control advertisment */ | ||||
| -	phydev->advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); | ||||
| +	advertising = phydev->advertising; | ||||
| +	*advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause); | ||||
|   | ||||
|  	if (gmacdev->pause & FLOW_CTRL_RX) | ||||
| -		phydev->advertising |= | ||||
| +		*advertising |= | ||||
|  				(ADVERTISED_Pause | ADVERTISED_Asym_Pause); | ||||
|   | ||||
|  	if (gmacdev->pause & FLOW_CTRL_TX) | ||||
| -		phydev->advertising |= ADVERTISED_Asym_Pause; | ||||
| +		*advertising |= ADVERTISED_Asym_Pause; | ||||
|   | ||||
|  	genphy_config_aneg(gmacdev->phydev); | ||||
|   | ||||
| @@ -396,12 +398,13 @@ static uint32_t nss_gmac_get_msglevel(st | ||||
|   * @param[in] pointer to struct net_device. | ||||
|   * @param[in] pointer to struct ethtool_cmd. | ||||
|   */ | ||||
| -static int32_t nss_gmac_get_settings(struct net_device *netdev, | ||||
| -			      struct ethtool_cmd *ecmd) | ||||
| +static int nss_gmac_get_settings(struct net_device *netdev, | ||||
| +				 struct ethtool_link_ksettings *elk) | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	struct phy_device *phydev = NULL; | ||||
|  	uint16_t phyreg; | ||||
| +	u32 lp_advertising = 0; | ||||
|   | ||||
|  	BUG_ON(gmacdev == NULL); | ||||
|   | ||||
| @@ -413,10 +416,10 @@ static int32_t nss_gmac_get_settings(str | ||||
|  	 */ | ||||
|  	if (!test_bit(__NSS_GMAC_LINKPOLL, &gmacdev->flags)) { | ||||
|  		if (gmacdev->forced_speed != SPEED_UNKNOWN) { | ||||
| -			ethtool_cmd_speed_set(ecmd, gmacdev->forced_speed); | ||||
| -			ecmd->duplex = gmacdev->forced_duplex; | ||||
| -			ecmd->mdio_support = 0; | ||||
| -			ecmd->lp_advertising = 0; | ||||
| +			elk->base.speed = gmacdev->forced_speed; | ||||
| +			elk->base.duplex = gmacdev->forced_duplex; | ||||
| +			elk->base.mdio_support = 0; | ||||
| +			ethtool_convert_legacy_u32_to_link_mode(elk->link_modes.lp_advertising, 0); | ||||
|  			return 0; | ||||
|  		} else { | ||||
|  			/* Non-link polled interfaced must have a forced | ||||
| @@ -429,63 +429,59 @@ static int32_t nss_gmac_get_settings(struct net_device *netdev, | ||||
|   | ||||
|  	/* update PHY status */ | ||||
|  	if (phydev->is_c45 == true) { | ||||
| -		ecmd->mdio_support = ETH_MDIO_SUPPORTS_C45; | ||||
| +		elk->base.mdio_support = ETH_MDIO_SUPPORTS_C45; | ||||
|  	} else { | ||||
|  		if (genphy_read_status(phydev) != 0) { | ||||
|  			return -EIO; | ||||
|  		} | ||||
| -		ecmd->mdio_support = ETH_MDIO_SUPPORTS_C22; | ||||
| +		elk->base.mdio_support = ETH_MDIO_SUPPORTS_C22; | ||||
|  	} | ||||
|   | ||||
|  	/* Populate capabilities advertised by self */ | ||||
| -	ecmd->advertising = phydev->advertising; | ||||
| +	bitmap_copy(elk->link_modes.advertising, phydev->advertising, __ETHTOOL_LINK_MODE_MASK_NBITS); | ||||
|   | ||||
| -	ecmd->autoneg = phydev->autoneg; | ||||
| - | ||||
| -	if (gmacdev->link_state == LINKDOWN) { | ||||
| -		ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN); | ||||
| -		ecmd->duplex = DUPLEX_UNKNOWN; | ||||
| -	} else { | ||||
| -		ethtool_cmd_speed_set(ecmd, phydev->speed); | ||||
| -		ecmd->duplex = phydev->duplex; | ||||
| -	} | ||||
| - | ||||
| -	ecmd->port = PORT_TP; | ||||
| -	ecmd->phy_address = gmacdev->phy_base; | ||||
| -	ecmd->transceiver = XCVR_EXTERNAL; | ||||
| +	elk->base.autoneg = phydev->autoneg; | ||||
| +	elk->base.speed = phydev->speed; | ||||
| +	elk->base.duplex = phydev->duplex; | ||||
| +	elk->base.port = PORT_TP; | ||||
| +	elk->base.phy_address = gmacdev->phy_base; | ||||
| +	elk->base.transceiver = XCVR_EXTERNAL; | ||||
|   | ||||
|  	/* Populate supported capabilities */ | ||||
| -	ecmd->supported = phydev->supported; | ||||
| +	bitmap_copy(elk->link_modes.supported, phydev->supported, __ETHTOOL_LINK_MODE_MASK_NBITS); | ||||
|   | ||||
|  	if (phydev->is_c45 == true) | ||||
|  		return 0; | ||||
|   | ||||
|  	/* Populate capabilities advertised by link partner */ | ||||
| +	ethtool_convert_link_mode_to_legacy_u32(&lp_advertising, elk->link_modes.lp_advertising); | ||||
|  	phyreg = nss_gmac_mii_rd_reg(gmacdev, gmacdev->phy_base, MII_LPA); | ||||
|  	if (phyreg & LPA_10HALF) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_10baseT_Half; | ||||
| +		lp_advertising |= ADVERTISED_10baseT_Half; | ||||
|   | ||||
|  	if (phyreg & LPA_10FULL) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_10baseT_Full; | ||||
| +		lp_advertising |= ADVERTISED_10baseT_Full; | ||||
|   | ||||
|  	if (phyreg & LPA_100HALF) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_100baseT_Half; | ||||
| +		lp_advertising |= ADVERTISED_100baseT_Half; | ||||
|   | ||||
|  	if (phyreg & LPA_100FULL) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_100baseT_Full; | ||||
| +		lp_advertising |= ADVERTISED_100baseT_Full; | ||||
|   | ||||
|  	if (phyreg & LPA_PAUSE_CAP) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_Pause; | ||||
| +		lp_advertising |= ADVERTISED_Pause; | ||||
|   | ||||
|  	if (phyreg & LPA_PAUSE_ASYM) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_Asym_Pause; | ||||
| +		lp_advertising |= ADVERTISED_Asym_Pause; | ||||
|   | ||||
|  	phyreg = nss_gmac_mii_rd_reg(gmacdev, gmacdev->phy_base, MII_STAT1000); | ||||
|  	if (phyreg & LPA_1000HALF) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_1000baseT_Half; | ||||
| +		lp_advertising |= ADVERTISED_1000baseT_Half; | ||||
|   | ||||
|  	if (phyreg & LPA_1000FULL) | ||||
| -		ecmd->lp_advertising |= ADVERTISED_1000baseT_Full; | ||||
| +		lp_advertising |= ADVERTISED_1000baseT_Full; | ||||
| + | ||||
| +	ethtool_convert_legacy_u32_to_link_mode(elk->link_modes.lp_advertising, lp_advertising); | ||||
|   | ||||
|  	return 0; | ||||
|  } | ||||
| @@ -489,8 +495,8 @@ static int32_t nss_gmac_get_settings(str | ||||
|   * @param[in] pointer to struct net_device. | ||||
|   * @param[in] pointer to struct ethtool_cmd. | ||||
|   */ | ||||
| -static int32_t nss_gmac_set_settings(struct net_device *netdev, | ||||
| -			      struct ethtool_cmd *ecmd) | ||||
| +static int nss_gmac_set_settings(struct net_device *netdev, | ||||
| +				 const struct ethtool_link_ksettings *elk) | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	struct phy_device *phydev = NULL; | ||||
| @@ -512,13 +518,13 @@ static int32_t nss_gmac_set_settings(str | ||||
|  		return -EPERM; | ||||
|  	} | ||||
|   | ||||
| -	if (ecmd->autoneg == AUTONEG_ENABLE) { | ||||
| +	if (elk->base.autoneg == AUTONEG_ENABLE) { | ||||
|  		set_bit(__NSS_GMAC_AUTONEG, &gmacdev->flags); | ||||
|  	} else { | ||||
|  		clear_bit(__NSS_GMAC_AUTONEG, &gmacdev->flags); | ||||
|  	} | ||||
|   | ||||
| -	return phy_ethtool_sset(phydev, ecmd); | ||||
| +	return phy_ethtool_ksettings_set(phydev, elk); | ||||
|  } | ||||
|   | ||||
|  /** | ||||
| @@ -580,8 +586,8 @@ struct ethtool_ops nss_gmac_ethtool_ops | ||||
|  	.set_pauseparam = &nss_gmac_set_pauseparam, | ||||
|  	.nway_reset = &nss_gmac_nway_reset, | ||||
|  	.get_wol = &nss_gmac_get_wol, | ||||
| -	.get_settings = &nss_gmac_get_settings, | ||||
| -	.set_settings = &nss_gmac_set_settings, | ||||
| +	.get_link_ksettings = &nss_gmac_get_settings, | ||||
| +	.set_link_ksettings = &nss_gmac_set_settings, | ||||
|  	.get_strings = &nss_gmac_get_strings, | ||||
|  	.get_sset_count = &nss_gmac_get_strset_count, | ||||
|  	.get_ethtool_stats = &nss_gmac_get_ethtool_stats, | ||||
							
								
								
									
										11
									
								
								package/qca/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								package/qca/qca-nss-gmac/patches/101-nss-gmac-test-ptr.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| --- a/ipq806x/nss_gmac_ctrl.c | ||||
| +++ b/ipq806x/nss_gmac_ctrl.c | ||||
| @@ -992,7 +992,7 @@ static int32_t nss_gmac_of_get_pdata(str | ||||
|  		return -EFAULT; | ||||
|  	} | ||||
|  	maddr = (uint8_t *)of_get_mac_address(np); | ||||
| -	if (maddr) | ||||
| +	if (!IS_ERR_OR_NULL(maddr)) | ||||
|  		memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); | ||||
|   | ||||
|  	if (of_address_to_resource(np, 0, &memres_devtree) != 0) | ||||
| @@ -0,0 +1,22 @@ | ||||
| --- a/ipq806x/nss_gmac_ctrl.c | ||||
| +++ b/ipq806x/nss_gmac_ctrl.c | ||||
| @@ -957,7 +957,6 @@ static int32_t nss_gmac_of_get_pdata(str | ||||
|  				     struct net_device *netdev, | ||||
|  				     struct msm_nss_gmac_platform_data *gmaccfg) | ||||
|  { | ||||
| -	uint8_t *maddr = NULL; | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	struct resource memres_devtree = {0}; | ||||
|   | ||||
| @@ -991,9 +990,8 @@ static int32_t nss_gmac_of_get_pdata(str | ||||
|  		pr_err("%s: Can't map interrupt\n", np->name); | ||||
|  		return -EFAULT; | ||||
|  	} | ||||
| -	maddr = (uint8_t *)of_get_mac_address(np); | ||||
| -	if (!IS_ERR_OR_NULL(maddr)) | ||||
| -		memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); | ||||
| + | ||||
| +	of_get_mac_address(np, gmaccfg->mac_addr); | ||||
|   | ||||
|  	if (of_address_to_resource(np, 0, &memres_devtree) != 0) | ||||
|  		return -EFAULT; | ||||
							
								
								
									
										40
									
								
								package/qca/qca-nss-gmac/patches/103-fix-ioremap-call.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								package/qca/qca-nss-gmac/patches/103-fix-ioremap-call.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| --- a/ipq806x/nss_gmac_dev.c | ||||
| +++ b/ipq806x/nss_gmac_dev.c | ||||
| @@ -1585,7 +1585,7 @@ int32_t nss_gmac_attach(struct nss_gmac_ | ||||
|  	} | ||||
|   | ||||
|  	/* ioremap addresses */ | ||||
| -	gmacdev->mac_base = ioremap_nocache(reg_base, | ||||
| +	gmacdev->mac_base = ioremap(reg_base, | ||||
|  						      NSS_GMAC_REG_BLOCK_LEN); | ||||
|  	if (!gmacdev->mac_base) { | ||||
|  		netdev_dbg(netdev, "ioremap fail.\n"); | ||||
| --- a/ipq806x/nss_gmac_ctrl.c | ||||
| +++ b/ipq806x/nss_gmac_ctrl.c | ||||
| @@ -1061,7 +1061,7 @@ static int32_t nss_gmac_do_common_init(s | ||||
|  	ctx.msm_clk_ctl_enabled = true; | ||||
|  #endif | ||||
|   | ||||
| -	ctx.nss_base = (uint8_t *)ioremap_nocache(res_nss_base.start, | ||||
| +	ctx.nss_base = (uint8_t *)ioremap(res_nss_base.start, | ||||
|  						  resource_size(&res_nss_base)); | ||||
|  	if (!ctx.nss_base) { | ||||
|  		pr_info("Error mapping NSS GMAC registers\n"); | ||||
| @@ -1070,7 +1070,7 @@ static int32_t nss_gmac_do_common_init(s | ||||
|  	} | ||||
|  	pr_debug("%s: NSS base ioremap OK.\n", __func__); | ||||
|   | ||||
| -	ctx.qsgmii_base = (uint32_t *)ioremap_nocache(res_qsgmii_base.start, | ||||
| +	ctx.qsgmii_base = (uint32_t *)ioremap(res_qsgmii_base.start, | ||||
|  					      resource_size(&res_qsgmii_base)); | ||||
|  	if (!ctx.qsgmii_base) { | ||||
|  		pr_info("Error mapping QSGMII registers\n"); | ||||
| @@ -1080,7 +1080,7 @@ static int32_t nss_gmac_do_common_init(s | ||||
|  	pr_debug("%s: QSGMII base ioremap OK, vaddr = 0x%p\n", | ||||
|  						__func__, ctx.qsgmii_base); | ||||
|   | ||||
| -	ctx.clk_ctl_base = (uint32_t *)ioremap_nocache(res_clk_ctl_base.start, | ||||
| +	ctx.clk_ctl_base = (uint32_t *)ioremap(res_clk_ctl_base.start, | ||||
|  				       resource_size(&res_clk_ctl_base)); | ||||
|  	if (!ctx.clk_ctl_base) { | ||||
|  		pr_info("Error mapping Clk control registers\n"); | ||||
| @@ -0,0 +1,21 @@ | ||||
| --- a/ipq806x/nss_gmac_ctrl.c | ||||
| +++ b/ipq806x/nss_gmac_ctrl.c | ||||
| @@ -959,6 +959,9 @@ static int32_t nss_gmac_of_get_pdata(str | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	struct resource memres_devtree = {0}; | ||||
| +	phy_interface_t phyif = 0; | ||||
| + | ||||
| +	 | ||||
|   | ||||
|  	if (of_property_read_u32(np, "qcom,id", &gmacdev->macid) | ||||
|  		|| of_property_read_u32(np, "qcom,phy-mdio-addr", | ||||
| @@ -984,7 +987,7 @@ static int32_t nss_gmac_of_get_pdata(str | ||||
|   | ||||
|  	of_property_read_u32(np, "qcom,aux-clk-freq", &gmacdev->aux_clk_freq); | ||||
|   | ||||
| -	gmaccfg->phy_mii_type = of_get_phy_mode(np); | ||||
| +	gmaccfg->phy_mii_type = of_get_phy_mode(np, &phyif); | ||||
|  	netdev->irq = irq_of_parse_and_map(np, 0); | ||||
|  	if (netdev->irq == NO_IRQ) { | ||||
|  		pr_err("%s: Can't map interrupt\n", np->name); | ||||
| @@ -0,0 +1,22 @@ | ||||
| --- a/ipq806x/include/nss_gmac_network_interface.h | ||||
| +++ b/ipq806x/include/nss_gmac_network_interface.h | ||||
| @@ -41,7 +41,7 @@ int32_t nss_gmac_xmit_frames(struct sk_b | ||||
|  int32_t nss_gmac_close(struct net_device *netdev); | ||||
|  int32_t nss_gmac_open(struct net_device *netdev); | ||||
|  int32_t nss_gmac_change_mtu(struct net_device *netdev, int32_t newmtu); | ||||
| -void nss_gmac_tx_timeout(struct net_device *netdev); | ||||
| +void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue); | ||||
|   | ||||
|  /* NSS driver interface APIs */ | ||||
|  void nss_gmac_receive(struct net_device *netdev, struct sk_buff *skb, | ||||
| --- a/ipq806x/nss_gmac_tx_rx_offload.c | ||||
| +++ b/ipq806x/nss_gmac_tx_rx_offload.c | ||||
| @@ -1044,7 +1044,7 @@ int nss_gmac_close(struct net_device *ne | ||||
|   * @param[in] pointer to net_device structure | ||||
|   * @return void. | ||||
|   */ | ||||
| -void nss_gmac_tx_timeout(struct net_device *netdev) | ||||
| +void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue) | ||||
|  { | ||||
|  	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); | ||||
|  	BUG_ON(gmacdev == NULL); | ||||
| @@ -0,0 +1,15 @@ | ||||
| --- a/ipq806x/nss_gmac_tx_rx_offload.c | ||||
| +++ b/ipq806x/nss_gmac_tx_rx_offload.c | ||||
| @@ -1027,8 +1027,10 @@ int nss_gmac_close(struct net_device *ne | ||||
|  	nss_gmac_disable_interrupt_all(gmacdev); | ||||
|  	gmacdev->data_plane_ops->link_state(gmacdev->data_plane_ctx, 0); | ||||
|   | ||||
| -	if (!IS_ERR(gmacdev->phydev)) | ||||
| -		phy_stop(gmacdev->phydev); | ||||
| +	if (!IS_ERR(gmacdev->phydev)) { | ||||
| +		if (test_bit(__NSS_GMAC_LINKPOLL, &gmacdev->flags)) | ||||
| +			phy_stop(gmacdev->phydev); | ||||
| +	} | ||||
|   | ||||
|  	clear_bit(__NSS_GMAC_UP, &gmacdev->flags); | ||||
|  	clear_bit(__NSS_GMAC_CLOSING, &gmacdev->flags); | ||||
| @@ -0,0 +1,20 @@ | ||||
| --- a/rfs_cm.c | ||||
| +++ b/rfs_cm.c | ||||
| @@ -709,7 +709,7 @@ int rfs_cm_start(void) | ||||
|   | ||||
|  	RFS_DEBUG("RFS cm start\n"); | ||||
|  #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||||
| -	ret = nf_conntrack_register_notifier(&init_net, &rfs_cm_conntrack_notifier); | ||||
| +	ret = nf_conntrack_register_chain_notifier(&init_net, &rfs_cm_conntrack_notifier); | ||||
|  	if (ret < 0) { | ||||
|  		RFS_ERROR("can't register nf notifier hook: %d\n", ret); | ||||
|  		return -1; | ||||
| @@ -740,7 +740,7 @@ int rfs_cm_stop(void) | ||||
|  #endif | ||||
|   | ||||
|  #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||||
| -	nf_conntrack_unregister_notifier(&init_net, &rfs_cm_conntrack_notifier); | ||||
| +	nf_conntrack_unregister_chain_notifier(&init_net, &rfs_cm_conntrack_notifier); | ||||
|  #endif | ||||
|   | ||||
|  	rfs_cm_connection_destroy_all(); | ||||
		Reference in New Issue
	
	Block a user
	 ACwifidude
					ACwifidude