1
2
3
4
5
6
7#ifndef __iwl_op_mode_h__
8#define __iwl_op_mode_h__
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12
13struct iwl_op_mode;
14struct iwl_trans;
15struct sk_buff;
16struct iwl_device_cmd;
17struct iwl_rx_cmd_buffer;
18struct iwl_fw;
19struct iwl_cfg;
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87struct iwl_op_mode_ops {
88 struct iwl_op_mode *(*start)(struct iwl_trans *trans,
89 const struct iwl_cfg *cfg,
90 const struct iwl_fw *fw,
91 struct dentry *dbgfs_dir);
92 void (*stop)(struct iwl_op_mode *op_mode);
93 void (*rx)(struct iwl_op_mode *op_mode, struct napi_struct *napi,
94 struct iwl_rx_cmd_buffer *rxb);
95 void (*rx_rss)(struct iwl_op_mode *op_mode, struct napi_struct *napi,
96 struct iwl_rx_cmd_buffer *rxb, unsigned int queue);
97 void (*async_cb)(struct iwl_op_mode *op_mode,
98 const struct iwl_device_cmd *cmd);
99 void (*queue_full)(struct iwl_op_mode *op_mode, int queue);
100 void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue);
101 bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state);
102 void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb);
103 void (*nic_error)(struct iwl_op_mode *op_mode);
104 void (*cmd_queue_full)(struct iwl_op_mode *op_mode);
105 void (*nic_config)(struct iwl_op_mode *op_mode);
106 void (*wimax_active)(struct iwl_op_mode *op_mode);
107};
108
109int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops);
110void iwl_opmode_deregister(const char *name);
111
112
113
114
115
116
117
118struct iwl_op_mode {
119 const struct iwl_op_mode_ops *ops;
120
121 char op_mode_specific[] __aligned(sizeof(void *));
122};
123
124static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode)
125{
126 might_sleep();
127 op_mode->ops->stop(op_mode);
128}
129
130static inline void iwl_op_mode_rx(struct iwl_op_mode *op_mode,
131 struct napi_struct *napi,
132 struct iwl_rx_cmd_buffer *rxb)
133{
134 return op_mode->ops->rx(op_mode, napi, rxb);
135}
136
137static inline void iwl_op_mode_rx_rss(struct iwl_op_mode *op_mode,
138 struct napi_struct *napi,
139 struct iwl_rx_cmd_buffer *rxb,
140 unsigned int queue)
141{
142 op_mode->ops->rx_rss(op_mode, napi, rxb, queue);
143}
144
145static inline void iwl_op_mode_async_cb(struct iwl_op_mode *op_mode,
146 const struct iwl_device_cmd *cmd)
147{
148 if (op_mode->ops->async_cb)
149 op_mode->ops->async_cb(op_mode, cmd);
150}
151
152static inline void iwl_op_mode_queue_full(struct iwl_op_mode *op_mode,
153 int queue)
154{
155 op_mode->ops->queue_full(op_mode, queue);
156}
157
158static inline void iwl_op_mode_queue_not_full(struct iwl_op_mode *op_mode,
159 int queue)
160{
161 op_mode->ops->queue_not_full(op_mode, queue);
162}
163
164static inline bool __must_check
165iwl_op_mode_hw_rf_kill(struct iwl_op_mode *op_mode, bool state)
166{
167 might_sleep();
168 return op_mode->ops->hw_rf_kill(op_mode, state);
169}
170
171static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode,
172 struct sk_buff *skb)
173{
174 op_mode->ops->free_skb(op_mode, skb);
175}
176
177static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode)
178{
179 op_mode->ops->nic_error(op_mode);
180}
181
182static inline void iwl_op_mode_cmd_queue_full(struct iwl_op_mode *op_mode)
183{
184 op_mode->ops->cmd_queue_full(op_mode);
185}
186
187static inline void iwl_op_mode_nic_config(struct iwl_op_mode *op_mode)
188{
189 might_sleep();
190 op_mode->ops->nic_config(op_mode);
191}
192
193static inline void iwl_op_mode_wimax_active(struct iwl_op_mode *op_mode)
194{
195 might_sleep();
196 op_mode->ops->wimax_active(op_mode);
197}
198
199#endif
200