ipq806x: NSS Hardware Offloading Target Files
This commit is contained in:
		| @@ -0,0 +1,24 @@ | |||||||
|  | /* | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef __QCOM_NSS_VOL_SCALING_H | ||||||
|  | #define __QCOM_NSS_VOL_SCALING_H | ||||||
|  |  | ||||||
|  | #include <linux/regulator/consumer.h> | ||||||
|  |  | ||||||
|  | int nss_ramp_voltage(unsigned long rate, bool ramp_up); | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -0,0 +1,112 @@ | |||||||
|  | /* | ||||||
|  |  ************************************************************************** | ||||||
|  |  * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. | ||||||
|  |  * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. | ||||||
|  |  * Permission to use, copy, modify, and/or distribute this software for | ||||||
|  |  * any purpose with or without fee is hereby granted, provided that the | ||||||
|  |  * above copyright notice and this permission notice appear in all copies. | ||||||
|  |  * 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. | ||||||
|  |  ************************************************************************** | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* DSCP remark conntrack extension APIs. */ | ||||||
|  |  | ||||||
|  | #ifndef _NF_CONNTRACK_DSCPREMARK_H | ||||||
|  | #define _NF_CONNTRACK_DSCPREMARK_H | ||||||
|  | #include <net/netfilter/nf_conntrack.h> | ||||||
|  | #include <net/netfilter/nf_conntrack_extend.h> | ||||||
|  |  | ||||||
|  | /* Rule flags */ | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID 0x1 | ||||||
|  |  | ||||||
|  | /* Rule validity */ | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_RULE_VALID 0x1 | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID 0x0 | ||||||
|  |  | ||||||
|  | /* Which QoS features are set flags */ | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_PRIO 0x1 | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_DSCP 0x2 | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_IGS_QOS 0x4 | ||||||
|  | #define NF_CT_DSCPREMARK_EXT_MARK 0x8 | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * DSCP remark conntrack extension structure. | ||||||
|  |  */ | ||||||
|  | struct nf_ct_dscpremark_ext { | ||||||
|  | 	__u32 flow_priority;	/* Original direction packet priority */ | ||||||
|  | 	__u32 reply_priority;	/* Reply direction packet priority */ | ||||||
|  | 	__u32 flow_mark;	/* Original direction packet mark */ | ||||||
|  | 	__u32 reply_mark;	/* Reply direction packet mark */ | ||||||
|  | 	__u16 igs_flow_qos_tag;	/* Original direction ingress packet priority */ | ||||||
|  | 	__u16 igs_reply_qos_tag;	/* Reply direction ingress packet priority */ | ||||||
|  | 	__u8 flow_dscp;		/* IP DSCP value for original direction */ | ||||||
|  | 	__u8 reply_dscp;	/* IP DSCP value for reply direction */ | ||||||
|  | 	__u16 rule_flags;	/* Rule Validity flags */ | ||||||
|  | 	__u16 flow_set_flags;	/* Original direction set flags */ | ||||||
|  | 	__u16 return_set_flags;	/* Reply direction set flags */ | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * nf_ct_dscpremark_ext_find() | ||||||
|  |  *	Finds the extension data of the conntrack entry if it exists. | ||||||
|  |  */ | ||||||
|  | static inline struct nf_ct_dscpremark_ext * | ||||||
|  | nf_ct_dscpremark_ext_find(const struct nf_conn *ct) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT | ||||||
|  | 	return nf_ct_ext_find(ct, NF_CT_EXT_DSCPREMARK); | ||||||
|  | #else | ||||||
|  | 	return NULL; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * nf_ct_dscpremark_ext_add() | ||||||
|  |  *	Adds the extension data to the conntrack entry. | ||||||
|  |  */ | ||||||
|  | static inline | ||||||
|  | struct nf_ct_dscpremark_ext *nf_ct_dscpremark_ext_add(struct nf_conn *ct, | ||||||
|  | 						      gfp_t gfp) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT | ||||||
|  | 	struct nf_ct_dscpremark_ext *ncde; | ||||||
|  |  | ||||||
|  | 	ncde = nf_ct_ext_add(ct, NF_CT_EXT_DSCPREMARK, gfp); | ||||||
|  | 	if (!ncde) | ||||||
|  | 		return NULL; | ||||||
|  |  | ||||||
|  | 	return ncde; | ||||||
|  | #else | ||||||
|  | 	return NULL; | ||||||
|  | #endif | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | #ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT | ||||||
|  | extern int nf_conntrack_dscpremark_ext_init(void); | ||||||
|  | extern void nf_conntrack_dscpremark_ext_fini(void); | ||||||
|  | extern int nf_conntrack_dscpremark_ext_set_dscp_rule_valid(struct nf_conn *ct); | ||||||
|  | extern int | ||||||
|  | nf_conntrack_dscpremark_ext_get_dscp_rule_validity(struct nf_conn *ct); | ||||||
|  | #else | ||||||
|  | /* | ||||||
|  |  * nf_conntrack_dscpremark_ext_init() | ||||||
|  |  */ | ||||||
|  | static inline int nf_conntrack_dscpremark_ext_init(void) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * nf_conntrack_dscpremark_ext_fini() | ||||||
|  |  */ | ||||||
|  | static inline void nf_conntrack_dscpremark_ext_fini(void) | ||||||
|  | { | ||||||
|  | } | ||||||
|  | #endif /* CONFIG_NF_CONNTRACK_DSCPREMARK_EXT */ | ||||||
|  | #endif /* _NF_CONNTRACK_DSCPREMARK_H */ | ||||||
							
								
								
									
										435
									
								
								target/linux/ipq806x/files-5.15/include/soc/qcom/socinfo.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										435
									
								
								target/linux/ipq806x/files-5.15/include/soc/qcom/socinfo.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,435 @@ | |||||||
|  | /* Copyright (c) 2009-2014, 2016, 2020, The Linux Foundation. All rights reserved. | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or modify | ||||||
|  |  * it under the terms of the GNU General Public License version 2 and | ||||||
|  |  * only version 2 as published by the Free Software Foundation. | ||||||
|  |  * | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef _ARCH_ARM_MACH_MSM_SOCINFO_H_ | ||||||
|  | #define _ARCH_ARM_MACH_MSM_SOCINFO_H_ | ||||||
|  |  | ||||||
|  | #include <linux/of.h> | ||||||
|  |  | ||||||
|  | #define CPU_IPQ4018 272 | ||||||
|  | #define CPU_IPQ4019 273 | ||||||
|  | #define CPU_IPQ4028 287 | ||||||
|  | #define CPU_IPQ4029 288 | ||||||
|  |  | ||||||
|  | #define CPU_IPQ8062 201 | ||||||
|  | #define CPU_IPQ8064 202 | ||||||
|  | #define CPU_IPQ8066 203 | ||||||
|  | #define CPU_IPQ8065 280 | ||||||
|  | #define CPU_IPQ8068 204 | ||||||
|  | #define CPU_IPQ8069 281 | ||||||
|  |  | ||||||
|  | #define CPU_IPQ8074 323 | ||||||
|  | #define CPU_IPQ8072 342 | ||||||
|  | #define CPU_IPQ8076 343 | ||||||
|  | #define CPU_IPQ8078 344 | ||||||
|  | #define CPU_IPQ8070 375 | ||||||
|  | #define CPU_IPQ8071 376 | ||||||
|  |  | ||||||
|  | #define CPU_IPQ8072A 389 | ||||||
|  | #define CPU_IPQ8074A 390 | ||||||
|  | #define CPU_IPQ8076A 391 | ||||||
|  | #define CPU_IPQ8078A 392 | ||||||
|  | #define CPU_IPQ8070A 395 | ||||||
|  | #define CPU_IPQ8071A 396 | ||||||
|  |  | ||||||
|  | #define CPU_IPQ8172  397 | ||||||
|  | #define CPU_IPQ8173  398 | ||||||
|  | #define CPU_IPQ8174  399 | ||||||
|  |  | ||||||
|  | #define CPU_IPQ6018 402 | ||||||
|  | #define CPU_IPQ6028 403 | ||||||
|  | #define CPU_IPQ6000 421 | ||||||
|  | #define CPU_IPQ6010 422 | ||||||
|  | #define CPU_IPQ6005 453 | ||||||
|  |  | ||||||
|  | /* TBD the CHIP IDs */ | ||||||
|  | #define CPU_IPQ5000 425 | ||||||
|  | #define CPU_IPQ5010 426 | ||||||
|  | #define CPU_IPQ5018 427 | ||||||
|  |  | ||||||
|  | static inline const int* read_ipq_soc_version_major(void) | ||||||
|  | { | ||||||
|  | 	const int *prop; | ||||||
|  | 	prop = of_get_property(of_find_node_by_path("/"), "soc_version_major", | ||||||
|  | 				NULL); | ||||||
|  |  | ||||||
|  | 	return prop; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int read_ipq_cpu_type(void) | ||||||
|  | { | ||||||
|  | 	const int *prop; | ||||||
|  | 	prop = of_get_property(of_find_node_by_path("/"), "cpu_type", NULL); | ||||||
|  | 	/* | ||||||
|  | 	 * Return Default CPU type if "cpu_type" property is not found in DTSI | ||||||
|  | 	 */ | ||||||
|  | 	if (!prop) | ||||||
|  | 		return CPU_IPQ8064; | ||||||
|  | 	return *prop; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq4018(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ4018; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq4019(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ4019; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq4028(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ4028; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq4029(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ4029; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq40xx(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return  cpu_is_ipq4018() || cpu_is_ipq4019() || | ||||||
|  | 		cpu_is_ipq4028() || cpu_is_ipq4029(); | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8062(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8062; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8064(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8064; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8066(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8066; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8068(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8068; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8065(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8065; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8069(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8069; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | static inline int cpu_is_ipq806x(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return  cpu_is_ipq8062() || cpu_is_ipq8064() || | ||||||
|  | 		cpu_is_ipq8066() || cpu_is_ipq8068() || | ||||||
|  | 		cpu_is_ipq8065() || cpu_is_ipq8069(); | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8070(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8070; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8071(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8071; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8072(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8072; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8074(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8074; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8076(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8076; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8078(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8078; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8072a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8072A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8074a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8074A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8076a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8076A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8078a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8078A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8070a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8070A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8071a(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8071A; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8172(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8172; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8173(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8173; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq8174(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ8174; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq6018(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ6018; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq6028(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ6028; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq6000(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ6000; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq6010(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ6010; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq6005(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ6005; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq5000(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ5000; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq5010(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ5010; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq5018(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return read_ipq_cpu_type() == CPU_IPQ5018; | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq807x(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return  cpu_is_ipq8072() || cpu_is_ipq8074() || | ||||||
|  | 		cpu_is_ipq8076() || cpu_is_ipq8078() || | ||||||
|  | 		cpu_is_ipq8070() || cpu_is_ipq8071() || | ||||||
|  | 		cpu_is_ipq8072a() || cpu_is_ipq8074a() || | ||||||
|  | 		cpu_is_ipq8076a() || cpu_is_ipq8078a() || | ||||||
|  | 		cpu_is_ipq8070a() || cpu_is_ipq8071a() || | ||||||
|  | 		cpu_is_ipq8172() || cpu_is_ipq8173() || | ||||||
|  | 		cpu_is_ipq8174(); | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq60xx(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return  cpu_is_ipq6018() || cpu_is_ipq6028() || | ||||||
|  | 		cpu_is_ipq6000() || cpu_is_ipq6010() || | ||||||
|  | 		cpu_is_ipq6005(); | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static inline int cpu_is_ipq50xx(void) | ||||||
|  | { | ||||||
|  | #ifdef CONFIG_ARCH_QCOM | ||||||
|  | 	return  cpu_is_ipq5000() || cpu_is_ipq5010() || | ||||||
|  | 		cpu_is_ipq5018(); | ||||||
|  | #else | ||||||
|  | 	return 0; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif /* _ARCH_ARM_MACH_MSM_SOCINFO_H_ */ | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | #ifndef __LINUX_TC_NSS_MIRRED_H | ||||||
|  | #define __LINUX_TC_NSS_MIRRED_H | ||||||
|  |  | ||||||
|  | #include <linux/pkt_cls.h> | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Type of nss mirred action. | ||||||
|  |  */ | ||||||
|  | #define TCA_ACT_MIRRED_NSS 17 | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Types of parameters for nss mirred action. | ||||||
|  |  */ | ||||||
|  | enum { | ||||||
|  | 	TC_NSS_MIRRED_UNSPEC, | ||||||
|  | 	TC_NSS_MIRRED_TM, | ||||||
|  | 	TC_NSS_MIRRED_PARMS, | ||||||
|  | 	__TC_NSS_MIRRED_MAX | ||||||
|  | }; | ||||||
|  | #define TC_NSS_MIRRED_MAX (__TC_NSS_MIRRED_MAX - 1) | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * tc_nss_mirred | ||||||
|  |  *	tc command structure for nss mirred action. | ||||||
|  |  */ | ||||||
|  | struct tc_nss_mirred { | ||||||
|  | 	tc_gen;			/* General tc structure. */ | ||||||
|  | 	__u32 from_ifindex;	/* ifindex of the port from which traffic | ||||||
|  | 				 * will be redirected. | ||||||
|  | 				 */ | ||||||
|  | 	__u32 to_ifindex;	/* ifindex of the port to which traffic | ||||||
|  | 				 * will be redirected. | ||||||
|  | 				 */ | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | #endif	/* __LINUX_TC_NSS_MIRRED_H */ | ||||||
| @@ -0,0 +1,92 @@ | |||||||
|  | /* | ||||||
|  |  ************************************************************************** | ||||||
|  |  * Copyright (c) 2014-2015, 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. | ||||||
|  |  ************************************************************************** | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* DSCP remark handling conntrack extension registration. */ | ||||||
|  |  | ||||||
|  | #include <linux/netfilter.h> | ||||||
|  | #include <linux/slab.h> | ||||||
|  | #include <linux/kernel.h> | ||||||
|  | #include <linux/moduleparam.h> | ||||||
|  | #include <linux/export.h> | ||||||
|  |  | ||||||
|  | #include <net/netfilter/nf_conntrack.h> | ||||||
|  | #include <net/netfilter/nf_conntrack_extend.h> | ||||||
|  | #include <net/netfilter/nf_conntrack_dscpremark_ext.h> | ||||||
|  |  | ||||||
|  | /* DSCP remark conntrack extension type declaration */ | ||||||
|  | static struct nf_ct_ext_type dscpremark_extend __read_mostly = { | ||||||
|  | 	.len = sizeof(struct nf_ct_dscpremark_ext), | ||||||
|  | 	.align = __alignof__(struct nf_ct_dscpremark_ext), | ||||||
|  | 	.id = NF_CT_EXT_DSCPREMARK, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | /* nf_conntrack_dscpremark_ext_init() | ||||||
|  |  *	Initializes the DSCP remark conntrack extension. | ||||||
|  |  */ | ||||||
|  | int nf_conntrack_dscpremark_ext_init(void) | ||||||
|  | { | ||||||
|  | 	int ret; | ||||||
|  |  | ||||||
|  | 	ret = nf_ct_extend_register(&dscpremark_extend); | ||||||
|  | 	if (ret < 0) { | ||||||
|  | 		pr_warn("nf_conntrack_dscpremark: Unable to register extension\n"); | ||||||
|  | 		return ret; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* nf_conntrack_dscpremark_ext_set_dscp_rule_valid() | ||||||
|  |  *	Set DSCP rule validity flag in the extension | ||||||
|  |  */ | ||||||
|  | int nf_conntrack_dscpremark_ext_set_dscp_rule_valid(struct nf_conn *ct) | ||||||
|  | { | ||||||
|  | 	struct nf_ct_dscpremark_ext *ncde; | ||||||
|  |  | ||||||
|  | 	ncde = nf_ct_dscpremark_ext_find(ct); | ||||||
|  | 	if (!ncde) | ||||||
|  | 		return -1; | ||||||
|  |  | ||||||
|  | 	ncde->rule_flags = NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID; | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | EXPORT_SYMBOL(nf_conntrack_dscpremark_ext_set_dscp_rule_valid); | ||||||
|  |  | ||||||
|  | /* nf_conntrack_dscpremark_ext_get_dscp_rule_validity() | ||||||
|  |  *	Check if the DSCP rule flag is valid from the extension | ||||||
|  |  */ | ||||||
|  | int nf_conntrack_dscpremark_ext_get_dscp_rule_validity(struct nf_conn *ct) | ||||||
|  | { | ||||||
|  | 	struct nf_ct_dscpremark_ext *ncde; | ||||||
|  |  | ||||||
|  | 	ncde = nf_ct_dscpremark_ext_find(ct); | ||||||
|  | 	if (!ncde) | ||||||
|  | 		return NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID; | ||||||
|  |  | ||||||
|  | 	if (ncde->rule_flags & NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID) | ||||||
|  | 		return NF_CT_DSCPREMARK_EXT_RULE_VALID; | ||||||
|  |  | ||||||
|  | 	return NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID; | ||||||
|  | } | ||||||
|  | EXPORT_SYMBOL(nf_conntrack_dscpremark_ext_get_dscp_rule_validity); | ||||||
|  |  | ||||||
|  | /* nf_conntrack_dscpremark_ext_fini() | ||||||
|  |  *	De-initializes the DSCP remark conntrack extension. | ||||||
|  |  */ | ||||||
|  | void nf_conntrack_dscpremark_ext_fini(void) | ||||||
|  | { | ||||||
|  | 	nf_ct_extend_unregister(&dscpremark_extend); | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 ACwifidude
					ACwifidude