blob: 9e008218a3dcb96160a4ed286ad545f6c283abc0 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Mahesh Kumar Kalikot Veetil7fc48292018-04-30 07:36:20 -07002 * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef __HDD_NAPI_H__
20#define __HDD_NAPI_H__
21
22#ifdef FEATURE_NAPI
23/**
24 * DOC: wlan_hdd_napi.h
25 *
26 * WLAN NAPI interface module headers
27 */
28
29/* CLD headers */
30#include "hif_napi.h"
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070031
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080032/* Linux headers */
33#include <linux/netdevice.h> /* net_device */
34
Jeff Johnson82797b62017-08-11 15:31:27 -070035struct hdd_context;
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070036
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037#define HDD_NAPI_ANY (-1)
38
39int hdd_napi_enabled(int id);
40int hdd_napi_create(void);
41int hdd_napi_destroy(int force);
Mohit Khanna3e2115b2016-10-11 13:18:29 -070042int hdd_display_napi_stats(void);
Yun Park1027e8c2017-10-13 15:17:37 -070043int hdd_clear_napi_stats(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080044
45/* the following triggers napi_enable/disable as required */
46int hdd_napi_event(enum qca_napi_event event, void *data);
47
48int hdd_napi_poll(struct napi_struct *napi, int budget);
49
50struct qca_napi_data *hdd_napi_get_all(void);
51
Mahesh Kumar Kalikot Veetil7fc48292018-04-30 07:36:20 -070052#if defined HELIUMPLUS && defined MSM_PLATFORM
Jeff Johnson82797b62017-08-11 15:31:27 -070053int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070054 uint64_t tx_packets,
55 uint64_t rx_packets);
Orhan K AKYILDIZba175fc2016-09-16 00:30:49 -070056int hdd_napi_serialize(int is_on);
Mahesh Kumar Kalikot Veetil7fc48292018-04-30 07:36:20 -070057#else
Jeff Johnson82797b62017-08-11 15:31:27 -070058static inline int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
Manjunathappa Prakash169361e2016-09-12 13:27:18 -070059 uint64_t tx_packets,
60 uint64_t rx_packets)
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070061{
62 return 0;
63}
Orhan K AKYILDIZba175fc2016-09-16 00:30:49 -070064static inline int hdd_napi_serialize(int is_on)
65{
66 return -EINVAL;
Leo Changfdb45c32016-10-28 11:09:23 -070067}
Mahesh Kumar Kalikot Veetil7fc48292018-04-30 07:36:20 -070068#endif /* HELIUMPLUS && MSM_PLATFORM */
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070069
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070#else /* ! defined(FEATURE_NAPI) */
71#include "hif_napi.h"
72/**
73 * Stub API
74 *
75 */
76
77#define HDD_NAPI_ANY (-1)
78
79static inline int hdd_napi_enabled(int id) { return 0; }
Manjunathappa Prakash34e96162016-04-21 16:19:31 -070080static inline int hdd_napi_create(void) { return 0; }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080081static inline int hdd_napi_destroy(int force) { return 0; }
Mohit Khanna3e2115b2016-10-11 13:18:29 -070082static inline int hdd_display_napi_stats(void) { return 0; }
Yun Park1027e8c2017-10-13 15:17:37 -070083static inline int hdd_clear_napi_stats(void) { return 0; }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084static inline int hdd_napi_event(enum qca_napi_event event, void *data)
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070085{
86 return 0;
87}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080088static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; }
Krishna Kumaar Natarajanea8f5e02016-09-27 14:56:57 -070089static inline int hdd_napi_apply_throughput_policy(void *hdd_ctx,
90 uint64_t tx_packets, uint64_t rx_packets)
Orhan K AKYILDIZ1481aff2016-05-16 12:40:13 -070091{
92 return 0;
93}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080094
Leo Changfdb45c32016-10-28 11:09:23 -070095static inline int hdd_napi_serialize(int is_on)
96{
97 return -EINVAL;
98}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080099#endif /* FEATURE_NAPI */
100
101#endif /* HDD_NAPI_H__ */