summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wlcore/hw_ops.h
blob: 0cd8723075269bce9dc36aa1e959e3a8382911c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * This file is part of wlcore
 *
 * Copyright (C) 2011 Texas Instruments Inc.
 */

#ifndef __WLCORE_HW_OPS_H__
#define __WLCORE_HW_OPS_H__

#include "wlcore.h"
#include "rx.h"

static inline u32
wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
{
	if (!wl->ops->calc_tx_blocks)
		BUG_ON(1);

	return wl->ops->calc_tx_blocks(wl, len, spare_blks);
}

static inline void
wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
			     u32 blks, u32 spare_blks)
{
	if (!wl->ops->set_tx_desc_blocks)
		BUG_ON(1);

	return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks);
}

static inline void
wlcore_hw_set_tx_desc_data_len(struct wl1271 *wl,
			       struct wl1271_tx_hw_descr *desc,
			       struct sk_buff *skb)
{
	if (!wl->ops->set_tx_desc_data_len)
		BUG_ON(1);

	wl->ops->set_tx_desc_data_len(wl, desc, skb);
}

static inline enum wl_rx_buf_align
wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc)
{

	if (!wl->ops->get_rx_buf_align)
		BUG_ON(1);

	return wl->ops->get_rx_buf_align(wl, rx_desc);
}

static inline int
wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len)
{
	if (wl->ops->prepare_read)
		return wl->ops->prepare_read(wl, rx_desc, len);

	return 0;
}

static inline u32
wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len)
{
	if (!wl->ops->get_rx_packet_len)
		BUG_ON(1);

	return wl->ops->get_rx_packet_len(wl, rx_data, data_len);
}

static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl)
{
	if (wl->ops->tx_delayed_compl)
		return wl->ops->tx_delayed_compl(wl);

	return 0;
}

static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl)
{
	if (wl->ops->tx_immediate_compl)
		wl->ops->tx_immediate_compl(wl);
}

static inline int
wlcore_hw_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
	if (wl->ops->init_vif)
		return wl->ops->init_vif(wl, wlvif);

	return 0;
}

static inline void
wlcore_hw_convert_fw_status(struct wl1271 *wl, void *raw_fw_status,
			    struct wl_fw_status *fw_status)
{
	BUG_ON(!wl->ops->convert_fw_status);

	wl->ops->convert_fw_status(wl, raw_fw_status, fw_status);
}

static inline u32
wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
	if (!wl->ops->sta_get_ap_rate_mask)
		BUG_ON(1);

	return wl->ops->sta_get_ap_rate_mask(wl, wlvif);
}

static inline int wlcore_identify_fw(struct wl1271 *wl)
{
	if (wl->ops->identify_fw)
		return wl->ops->identify_fw(wl);

	return 0;
}

static inline void
wlcore_hw_set_tx_desc_csum(struct wl1271 *wl,
			   struct wl1271_tx_hw_descr *desc,
			   struct sk_buff *skb)
{
	if (!wl->ops->set_tx_desc_csum)
		BUG_ON(1);

	wl->ops->set_tx_desc_csum(wl, desc, skb);
}

static inline void
wlcore_hw_set_rx_csum(struct wl1271 *wl,
		      struct wl1271_rx_descriptor *desc,
		      struct sk_buff *skb)
{
	if (wl->ops->set_rx_csum)
		wl->ops->set_rx_csum(wl, desc, skb);
}

static inline u32
wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
				     struct wl12xx_vif *wlvif)
{
	if (wl->ops->ap_get_mimo_wide_rate_mask)
		return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif);

	return 0;
}

static inline int
wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir)
{
	if (wl->ops->debugfs_init)
		return wl->ops->debugfs_init(wl, rootdir);

	return 0;
}

static inline int
wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
{
	if (wl->ops->handle_static_data)
		return wl->ops->handle_static_data(wl, static_data);

	return 0;
}

static inline int
wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem)
{
	if (!wl->ops->get_spare_blocks)
		BUG_ON(1);

	return wl->ops->get_spare_blocks(wl, is_gem);
}

static inline int
wlcore_hw_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
		  struct ieee80211_vif *vif,
		  struct ieee80211_sta *sta,
		  struct ieee80211_key_conf *key_conf)
{
	if (!wl->ops->set_key)
		BUG_ON(1);

	return wl->ops->set_key(wl, cmd, vif, sta, key_conf);
}

static inline u32
wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len)
{
	if (wl->ops->pre_pkt_send)
		return wl->ops->pre_pkt_send(wl, buf_offset, last_len);

	return buf_offset;
}

static inline void
wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
	if (wl->ops->sta_rc_update)
		wl->ops->sta_rc_update(wl, wlvif);
}

static inline int
wlcore_hw_interrupt_notify(struct wl1271 *wl, bool action)
{
	if (wl->ops->interrupt_notify)
		return wl->ops->interrupt_notify(wl, action);
	return 0;
}

static inline int
wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
{
	if (wl->ops->rx_ba_filter)
		return wl->ops->rx_ba_filter(wl, action);
	return 0;
}

static inline int
wlcore_hw_ap_sleep(struct wl1271 *wl)
{
	if (wl->ops->ap_sleep)
		return wl->ops->ap_sleep(wl);

	return 0;
}

static inline int
wlcore_hw_set_peer_cap(struct wl1271 *wl,
		       struct ieee80211_sta_ht_cap *ht_cap,
		       bool allow_ht_operation,
		       u32 rate_set, u8 hlid)
{
	if (wl->ops->set_peer_cap)
		return wl->ops->set_peer_cap(wl, ht_cap, allow_ht_operation,
					     rate_set, hlid);

	return 0;
}

static inline u32
wlcore_hw_convert_hwaddr(struct wl1271 *wl, u32 hwaddr)
{
	if (!wl->ops->convert_hwaddr)
		BUG_ON(1);

	return wl->ops->convert_hwaddr(wl, hwaddr);
}

static inline bool
wlcore_hw_lnk_high_prio(struct wl1271 *wl, u8 hlid,
			struct wl1271_link *lnk)
{
	if (!wl->ops->lnk_high_prio)
		BUG_ON(1);

	return wl->ops->lnk_high_prio(wl, hlid, lnk);
}

static inline bool
wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
		       struct wl1271_link *lnk)
{
	if (!wl->ops->lnk_low_prio)
		BUG_ON(1);

	return wl->ops->lnk_low_prio(wl, hlid, lnk);
}

static inline int
wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
{
	if (!wl->ops->smart_config_start)
		return -EINVAL;

	return wl->ops->smart_config_start(wl, group_bitmap);
}

static inline int
wlcore_smart_config_stop(struct wl1271 *wl)
{
	if (!wl->ops->smart_config_stop)
		return -EINVAL;

	return wl->ops->smart_config_stop(wl);
}

static inline int
wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
				  u8 key_len, u8 *key)
{
	if (!wl->ops->smart_config_set_group_key)
		return -EINVAL;

	return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
}

static inline int
wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
{
	if (!wl->ops->set_cac)
		return -EINVAL;

	return wl->ops->set_cac(wl, wlvif, start);
}

static inline int
wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
	if (!wl->ops->dfs_master_restart)
		return -EINVAL;

	return wl->ops->dfs_master_restart(wl, wlvif);
}
#endif