rdev-ops.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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. #include "trace.h"
  7. static inline int rdev_suspend(struct cfg80211_registered_device *rdev,
  8. struct cfg80211_wowlan *wowlan)
  9. {
  10. int ret;
  11. trace_rdev_suspend(&rdev->wiphy, wowlan);
  12. ret = rdev->ops->suspend(&rdev->wiphy, wowlan);
  13. trace_rdev_return_int(&rdev->wiphy, ret);
  14. return ret;
  15. }
  16. static inline int rdev_resume(struct cfg80211_registered_device *rdev)
  17. {
  18. int ret;
  19. trace_rdev_resume(&rdev->wiphy);
  20. ret = rdev->ops->resume(&rdev->wiphy);
  21. trace_rdev_return_int(&rdev->wiphy, ret);
  22. return ret;
  23. }
  24. static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
  25. bool enabled)
  26. {
  27. trace_rdev_set_wakeup(&rdev->wiphy, enabled);
  28. rdev->ops->set_wakeup(&rdev->wiphy, enabled);
  29. trace_rdev_return_void(&rdev->wiphy);
  30. }
  31. static inline struct wireless_dev
  32. *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
  33. unsigned char name_assign_type,
  34. enum nl80211_iftype type, u32 *flags,
  35. struct vif_params *params)
  36. {
  37. struct wireless_dev *ret;
  38. trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
  39. ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, name_assign_type,
  40. type, flags, params);
  41. trace_rdev_return_wdev(&rdev->wiphy, ret);
  42. return ret;
  43. }
  44. static inline int
  45. rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
  46. struct wireless_dev *wdev)
  47. {
  48. int ret;
  49. trace_rdev_del_virtual_intf(&rdev->wiphy, wdev);
  50. ret = rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
  51. trace_rdev_return_int(&rdev->wiphy, ret);
  52. return ret;
  53. }
  54. static inline int
  55. rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
  56. struct net_device *dev, enum nl80211_iftype type,
  57. u32 *flags, struct vif_params *params)
  58. {
  59. int ret;
  60. trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
  61. ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
  62. params);
  63. trace_rdev_return_int(&rdev->wiphy, ret);
  64. return ret;
  65. }
  66. static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
  67. struct net_device *netdev, u8 key_index,
  68. bool pairwise, const u8 *mac_addr,
  69. struct key_params *params)
  70. {
  71. int ret;
  72. trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
  73. ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
  74. mac_addr, params);
  75. trace_rdev_return_int(&rdev->wiphy, ret);
  76. return ret;
  77. }
  78. static inline int
  79. rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
  80. u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
  81. void (*callback)(void *cookie, struct key_params*))
  82. {
  83. int ret;
  84. trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
  85. ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
  86. mac_addr, cookie, callback);
  87. trace_rdev_return_int(&rdev->wiphy, ret);
  88. return ret;
  89. }
  90. static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
  91. struct net_device *netdev, u8 key_index,
  92. bool pairwise, const u8 *mac_addr)
  93. {
  94. int ret;
  95. trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
  96. ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
  97. mac_addr);
  98. trace_rdev_return_int(&rdev->wiphy, ret);
  99. return ret;
  100. }
  101. static inline int
  102. rdev_set_default_key(struct cfg80211_registered_device *rdev,
  103. struct net_device *netdev, u8 key_index, bool unicast,
  104. bool multicast)
  105. {
  106. int ret;
  107. trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
  108. unicast, multicast);
  109. ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
  110. unicast, multicast);
  111. trace_rdev_return_int(&rdev->wiphy, ret);
  112. return ret;
  113. }
  114. static inline int
  115. rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
  116. struct net_device *netdev, u8 key_index)
  117. {
  118. int ret;
  119. trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
  120. ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
  121. key_index);
  122. trace_rdev_return_int(&rdev->wiphy, ret);
  123. return ret;
  124. }
  125. static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
  126. struct net_device *dev,
  127. struct cfg80211_ap_settings *settings)
  128. {
  129. int ret;
  130. trace_rdev_start_ap(&rdev->wiphy, dev, settings);
  131. ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
  132. trace_rdev_return_int(&rdev->wiphy, ret);
  133. return ret;
  134. }
  135. static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
  136. struct net_device *dev,
  137. struct cfg80211_beacon_data *info)
  138. {
  139. int ret;
  140. trace_rdev_change_beacon(&rdev->wiphy, dev, info);
  141. ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
  142. trace_rdev_return_int(&rdev->wiphy, ret);
  143. return ret;
  144. }
  145. static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
  146. struct net_device *dev)
  147. {
  148. int ret;
  149. trace_rdev_stop_ap(&rdev->wiphy, dev);
  150. ret = rdev->ops->stop_ap(&rdev->wiphy, dev);
  151. trace_rdev_return_int(&rdev->wiphy, ret);
  152. return ret;
  153. }
  154. static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
  155. struct net_device *dev, u8 *mac,
  156. struct station_parameters *params)
  157. {
  158. int ret;
  159. trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
  160. ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
  161. trace_rdev_return_int(&rdev->wiphy, ret);
  162. return ret;
  163. }
  164. static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
  165. struct net_device *dev,
  166. struct station_del_parameters *params)
  167. {
  168. int ret;
  169. trace_rdev_del_station(&rdev->wiphy, dev, params);
  170. ret = rdev->ops->del_station(&rdev->wiphy, dev, params);
  171. trace_rdev_return_int(&rdev->wiphy, ret);
  172. return ret;
  173. }
  174. static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
  175. struct net_device *dev, u8 *mac,
  176. struct station_parameters *params)
  177. {
  178. int ret;
  179. trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
  180. ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
  181. trace_rdev_return_int(&rdev->wiphy, ret);
  182. return ret;
  183. }
  184. static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
  185. struct net_device *dev, const u8 *mac,
  186. struct station_info *sinfo)
  187. {
  188. int ret;
  189. trace_rdev_get_station(&rdev->wiphy, dev, mac);
  190. ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
  191. trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
  192. return ret;
  193. }
  194. static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
  195. struct net_device *dev, int idx, u8 *mac,
  196. struct station_info *sinfo)
  197. {
  198. int ret;
  199. trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
  200. ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
  201. trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
  202. return ret;
  203. }
  204. static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
  205. struct net_device *dev, u8 *dst, u8 *next_hop)
  206. {
  207. int ret;
  208. trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
  209. ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
  210. trace_rdev_return_int(&rdev->wiphy, ret);
  211. return ret;
  212. }
  213. static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
  214. struct net_device *dev, u8 *dst)
  215. {
  216. int ret;
  217. trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
  218. ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
  219. trace_rdev_return_int(&rdev->wiphy, ret);
  220. return ret;
  221. }
  222. static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
  223. struct net_device *dev, u8 *dst,
  224. u8 *next_hop)
  225. {
  226. int ret;
  227. trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
  228. ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
  229. trace_rdev_return_int(&rdev->wiphy, ret);
  230. return ret;
  231. }
  232. static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
  233. struct net_device *dev, u8 *dst, u8 *next_hop,
  234. struct mpath_info *pinfo)
  235. {
  236. int ret;
  237. trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
  238. ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
  239. trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
  240. return ret;
  241. }
  242. static inline int rdev_get_mpp(struct cfg80211_registered_device *rdev,
  243. struct net_device *dev, u8 *dst, u8 *mpp,
  244. struct mpath_info *pinfo)
  245. {
  246. int ret;
  247. trace_rdev_get_mpp(&rdev->wiphy, dev, dst, mpp);
  248. ret = rdev->ops->get_mpp(&rdev->wiphy, dev, dst, mpp, pinfo);
  249. trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
  250. return ret;
  251. }
  252. static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
  253. struct net_device *dev, int idx, u8 *dst,
  254. u8 *next_hop, struct mpath_info *pinfo)
  255. {
  256. int ret;
  257. trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
  258. ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
  259. pinfo);
  260. trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
  261. return ret;
  262. }
  263. static inline int rdev_dump_mpp(struct cfg80211_registered_device *rdev,
  264. struct net_device *dev, int idx, u8 *dst,
  265. u8 *mpp, struct mpath_info *pinfo)
  266. {
  267. int ret;
  268. trace_rdev_dump_mpp(&rdev->wiphy, dev, idx, dst, mpp);
  269. ret = rdev->ops->dump_mpp(&rdev->wiphy, dev, idx, dst, mpp, pinfo);
  270. trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
  271. return ret;
  272. }
  273. static inline int
  274. rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
  275. struct net_device *dev, struct mesh_config *conf)
  276. {
  277. int ret;
  278. trace_rdev_get_mesh_config(&rdev->wiphy, dev);
  279. ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
  280. trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
  281. return ret;
  282. }
  283. static inline int
  284. rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
  285. struct net_device *dev, u32 mask,
  286. const struct mesh_config *nconf)
  287. {
  288. int ret;
  289. trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
  290. ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
  291. trace_rdev_return_int(&rdev->wiphy, ret);
  292. return ret;
  293. }
  294. static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
  295. struct net_device *dev,
  296. const struct mesh_config *conf,
  297. const struct mesh_setup *setup)
  298. {
  299. int ret;
  300. trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
  301. ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
  302. trace_rdev_return_int(&rdev->wiphy, ret);
  303. return ret;
  304. }
  305. static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
  306. struct net_device *dev)
  307. {
  308. int ret;
  309. trace_rdev_leave_mesh(&rdev->wiphy, dev);
  310. ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
  311. trace_rdev_return_int(&rdev->wiphy, ret);
  312. return ret;
  313. }
  314. static inline int rdev_join_ocb(struct cfg80211_registered_device *rdev,
  315. struct net_device *dev,
  316. struct ocb_setup *setup)
  317. {
  318. int ret;
  319. trace_rdev_join_ocb(&rdev->wiphy, dev, setup);
  320. ret = rdev->ops->join_ocb(&rdev->wiphy, dev, setup);
  321. trace_rdev_return_int(&rdev->wiphy, ret);
  322. return ret;
  323. }
  324. static inline int rdev_leave_ocb(struct cfg80211_registered_device *rdev,
  325. struct net_device *dev)
  326. {
  327. int ret;
  328. trace_rdev_leave_ocb(&rdev->wiphy, dev);
  329. ret = rdev->ops->leave_ocb(&rdev->wiphy, dev);
  330. trace_rdev_return_int(&rdev->wiphy, ret);
  331. return ret;
  332. }
  333. static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
  334. struct net_device *dev,
  335. struct bss_parameters *params)
  336. {
  337. int ret;
  338. trace_rdev_change_bss(&rdev->wiphy, dev, params);
  339. ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
  340. trace_rdev_return_int(&rdev->wiphy, ret);
  341. return ret;
  342. }
  343. static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
  344. struct net_device *dev,
  345. struct ieee80211_txq_params *params)
  346. {
  347. int ret;
  348. trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
  349. ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
  350. trace_rdev_return_int(&rdev->wiphy, ret);
  351. return ret;
  352. }
  353. static inline int
  354. rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
  355. struct net_device *dev,
  356. struct ieee80211_channel *chan)
  357. {
  358. int ret;
  359. trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
  360. ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
  361. trace_rdev_return_int(&rdev->wiphy, ret);
  362. return ret;
  363. }
  364. static inline int
  365. rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
  366. struct cfg80211_chan_def *chandef)
  367. {
  368. int ret;
  369. trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
  370. ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
  371. trace_rdev_return_int(&rdev->wiphy, ret);
  372. return ret;
  373. }
  374. static inline int rdev_scan(struct cfg80211_registered_device *rdev,
  375. struct cfg80211_scan_request *request)
  376. {
  377. int ret;
  378. trace_rdev_scan(&rdev->wiphy, request);
  379. ret = rdev->ops->scan(&rdev->wiphy, request);
  380. trace_rdev_return_int(&rdev->wiphy, ret);
  381. return ret;
  382. }
  383. static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
  384. struct wireless_dev *wdev)
  385. {
  386. trace_rdev_abort_scan(&rdev->wiphy, wdev);
  387. rdev->ops->abort_scan(&rdev->wiphy, wdev);
  388. trace_rdev_return_void(&rdev->wiphy);
  389. }
  390. static inline int rdev_auth(struct cfg80211_registered_device *rdev,
  391. struct net_device *dev,
  392. struct cfg80211_auth_request *req)
  393. {
  394. int ret;
  395. trace_rdev_auth(&rdev->wiphy, dev, req);
  396. ret = rdev->ops->auth(&rdev->wiphy, dev, req);
  397. trace_rdev_return_int(&rdev->wiphy, ret);
  398. return ret;
  399. }
  400. static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
  401. struct net_device *dev,
  402. struct cfg80211_assoc_request *req)
  403. {
  404. int ret;
  405. trace_rdev_assoc(&rdev->wiphy, dev, req);
  406. ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
  407. trace_rdev_return_int(&rdev->wiphy, ret);
  408. return ret;
  409. }
  410. static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
  411. struct net_device *dev,
  412. struct cfg80211_deauth_request *req)
  413. {
  414. int ret;
  415. trace_rdev_deauth(&rdev->wiphy, dev, req);
  416. ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
  417. trace_rdev_return_int(&rdev->wiphy, ret);
  418. return ret;
  419. }
  420. static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
  421. struct net_device *dev,
  422. struct cfg80211_disassoc_request *req)
  423. {
  424. int ret;
  425. trace_rdev_disassoc(&rdev->wiphy, dev, req);
  426. ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
  427. trace_rdev_return_int(&rdev->wiphy, ret);
  428. return ret;
  429. }
  430. static inline int rdev_connect(struct cfg80211_registered_device *rdev,
  431. struct net_device *dev,
  432. struct cfg80211_connect_params *sme)
  433. {
  434. int ret;
  435. trace_rdev_connect(&rdev->wiphy, dev, sme);
  436. ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
  437. trace_rdev_return_int(&rdev->wiphy, ret);
  438. return ret;
  439. }
  440. static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
  441. struct net_device *dev, u16 reason_code)
  442. {
  443. int ret;
  444. trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
  445. ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
  446. trace_rdev_return_int(&rdev->wiphy, ret);
  447. return ret;
  448. }
  449. static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
  450. struct net_device *dev,
  451. struct cfg80211_ibss_params *params)
  452. {
  453. int ret;
  454. trace_rdev_join_ibss(&rdev->wiphy, dev, params);
  455. ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
  456. trace_rdev_return_int(&rdev->wiphy, ret);
  457. return ret;
  458. }
  459. static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
  460. struct net_device *dev)
  461. {
  462. int ret;
  463. trace_rdev_leave_ibss(&rdev->wiphy, dev);
  464. ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
  465. trace_rdev_return_int(&rdev->wiphy, ret);
  466. return ret;
  467. }
  468. static inline int
  469. rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
  470. {
  471. int ret;
  472. trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
  473. ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
  474. trace_rdev_return_int(&rdev->wiphy, ret);
  475. return ret;
  476. }
  477. static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
  478. struct wireless_dev *wdev,
  479. enum nl80211_tx_power_setting type, int mbm)
  480. {
  481. int ret;
  482. trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
  483. ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
  484. trace_rdev_return_int(&rdev->wiphy, ret);
  485. return ret;
  486. }
  487. static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
  488. struct wireless_dev *wdev, int *dbm)
  489. {
  490. int ret;
  491. trace_rdev_get_tx_power(&rdev->wiphy, wdev);
  492. ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
  493. trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
  494. return ret;
  495. }
  496. static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
  497. struct net_device *dev, const u8 *addr)
  498. {
  499. int ret;
  500. trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
  501. ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
  502. trace_rdev_return_int(&rdev->wiphy, ret);
  503. return ret;
  504. }
  505. static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
  506. {
  507. trace_rdev_rfkill_poll(&rdev->wiphy);
  508. rdev->ops->rfkill_poll(&rdev->wiphy);
  509. trace_rdev_return_void(&rdev->wiphy);
  510. }
  511. #ifdef CONFIG_NL80211_TESTMODE
  512. static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
  513. struct wireless_dev *wdev,
  514. void *data, int len)
  515. {
  516. int ret;
  517. trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
  518. ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
  519. trace_rdev_return_int(&rdev->wiphy, ret);
  520. return ret;
  521. }
  522. static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
  523. struct sk_buff *skb,
  524. struct netlink_callback *cb, void *data,
  525. int len)
  526. {
  527. int ret;
  528. trace_rdev_testmode_dump(&rdev->wiphy);
  529. ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
  530. trace_rdev_return_int(&rdev->wiphy, ret);
  531. return ret;
  532. }
  533. #endif
  534. static inline int
  535. rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
  536. struct net_device *dev, const u8 *peer,
  537. const struct cfg80211_bitrate_mask *mask)
  538. {
  539. int ret;
  540. trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
  541. ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
  542. trace_rdev_return_int(&rdev->wiphy, ret);
  543. return ret;
  544. }
  545. static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
  546. struct net_device *netdev, int idx,
  547. struct survey_info *info)
  548. {
  549. int ret;
  550. trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
  551. ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
  552. if (ret < 0)
  553. trace_rdev_return_int(&rdev->wiphy, ret);
  554. else
  555. trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
  556. return ret;
  557. }
  558. static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
  559. struct net_device *netdev,
  560. struct cfg80211_pmksa *pmksa)
  561. {
  562. int ret;
  563. trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
  564. ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
  565. trace_rdev_return_int(&rdev->wiphy, ret);
  566. return ret;
  567. }
  568. static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
  569. struct net_device *netdev,
  570. struct cfg80211_pmksa *pmksa)
  571. {
  572. int ret;
  573. trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
  574. ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
  575. trace_rdev_return_int(&rdev->wiphy, ret);
  576. return ret;
  577. }
  578. static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
  579. struct net_device *netdev)
  580. {
  581. int ret;
  582. trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
  583. ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
  584. trace_rdev_return_int(&rdev->wiphy, ret);
  585. return ret;
  586. }
  587. static inline int
  588. rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
  589. struct wireless_dev *wdev,
  590. struct ieee80211_channel *chan,
  591. unsigned int duration, u64 *cookie)
  592. {
  593. int ret;
  594. trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
  595. ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
  596. duration, cookie);
  597. trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
  598. return ret;
  599. }
  600. static inline int
  601. rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
  602. struct wireless_dev *wdev, u64 cookie)
  603. {
  604. int ret;
  605. trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
  606. ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
  607. trace_rdev_return_int(&rdev->wiphy, ret);
  608. return ret;
  609. }
  610. static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
  611. struct wireless_dev *wdev,
  612. struct cfg80211_mgmt_tx_params *params,
  613. u64 *cookie)
  614. {
  615. int ret;
  616. trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
  617. ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
  618. trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
  619. return ret;
  620. }
  621. static inline int
  622. rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
  623. struct wireless_dev *wdev, u64 cookie)
  624. {
  625. int ret;
  626. trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
  627. ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
  628. trace_rdev_return_int(&rdev->wiphy, ret);
  629. return ret;
  630. }
  631. static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
  632. struct net_device *dev, bool enabled,
  633. int timeout)
  634. {
  635. int ret;
  636. trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
  637. ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
  638. trace_rdev_return_int(&rdev->wiphy, ret);
  639. return ret;
  640. }
  641. static inline int
  642. rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
  643. struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
  644. {
  645. int ret;
  646. trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
  647. rssi_hyst);
  648. ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
  649. rssi_hyst);
  650. trace_rdev_return_int(&rdev->wiphy, ret);
  651. return ret;
  652. }
  653. static inline int
  654. rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
  655. struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
  656. {
  657. int ret;
  658. trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
  659. ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
  660. intvl);
  661. trace_rdev_return_int(&rdev->wiphy, ret);
  662. return ret;
  663. }
  664. static inline void
  665. rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
  666. struct wireless_dev *wdev, u16 frame_type, bool reg)
  667. {
  668. might_sleep();
  669. trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
  670. rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
  671. trace_rdev_return_void(&rdev->wiphy);
  672. }
  673. static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
  674. u32 tx_ant, u32 rx_ant)
  675. {
  676. int ret;
  677. trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
  678. ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
  679. trace_rdev_return_int(&rdev->wiphy, ret);
  680. return ret;
  681. }
  682. static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
  683. u32 *tx_ant, u32 *rx_ant)
  684. {
  685. int ret;
  686. trace_rdev_get_antenna(&rdev->wiphy);
  687. ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
  688. if (ret)
  689. trace_rdev_return_int(&rdev->wiphy, ret);
  690. else
  691. trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
  692. *rx_ant);
  693. return ret;
  694. }
  695. static inline int
  696. rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
  697. struct net_device *dev,
  698. struct cfg80211_sched_scan_request *request)
  699. {
  700. int ret;
  701. trace_rdev_sched_scan_start(&rdev->wiphy, dev, request);
  702. ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
  703. trace_rdev_return_int(&rdev->wiphy, ret);
  704. return ret;
  705. }
  706. static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
  707. struct net_device *dev)
  708. {
  709. int ret;
  710. trace_rdev_sched_scan_stop(&rdev->wiphy, dev);
  711. ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
  712. trace_rdev_return_int(&rdev->wiphy, ret);
  713. return ret;
  714. }
  715. static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
  716. struct net_device *dev,
  717. struct cfg80211_gtk_rekey_data *data)
  718. {
  719. int ret;
  720. trace_rdev_set_rekey_data(&rdev->wiphy, dev);
  721. ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
  722. trace_rdev_return_int(&rdev->wiphy, ret);
  723. return ret;
  724. }
  725. static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
  726. struct net_device *dev, u8 *peer,
  727. u8 action_code, u8 dialog_token,
  728. u16 status_code, u32 peer_capability,
  729. bool initiator, const u8 *buf, size_t len)
  730. {
  731. int ret;
  732. trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
  733. dialog_token, status_code, peer_capability,
  734. initiator, buf, len);
  735. ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
  736. dialog_token, status_code, peer_capability,
  737. initiator, buf, len);
  738. trace_rdev_return_int(&rdev->wiphy, ret);
  739. return ret;
  740. }
  741. static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
  742. struct net_device *dev, u8 *peer,
  743. enum nl80211_tdls_operation oper)
  744. {
  745. int ret;
  746. trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
  747. ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
  748. trace_rdev_return_int(&rdev->wiphy, ret);
  749. return ret;
  750. }
  751. static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
  752. struct net_device *dev, const u8 *peer,
  753. u64 *cookie)
  754. {
  755. int ret;
  756. trace_rdev_probe_client(&rdev->wiphy, dev, peer);
  757. ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
  758. trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
  759. return ret;
  760. }
  761. static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
  762. struct net_device *dev, u16 noack_map)
  763. {
  764. int ret;
  765. trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
  766. ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
  767. trace_rdev_return_int(&rdev->wiphy, ret);
  768. return ret;
  769. }
  770. static inline int
  771. rdev_get_channel(struct cfg80211_registered_device *rdev,
  772. struct wireless_dev *wdev,
  773. struct cfg80211_chan_def *chandef)
  774. {
  775. int ret;
  776. trace_rdev_get_channel(&rdev->wiphy, wdev);
  777. ret = rdev->ops->get_channel(&rdev->wiphy, wdev, chandef);
  778. trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
  779. return ret;
  780. }
  781. static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
  782. struct wireless_dev *wdev)
  783. {
  784. int ret;
  785. trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
  786. ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
  787. trace_rdev_return_int(&rdev->wiphy, ret);
  788. return ret;
  789. }
  790. static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
  791. struct wireless_dev *wdev)
  792. {
  793. trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
  794. rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
  795. trace_rdev_return_void(&rdev->wiphy);
  796. }
  797. static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
  798. struct net_device *dev,
  799. struct cfg80211_acl_data *params)
  800. {
  801. int ret;
  802. trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
  803. ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
  804. trace_rdev_return_int(&rdev->wiphy, ret);
  805. return ret;
  806. }
  807. static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
  808. struct net_device *dev,
  809. struct cfg80211_update_ft_ies_params *ftie)
  810. {
  811. int ret;
  812. trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
  813. ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
  814. trace_rdev_return_int(&rdev->wiphy, ret);
  815. return ret;
  816. }
  817. static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
  818. struct wireless_dev *wdev,
  819. enum nl80211_crit_proto_id protocol,
  820. u16 duration)
  821. {
  822. int ret;
  823. trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
  824. ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
  825. protocol, duration);
  826. trace_rdev_return_int(&rdev->wiphy, ret);
  827. return ret;
  828. }
  829. static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
  830. struct wireless_dev *wdev)
  831. {
  832. trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
  833. rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
  834. trace_rdev_return_void(&rdev->wiphy);
  835. }
  836. static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
  837. struct net_device *dev,
  838. struct cfg80211_csa_settings *params)
  839. {
  840. int ret;
  841. trace_rdev_channel_switch(&rdev->wiphy, dev, params);
  842. ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
  843. trace_rdev_return_int(&rdev->wiphy, ret);
  844. return ret;
  845. }
  846. static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
  847. struct net_device *dev,
  848. struct cfg80211_qos_map *qos_map)
  849. {
  850. int ret = -EOPNOTSUPP;
  851. if (rdev->ops->set_qos_map) {
  852. trace_rdev_set_qos_map(&rdev->wiphy, dev, qos_map);
  853. ret = rdev->ops->set_qos_map(&rdev->wiphy, dev, qos_map);
  854. trace_rdev_return_int(&rdev->wiphy, ret);
  855. }
  856. return ret;
  857. }
  858. static inline int
  859. rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev,
  860. struct net_device *dev, struct cfg80211_chan_def *chandef)
  861. {
  862. int ret;
  863. trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, chandef);
  864. ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, chandef);
  865. trace_rdev_return_int(&rdev->wiphy, ret);
  866. return ret;
  867. }
  868. static inline int
  869. rdev_add_tx_ts(struct cfg80211_registered_device *rdev,
  870. struct net_device *dev, u8 tsid, const u8 *peer,
  871. u8 user_prio, u16 admitted_time)
  872. {
  873. int ret = -EOPNOTSUPP;
  874. trace_rdev_add_tx_ts(&rdev->wiphy, dev, tsid, peer,
  875. user_prio, admitted_time);
  876. if (rdev->ops->add_tx_ts)
  877. ret = rdev->ops->add_tx_ts(&rdev->wiphy, dev, tsid, peer,
  878. user_prio, admitted_time);
  879. trace_rdev_return_int(&rdev->wiphy, ret);
  880. return ret;
  881. }
  882. static inline int
  883. rdev_del_tx_ts(struct cfg80211_registered_device *rdev,
  884. struct net_device *dev, u8 tsid, const u8 *peer)
  885. {
  886. int ret = -EOPNOTSUPP;
  887. trace_rdev_del_tx_ts(&rdev->wiphy, dev, tsid, peer);
  888. if (rdev->ops->del_tx_ts)
  889. ret = rdev->ops->del_tx_ts(&rdev->wiphy, dev, tsid, peer);
  890. trace_rdev_return_int(&rdev->wiphy, ret);
  891. return ret;
  892. }
  893. static inline int
  894. rdev_tdls_channel_switch(struct cfg80211_registered_device *rdev,
  895. struct net_device *dev, const u8 *addr,
  896. u8 oper_class, struct cfg80211_chan_def *chandef)
  897. {
  898. int ret;
  899. trace_rdev_tdls_channel_switch(&rdev->wiphy, dev, addr, oper_class,
  900. chandef);
  901. ret = rdev->ops->tdls_channel_switch(&rdev->wiphy, dev, addr,
  902. oper_class, chandef);
  903. trace_rdev_return_int(&rdev->wiphy, ret);
  904. return ret;
  905. }
  906. static inline void
  907. rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device *rdev,
  908. struct net_device *dev, const u8 *addr)
  909. {
  910. trace_rdev_tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
  911. rdev->ops->tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
  912. trace_rdev_return_void(&rdev->wiphy);
  913. }
  914. static inline int
  915. rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
  916. struct net_device *dev,
  917. struct cfg80211_chan_def *chandef,
  918. u32 cac_time_ms)
  919. {
  920. int ret = -ENOTSUPP;
  921. trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef,
  922. cac_time_ms);
  923. if (rdev->ops->start_radar_detection)
  924. ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev,
  925. chandef, cac_time_ms);
  926. trace_rdev_return_int(&rdev->wiphy, ret);
  927. return ret;
  928. }
  929. static inline int
  930. rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
  931. struct net_device *dev,
  932. int mcast_rate[IEEE80211_NUM_BANDS])
  933. {
  934. int ret = -ENOTSUPP;
  935. trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
  936. if (rdev->ops->set_mcast_rate)
  937. ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
  938. trace_rdev_return_int(&rdev->wiphy, ret);
  939. return ret;
  940. }
  941. static inline int
  942. rdev_set_coalesce(struct cfg80211_registered_device *rdev,
  943. struct cfg80211_coalesce *coalesce)
  944. {
  945. int ret = -ENOTSUPP;
  946. trace_rdev_set_coalesce(&rdev->wiphy, coalesce);
  947. if (rdev->ops->set_coalesce)
  948. ret = rdev->ops->set_coalesce(&rdev->wiphy, coalesce);
  949. trace_rdev_return_int(&rdev->wiphy, ret);
  950. return ret;
  951. }
  952. #endif /* __CFG80211_RDEV_OPS */