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