rdev-ops.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. #ifndef __CFG80211_RDEV_OPS
  2. #define __CFG80211_RDEV_OPS
  3. #include <linux/rtnetlink.h>
  4. #include <net/cfg80211.h>
  5. #include "core.h"
  6. static inline int rdev_suspend(struct cfg80211_registered_device *rdev)
  7. {
  8. return rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
  9. }
  10. static inline int rdev_resume(struct cfg80211_registered_device *rdev)
  11. {
  12. return rdev->ops->resume(&rdev->wiphy);
  13. }
  14. static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
  15. bool enabled)
  16. {
  17. rdev->ops->set_wakeup(&rdev->wiphy, enabled);
  18. }
  19. static inline struct wireless_dev
  20. *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
  21. enum nl80211_iftype type, u32 *flags,
  22. struct vif_params *params)
  23. {
  24. return rdev->ops->add_virtual_intf(&rdev->wiphy, name, type, flags,
  25. params);
  26. }
  27. static inline int
  28. rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
  29. struct wireless_dev *wdev)
  30. {
  31. return rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
  32. }
  33. static inline int
  34. rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
  35. struct net_device *dev, enum nl80211_iftype type,
  36. u32 *flags, struct vif_params *params)
  37. {
  38. return rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
  39. params);
  40. }
  41. static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
  42. struct net_device *netdev, u8 key_index,
  43. bool pairwise, const u8 *mac_addr,
  44. struct key_params *params)
  45. {
  46. return rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
  47. mac_addr, params);
  48. }
  49. static inline int
  50. rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
  51. u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
  52. void (*callback)(void *cookie, struct key_params*))
  53. {
  54. return rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
  55. mac_addr, cookie, callback);
  56. }
  57. static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
  58. struct net_device *netdev, u8 key_index,
  59. bool pairwise, const u8 *mac_addr)
  60. {
  61. return rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
  62. mac_addr);
  63. }
  64. static inline int
  65. rdev_set_default_key(struct cfg80211_registered_device *rdev,
  66. struct net_device *netdev, u8 key_index, bool unicast,
  67. bool multicast)
  68. {
  69. return rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
  70. unicast, multicast);
  71. }
  72. static inline int
  73. rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
  74. struct net_device *netdev, u8 key_index)
  75. {
  76. return rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
  77. key_index);
  78. }
  79. static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
  80. struct net_device *dev,
  81. struct cfg80211_ap_settings *settings)
  82. {
  83. return rdev->ops->start_ap(&rdev->wiphy, dev, settings);
  84. }
  85. static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
  86. struct net_device *dev,
  87. struct cfg80211_beacon_data *info)
  88. {
  89. return rdev->ops->change_beacon(&rdev->wiphy, dev, info);
  90. }
  91. static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
  92. struct net_device *dev)
  93. {
  94. return rdev->ops->stop_ap(&rdev->wiphy, dev);
  95. }
  96. static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
  97. struct net_device *dev, u8 *mac,
  98. struct station_parameters *params)
  99. {
  100. return rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
  101. }
  102. static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
  103. struct net_device *dev, u8 *mac)
  104. {
  105. return rdev->ops->del_station(&rdev->wiphy, dev, mac);
  106. }
  107. static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
  108. struct net_device *dev, u8 *mac,
  109. struct station_parameters *params)
  110. {
  111. return rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
  112. }
  113. static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
  114. struct net_device *dev, u8 *mac,
  115. struct station_info *sinfo)
  116. {
  117. return rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
  118. }
  119. static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
  120. struct net_device *dev, int idx, u8 *mac,
  121. struct station_info *sinfo)
  122. {
  123. return rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
  124. }
  125. static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
  126. struct net_device *dev, u8 *dst, u8 *next_hop)
  127. {
  128. return rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
  129. }
  130. static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
  131. struct net_device *dev, u8 *dst)
  132. {
  133. return rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
  134. }
  135. static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
  136. struct net_device *dev, u8 *dst,
  137. u8 *next_hop)
  138. {
  139. return rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
  140. }
  141. static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
  142. struct net_device *dev, u8 *dst, u8 *next_hop,
  143. struct mpath_info *pinfo)
  144. {
  145. return rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
  146. }
  147. static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
  148. struct net_device *dev, int idx, u8 *dst,
  149. u8 *next_hop, struct mpath_info *pinfo)
  150. {
  151. return rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
  152. pinfo);
  153. }
  154. static inline int
  155. rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
  156. struct net_device *dev, struct mesh_config *conf)
  157. {
  158. return rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
  159. }
  160. static inline int
  161. rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
  162. struct net_device *dev, u32 mask,
  163. const struct mesh_config *nconf)
  164. {
  165. return rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
  166. }
  167. static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
  168. struct net_device *dev,
  169. const struct mesh_config *conf,
  170. const struct mesh_setup *setup)
  171. {
  172. return rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
  173. }
  174. static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
  175. struct net_device *dev)
  176. {
  177. return rdev->ops->leave_mesh(&rdev->wiphy, dev);
  178. }
  179. static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
  180. struct net_device *dev,
  181. struct bss_parameters *params)
  182. {
  183. return rdev->ops->change_bss(&rdev->wiphy, dev, params);
  184. }
  185. static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
  186. struct net_device *dev,
  187. struct ieee80211_txq_params *params)
  188. {
  189. return rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
  190. }
  191. static inline int
  192. rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
  193. struct net_device *dev,
  194. struct ieee80211_channel *chan)
  195. {
  196. return rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
  197. }
  198. static inline int
  199. rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
  200. struct ieee80211_channel *chan,
  201. enum nl80211_channel_type channel_type)
  202. {
  203. return rdev->ops->set_monitor_channel(&rdev->wiphy, chan,
  204. channel_type);
  205. }
  206. static inline int rdev_scan(struct cfg80211_registered_device *rdev,
  207. struct cfg80211_scan_request *request)
  208. {
  209. return rdev->ops->scan(&rdev->wiphy, request);
  210. }
  211. static inline int rdev_auth(struct cfg80211_registered_device *rdev,
  212. struct net_device *dev,
  213. struct cfg80211_auth_request *req)
  214. {
  215. return rdev->ops->auth(&rdev->wiphy, dev, req);
  216. }
  217. static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
  218. struct net_device *dev,
  219. struct cfg80211_assoc_request *req)
  220. {
  221. return rdev->ops->assoc(&rdev->wiphy, dev, req);
  222. }
  223. static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
  224. struct net_device *dev,
  225. struct cfg80211_deauth_request *req)
  226. {
  227. return rdev->ops->deauth(&rdev->wiphy, dev, req);
  228. }
  229. static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
  230. struct net_device *dev,
  231. struct cfg80211_disassoc_request *req)
  232. {
  233. return rdev->ops->disassoc(&rdev->wiphy, dev, req);
  234. }
  235. static inline int rdev_connect(struct cfg80211_registered_device *rdev,
  236. struct net_device *dev,
  237. struct cfg80211_connect_params *sme)
  238. {
  239. return rdev->ops->connect(&rdev->wiphy, dev, sme);
  240. }
  241. static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
  242. struct net_device *dev, u16 reason_code)
  243. {
  244. return rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
  245. }
  246. static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
  247. struct net_device *dev,
  248. struct cfg80211_ibss_params *params)
  249. {
  250. return rdev->ops->join_ibss(&rdev->wiphy, dev, params);
  251. }
  252. static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
  253. struct net_device *dev)
  254. {
  255. return rdev->ops->leave_ibss(&rdev->wiphy, dev);
  256. }
  257. static inline int
  258. rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
  259. {
  260. return rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
  261. }
  262. static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
  263. enum nl80211_tx_power_setting type, int mbm)
  264. {
  265. return rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
  266. }
  267. static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
  268. int *dbm)
  269. {
  270. return rdev->ops->get_tx_power(&rdev->wiphy, dbm);
  271. }
  272. static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
  273. struct net_device *dev, const u8 *addr)
  274. {
  275. return rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
  276. }
  277. static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
  278. {
  279. rdev->ops->rfkill_poll(&rdev->wiphy);
  280. }
  281. #ifdef CONFIG_NL80211_TESTMODE
  282. static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
  283. void *data, int len)
  284. {
  285. return rdev->ops->testmode_cmd(&rdev->wiphy, data, len);
  286. }
  287. static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
  288. struct sk_buff *skb,
  289. struct netlink_callback *cb, void *data,
  290. int len)
  291. {
  292. return rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data,
  293. len);
  294. }
  295. #endif
  296. static inline int
  297. rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
  298. struct net_device *dev, const u8 *peer,
  299. const struct cfg80211_bitrate_mask *mask)
  300. {
  301. return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
  302. }
  303. static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
  304. struct net_device *netdev, int idx,
  305. struct survey_info *info)
  306. {
  307. return rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
  308. }
  309. static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
  310. struct net_device *netdev,
  311. struct cfg80211_pmksa *pmksa)
  312. {
  313. return rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
  314. }
  315. static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
  316. struct net_device *netdev,
  317. struct cfg80211_pmksa *pmksa)
  318. {
  319. return rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
  320. }
  321. static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
  322. struct net_device *netdev)
  323. {
  324. return rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
  325. }
  326. static inline int
  327. rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
  328. struct wireless_dev *wdev,
  329. struct ieee80211_channel *chan,
  330. enum nl80211_channel_type channel_type,
  331. unsigned int duration, u64 *cookie)
  332. {
  333. return rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
  334. channel_type, duration, cookie);
  335. }
  336. static inline int
  337. rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
  338. struct wireless_dev *wdev, u64 cookie)
  339. {
  340. return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
  341. }
  342. static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
  343. struct wireless_dev *wdev,
  344. struct ieee80211_channel *chan, bool offchan,
  345. enum nl80211_channel_type channel_type,
  346. bool channel_type_valid, unsigned int wait,
  347. const u8 *buf, size_t len, bool no_cck,
  348. bool dont_wait_for_ack, u64 *cookie)
  349. {
  350. return rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
  351. channel_type, channel_type_valid, wait, buf,
  352. len, no_cck, dont_wait_for_ack, cookie);
  353. }
  354. static inline int
  355. rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
  356. struct wireless_dev *wdev, u64 cookie)
  357. {
  358. return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
  359. }
  360. static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
  361. struct net_device *dev, bool enabled,
  362. int timeout)
  363. {
  364. return rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
  365. }
  366. static inline int
  367. rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
  368. struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
  369. {
  370. return rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
  371. rssi_hyst);
  372. }
  373. static inline int
  374. rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
  375. struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
  376. {
  377. return rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
  378. intvl);
  379. }
  380. static inline void
  381. rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
  382. struct wireless_dev *wdev, u16 frame_type, bool reg)
  383. {
  384. rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type,
  385. reg);
  386. }
  387. static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
  388. u32 tx_ant, u32 rx_ant)
  389. {
  390. return rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
  391. }
  392. static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
  393. u32 *tx_ant, u32 *rx_ant)
  394. {
  395. return rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
  396. }
  397. static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
  398. u32 tx, u32 rx)
  399. {
  400. return rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
  401. }
  402. static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
  403. u32 *tx, u32 *tx_max, u32 *rx,
  404. u32 *rx_max)
  405. {
  406. rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
  407. }
  408. static inline int
  409. rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
  410. struct net_device *dev,
  411. struct cfg80211_sched_scan_request *request)
  412. {
  413. return rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
  414. }
  415. static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
  416. struct net_device *dev)
  417. {
  418. return rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
  419. }
  420. static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
  421. struct net_device *dev,
  422. struct cfg80211_gtk_rekey_data *data)
  423. {
  424. return rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
  425. }
  426. static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
  427. struct net_device *dev, u8 *peer,
  428. u8 action_code, u8 dialog_token,
  429. u16 status_code, const u8 *buf, size_t len)
  430. {
  431. return rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
  432. dialog_token, status_code, buf, len);
  433. }
  434. static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
  435. struct net_device *dev, u8 *peer,
  436. enum nl80211_tdls_operation oper)
  437. {
  438. return rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
  439. }
  440. static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
  441. struct net_device *dev, const u8 *peer,
  442. u64 *cookie)
  443. {
  444. return rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
  445. }
  446. static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
  447. struct net_device *dev, u16 noack_map)
  448. {
  449. return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
  450. }
  451. static inline int
  452. rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
  453. struct net_device *dev, int sset)
  454. {
  455. return rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
  456. }
  457. static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
  458. struct net_device *dev,
  459. struct ethtool_stats *stats, u64 *data)
  460. {
  461. rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
  462. }
  463. static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
  464. struct net_device *dev, u32 sset,
  465. u8 *data)
  466. {
  467. rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
  468. }
  469. static inline struct ieee80211_channel
  470. *rdev_get_channel(struct cfg80211_registered_device *rdev,
  471. struct wireless_dev *wdev, enum nl80211_channel_type *type)
  472. {
  473. return rdev->ops->get_channel(&rdev->wiphy, wdev, type);
  474. }
  475. #endif /* __CFG80211_RDEV_OPS */