xref: /wlan-driver/qcacld-3.0/core/hdd/inc/wlan_hdd_napi.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name #ifndef __HDD_NAPI_H__
21*5113495bSYour Name #define __HDD_NAPI_H__
22*5113495bSYour Name 
23*5113495bSYour Name #ifdef FEATURE_NAPI
24*5113495bSYour Name /**
25*5113495bSYour Name  * DOC: wlan_hdd_napi.h
26*5113495bSYour Name  *
27*5113495bSYour Name  * WLAN NAPI interface module headers
28*5113495bSYour Name  */
29*5113495bSYour Name 
30*5113495bSYour Name /* CLD headers */
31*5113495bSYour Name #include "hif_napi.h"
32*5113495bSYour Name 
33*5113495bSYour Name /* Linux headers */
34*5113495bSYour Name #include <linux/netdevice.h> /* net_device */
35*5113495bSYour Name 
36*5113495bSYour Name struct hdd_context;
37*5113495bSYour Name 
38*5113495bSYour Name #define HDD_NAPI_ANY (-1)
39*5113495bSYour Name 
40*5113495bSYour Name int hdd_napi_enabled(int id);
41*5113495bSYour Name int hdd_napi_create(void);
42*5113495bSYour Name int hdd_napi_destroy(int force);
43*5113495bSYour Name int hdd_display_napi_stats(void);
44*5113495bSYour Name int hdd_clear_napi_stats(void);
45*5113495bSYour Name 
46*5113495bSYour Name /* the following triggers napi_enable/disable as required */
47*5113495bSYour Name int hdd_napi_event(enum qca_napi_event event, void *data);
48*5113495bSYour Name 
49*5113495bSYour Name int hdd_napi_poll(struct napi_struct *napi, int budget);
50*5113495bSYour Name 
51*5113495bSYour Name struct qca_napi_data *hdd_napi_get_all(void);
52*5113495bSYour Name 
53*5113495bSYour Name #if defined HELIUMPLUS && defined MSM_PLATFORM
54*5113495bSYour Name int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
55*5113495bSYour Name 				     uint64_t              tx_packets,
56*5113495bSYour Name 				     uint64_t              rx_packets);
57*5113495bSYour Name int hdd_napi_serialize(int is_on);
58*5113495bSYour Name #else
hdd_napi_apply_throughput_policy(struct hdd_context * hddctx,uint64_t tx_packets,uint64_t rx_packets)59*5113495bSYour Name static inline int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
60*5113495bSYour Name 						   uint64_t tx_packets,
61*5113495bSYour Name 						   uint64_t rx_packets)
62*5113495bSYour Name {
63*5113495bSYour Name 	return 0;
64*5113495bSYour Name }
hdd_napi_serialize(int is_on)65*5113495bSYour Name static inline int hdd_napi_serialize(int is_on)
66*5113495bSYour Name {
67*5113495bSYour Name 	return -EINVAL;
68*5113495bSYour Name }
69*5113495bSYour Name #endif /* HELIUMPLUS && MSM_PLATFORM */
70*5113495bSYour Name 
71*5113495bSYour Name #else /* ! defined(FEATURE_NAPI) */
72*5113495bSYour Name #include "hif_napi.h"
73*5113495bSYour Name /*
74*5113495bSYour Name  * Stub API
75*5113495bSYour Name  *
76*5113495bSYour Name  */
77*5113495bSYour Name 
78*5113495bSYour Name #define HDD_NAPI_ANY (-1)
79*5113495bSYour Name 
hdd_napi_enabled(int id)80*5113495bSYour Name static inline int hdd_napi_enabled(int id) { return 0; }
hdd_napi_create(void)81*5113495bSYour Name static inline int hdd_napi_create(void) { return 0; }
hdd_napi_destroy(int force)82*5113495bSYour Name static inline int hdd_napi_destroy(int force) { return 0; }
hdd_display_napi_stats(void)83*5113495bSYour Name static inline int hdd_display_napi_stats(void) { return 0; }
hdd_clear_napi_stats(void)84*5113495bSYour Name static inline int hdd_clear_napi_stats(void) { return 0; }
hdd_napi_event(enum qca_napi_event event,void * data)85*5113495bSYour Name static inline int hdd_napi_event(enum qca_napi_event event, void *data)
86*5113495bSYour Name {
87*5113495bSYour Name 	return 0;
88*5113495bSYour Name }
hdd_napi_get_all(void)89*5113495bSYour Name static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; }
hdd_napi_apply_throughput_policy(void * hdd_ctx,uint64_t tx_packets,uint64_t rx_packets)90*5113495bSYour Name static inline int hdd_napi_apply_throughput_policy(void *hdd_ctx,
91*5113495bSYour Name 				uint64_t tx_packets, uint64_t rx_packets)
92*5113495bSYour Name {
93*5113495bSYour Name 	return 0;
94*5113495bSYour Name }
95*5113495bSYour Name 
hdd_napi_serialize(int is_on)96*5113495bSYour Name static inline int hdd_napi_serialize(int is_on)
97*5113495bSYour Name {
98*5113495bSYour Name 	return -EINVAL;
99*5113495bSYour Name }
100*5113495bSYour Name #endif /* FEATURE_NAPI */
101*5113495bSYour Name 
102*5113495bSYour Name #endif /*  HDD_NAPI_H__ */
103