Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Mahesh Kumar Kalikot Veetil | 7fc4829 | 2018-04-30 07:36:20 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #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 AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 31 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 32 | /* Linux headers */ |
| 33 | #include <linux/netdevice.h> /* net_device */ |
| 34 | |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 35 | struct hdd_context; |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 36 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 37 | #define HDD_NAPI_ANY (-1) |
| 38 | |
| 39 | int hdd_napi_enabled(int id); |
| 40 | int hdd_napi_create(void); |
| 41 | int hdd_napi_destroy(int force); |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 42 | int hdd_display_napi_stats(void); |
Yun Park | 1027e8c | 2017-10-13 15:17:37 -0700 | [diff] [blame] | 43 | int hdd_clear_napi_stats(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | |
| 45 | /* the following triggers napi_enable/disable as required */ |
| 46 | int hdd_napi_event(enum qca_napi_event event, void *data); |
| 47 | |
| 48 | int hdd_napi_poll(struct napi_struct *napi, int budget); |
| 49 | |
| 50 | struct qca_napi_data *hdd_napi_get_all(void); |
| 51 | |
Mahesh Kumar Kalikot Veetil | 7fc4829 | 2018-04-30 07:36:20 -0700 | [diff] [blame] | 52 | #if defined HELIUMPLUS && defined MSM_PLATFORM |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 53 | int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx, |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 54 | uint64_t tx_packets, |
| 55 | uint64_t rx_packets); |
Orhan K AKYILDIZ | ba175fc | 2016-09-16 00:30:49 -0700 | [diff] [blame] | 56 | int hdd_napi_serialize(int is_on); |
Mahesh Kumar Kalikot Veetil | 7fc4829 | 2018-04-30 07:36:20 -0700 | [diff] [blame] | 57 | #else |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 58 | static inline int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx, |
Manjunathappa Prakash | 169361e | 2016-09-12 13:27:18 -0700 | [diff] [blame] | 59 | uint64_t tx_packets, |
| 60 | uint64_t rx_packets) |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 61 | { |
| 62 | return 0; |
| 63 | } |
Orhan K AKYILDIZ | ba175fc | 2016-09-16 00:30:49 -0700 | [diff] [blame] | 64 | static inline int hdd_napi_serialize(int is_on) |
| 65 | { |
| 66 | return -EINVAL; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 67 | } |
Mahesh Kumar Kalikot Veetil | 7fc4829 | 2018-04-30 07:36:20 -0700 | [diff] [blame] | 68 | #endif /* HELIUMPLUS && MSM_PLATFORM */ |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 69 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | #else /* ! defined(FEATURE_NAPI) */ |
| 71 | #include "hif_napi.h" |
| 72 | /** |
| 73 | * Stub API |
| 74 | * |
| 75 | */ |
| 76 | |
| 77 | #define HDD_NAPI_ANY (-1) |
| 78 | |
| 79 | static inline int hdd_napi_enabled(int id) { return 0; } |
Manjunathappa Prakash | 34e9616 | 2016-04-21 16:19:31 -0700 | [diff] [blame] | 80 | static inline int hdd_napi_create(void) { return 0; } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | static inline int hdd_napi_destroy(int force) { return 0; } |
Mohit Khanna | 3e2115b | 2016-10-11 13:18:29 -0700 | [diff] [blame] | 82 | static inline int hdd_display_napi_stats(void) { return 0; } |
Yun Park | 1027e8c | 2017-10-13 15:17:37 -0700 | [diff] [blame] | 83 | static inline int hdd_clear_napi_stats(void) { return 0; } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | static inline int hdd_napi_event(enum qca_napi_event event, void *data) |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 85 | { |
| 86 | return 0; |
| 87 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 88 | static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; } |
Krishna Kumaar Natarajan | ea8f5e0 | 2016-09-27 14:56:57 -0700 | [diff] [blame] | 89 | static inline int hdd_napi_apply_throughput_policy(void *hdd_ctx, |
| 90 | uint64_t tx_packets, uint64_t rx_packets) |
Orhan K AKYILDIZ | 1481aff | 2016-05-16 12:40:13 -0700 | [diff] [blame] | 91 | { |
| 92 | return 0; |
| 93 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 94 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 95 | static inline int hdd_napi_serialize(int is_on) |
| 96 | { |
| 97 | return -EINVAL; |
| 98 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 99 | #endif /* FEATURE_NAPI */ |
| 100 | |
| 101 | #endif /* HDD_NAPI_H__ */ |