xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/dhd_linux_sock_qos.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Header file for DHD TPA (Traffic Pattern Analyzer)
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Provides type definitions and function prototypes to call into
5*4882a593Smuzhiyun  * DHD's QOS on Socket Flow module.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (C) 2020, Broadcom.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
10*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
11*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
12*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
13*4882a593Smuzhiyun  * following added to such license:
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
16*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
17*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
18*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
19*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
20*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
21*4882a593Smuzhiyun  * modifications of the software.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Open:>>
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * $Id$
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #ifndef _DHD_LINUX_TPA_H_
31*4882a593Smuzhiyun #define _DHD_LINUX_TPA_H_
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun struct dhd_sock_flow_info;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #if defined(DHD_QOS_ON_SOCK_FLOW)
36*4882a593Smuzhiyun #define QOS_SAMPLING_INTVL_MS 100
37*4882a593Smuzhiyun /* Feature Enabed original implementation */
38*4882a593Smuzhiyun int dhd_init_sock_flows_buf(dhd_info_t *dhd, uint watchdog_ms);
39*4882a593Smuzhiyun int dhd_deinit_sock_flows_buf(dhd_info_t *dhd);
40*4882a593Smuzhiyun void dhd_update_sock_flows(dhd_info_t *dhd, struct sk_buff *skb);
41*4882a593Smuzhiyun void dhd_analyze_sock_flows(dhd_info_t *dhd, uint32 watchdog_ms);
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun /* sysfs call backs */
44*4882a593Smuzhiyun unsigned long dhd_sock_qos_get_status(dhd_info_t *dhd);
45*4882a593Smuzhiyun void dhd_sock_qos_set_status(dhd_info_t *dhd, unsigned long on_off);
46*4882a593Smuzhiyun ssize_t dhd_sock_qos_show_stats(dhd_info_t *dhd, char *buf, ssize_t sz);
47*4882a593Smuzhiyun void dhd_sock_qos_clear_stats(dhd_info_t *dhd);
48*4882a593Smuzhiyun unsigned long dhd_sock_qos_get_force_upgrade(dhd_info_t *dhd);
49*4882a593Smuzhiyun void dhd_sock_qos_set_force_upgrade(dhd_info_t *dhd, unsigned long force_upgrade);
50*4882a593Smuzhiyun int dhd_sock_qos_get_numfl_upgrd_thresh(dhd_info_t *dhd);
51*4882a593Smuzhiyun void dhd_sock_qos_set_numfl_upgrd_thresh(dhd_info_t *dhd, int upgrade_thresh);
52*4882a593Smuzhiyun void dhd_sock_qos_get_avgpktsize_thresh(dhd_info_t *dhd,
53*4882a593Smuzhiyun 		unsigned long *avgpktsize_low,
54*4882a593Smuzhiyun 		unsigned long *avgpktsize_high);
55*4882a593Smuzhiyun void dhd_sock_qos_set_avgpktsize_thresh(dhd_info_t *dhd,
56*4882a593Smuzhiyun 		unsigned long avgpktsize_low,
57*4882a593Smuzhiyun 		unsigned long avgpktsize_high);
58*4882a593Smuzhiyun void dhd_sock_qos_get_numpkts_thresh(dhd_info_t *dhd,
59*4882a593Smuzhiyun 		unsigned long *numpkts_low,
60*4882a593Smuzhiyun 		unsigned long *numpkts_high);
61*4882a593Smuzhiyun void dhd_sock_qos_set_numpkts_thresh(dhd_info_t *dhd,
62*4882a593Smuzhiyun 		unsigned long numpkts_low,
63*4882a593Smuzhiyun 		unsigned long numpkts_high);
64*4882a593Smuzhiyun void dhd_sock_qos_get_detectcnt_thresh(dhd_info_t *dhd,
65*4882a593Smuzhiyun 		unsigned char *detectcnt_inc,
66*4882a593Smuzhiyun 		unsigned char *detectcnt_dec);
67*4882a593Smuzhiyun void dhd_sock_qos_set_detectcnt_thresh(dhd_info_t *dhd,
68*4882a593Smuzhiyun 		unsigned char detectcnt_inc,
69*4882a593Smuzhiyun 		unsigned char detectcnt_dec);
70*4882a593Smuzhiyun int dhd_sock_qos_get_detectcnt_upgrd_thresh(dhd_info_t *dhd);
71*4882a593Smuzhiyun void dhd_sock_qos_set_detectcnt_upgrd_thresh(dhd_info_t *dhd,
72*4882a593Smuzhiyun 		unsigned char detect_upgrd_thresh);
73*4882a593Smuzhiyun int dhd_sock_qos_get_maxfl(dhd_info_t *dhd);
74*4882a593Smuzhiyun void dhd_sock_qos_set_maxfl(dhd_info_t *dhd, unsigned int maxfl);
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun /* Update from Bus Layer */
77*4882a593Smuzhiyun void dhd_sock_qos_update_bus_flowid(dhd_info_t *dhd, void *pktbuf,
78*4882a593Smuzhiyun 	uint32 bus_flow_id);
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun #else
81*4882a593Smuzhiyun /* Feature Disabled dummy implementations */
82*4882a593Smuzhiyun 
dhd_init_sock_flows_buf(dhd_info_t * dhd,uint watchdog_ms)83*4882a593Smuzhiyun inline int dhd_init_sock_flows_buf(dhd_info_t *dhd, uint watchdog_ms)
84*4882a593Smuzhiyun {
85*4882a593Smuzhiyun 		BCM_REFERENCE(dhd);
86*4882a593Smuzhiyun 		return BCME_UNSUPPORTED;
87*4882a593Smuzhiyun }
88*4882a593Smuzhiyun 
dhd_deinit_sock_flows_buf(dhd_info_t * dhd)89*4882a593Smuzhiyun inline int dhd_deinit_sock_flows_buf(dhd_info_t *dhd)
90*4882a593Smuzhiyun {
91*4882a593Smuzhiyun 		BCM_REFERENCE(dhd);
92*4882a593Smuzhiyun 		return BCME_UNSUPPORTED;
93*4882a593Smuzhiyun }
94*4882a593Smuzhiyun 
dhd_update_sock_flows(dhd_info_t * dhd,struct sk_buff * skb)95*4882a593Smuzhiyun inline void dhd_update_sock_flows(dhd_info_t *dhd, struct sk_buff *skb)
96*4882a593Smuzhiyun {
97*4882a593Smuzhiyun 		BCM_REFERENCE(dhd);
98*4882a593Smuzhiyun 		BCM_REFERENCE(skb);
99*4882a593Smuzhiyun 		return;
100*4882a593Smuzhiyun }
101*4882a593Smuzhiyun 
dhd_analyze_sock_flows(dhd_info_t * dhd,uint32 watchdog_ms)102*4882a593Smuzhiyun inline void dhd_analyze_sock_flows(dhd_info_t *dhd, uint32 watchdog_ms)
103*4882a593Smuzhiyun {
104*4882a593Smuzhiyun 	BCM_REFERENCE(dhd);
105*4882a593Smuzhiyun 	BCM_REFERENCE(dhd_watchdog_ms);
106*4882a593Smuzhiyun 	return;
107*4882a593Smuzhiyun }
108*4882a593Smuzhiyun 
dhd_sock_qos_update_bus_flowid(dhd_info_t * dhd,void * pktbuf,uint32 bus_flow_id)109*4882a593Smuzhiyun inline void dhd_sock_qos_update_bus_flowid(dhd_info_t *dhd, void *pktbuf,
110*4882a593Smuzhiyun 	uint32 bus_flow_id)
111*4882a593Smuzhiyun {
112*4882a593Smuzhiyun 	BCM_REFERENCE(dhd);
113*4882a593Smuzhiyun 	BCM_REFERENCE(pktbuf);
114*4882a593Smuzhiyun 	BCM_REFERENCE(bus_flow_id);
115*4882a593Smuzhiyun }
116*4882a593Smuzhiyun #endif  /* End of !DHD_QOS_ON_SOCK_FLOW */
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #endif /* _DHD_LINUX_TPA_H_ */
119