peer.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. // SPDX-License-Identifier: BSD-3-Clause-Clear
  2. /*
  3. * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include "core.h"
  7. #include "peer.h"
  8. #include "debug.h"
  9. static struct ath11k_peer *ath11k_peer_find_list_by_id(struct ath11k_base *ab,
  10. int peer_id)
  11. {
  12. struct ath11k_peer *peer;
  13. lockdep_assert_held(&ab->base_lock);
  14. list_for_each_entry(peer, &ab->peers, list) {
  15. if (peer->peer_id != peer_id)
  16. continue;
  17. return peer;
  18. }
  19. return NULL;
  20. }
  21. struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id,
  22. const u8 *addr)
  23. {
  24. struct ath11k_peer *peer;
  25. lockdep_assert_held(&ab->base_lock);
  26. list_for_each_entry(peer, &ab->peers, list) {
  27. if (peer->vdev_id != vdev_id)
  28. continue;
  29. if (!ether_addr_equal(peer->addr, addr))
  30. continue;
  31. return peer;
  32. }
  33. return NULL;
  34. }
  35. struct ath11k_peer *ath11k_peer_find_by_addr(struct ath11k_base *ab,
  36. const u8 *addr)
  37. {
  38. struct ath11k_peer *peer;
  39. lockdep_assert_held(&ab->base_lock);
  40. if (!ab->rhead_peer_addr)
  41. return NULL;
  42. peer = rhashtable_lookup_fast(ab->rhead_peer_addr, addr,
  43. ab->rhash_peer_addr_param);
  44. return peer;
  45. }
  46. struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab,
  47. int peer_id)
  48. {
  49. struct ath11k_peer *peer;
  50. lockdep_assert_held(&ab->base_lock);
  51. if (!ab->rhead_peer_id)
  52. return NULL;
  53. peer = rhashtable_lookup_fast(ab->rhead_peer_id, &peer_id,
  54. ab->rhash_peer_id_param);
  55. return peer;
  56. }
  57. struct ath11k_peer *ath11k_peer_find_by_vdev_id(struct ath11k_base *ab,
  58. int vdev_id)
  59. {
  60. struct ath11k_peer *peer;
  61. spin_lock_bh(&ab->base_lock);
  62. list_for_each_entry(peer, &ab->peers, list) {
  63. if (vdev_id == peer->vdev_id) {
  64. spin_unlock_bh(&ab->base_lock);
  65. return peer;
  66. }
  67. }
  68. spin_unlock_bh(&ab->base_lock);
  69. return NULL;
  70. }
  71. void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id)
  72. {
  73. struct ath11k_peer *peer;
  74. spin_lock_bh(&ab->base_lock);
  75. peer = ath11k_peer_find_list_by_id(ab, peer_id);
  76. if (!peer) {
  77. ath11k_warn(ab, "peer-unmap-event: unknown peer id %d\n",
  78. peer_id);
  79. goto exit;
  80. }
  81. ath11k_dbg(ab, ATH11K_DBG_DP_HTT, "htt peer unmap vdev %d peer %pM id %d\n",
  82. peer->vdev_id, peer->addr, peer_id);
  83. list_del(&peer->list);
  84. kfree(peer);
  85. wake_up(&ab->peer_mapping_wq);
  86. exit:
  87. spin_unlock_bh(&ab->base_lock);
  88. }
  89. void ath11k_peer_map_event(struct ath11k_base *ab, u8 vdev_id, u16 peer_id,
  90. u8 *mac_addr, u16 ast_hash, u16 hw_peer_id)
  91. {
  92. struct ath11k_peer *peer;
  93. spin_lock_bh(&ab->base_lock);
  94. peer = ath11k_peer_find(ab, vdev_id, mac_addr);
  95. if (!peer) {
  96. peer = kzalloc(sizeof(*peer), GFP_ATOMIC);
  97. if (!peer)
  98. goto exit;
  99. peer->vdev_id = vdev_id;
  100. peer->peer_id = peer_id;
  101. peer->ast_hash = ast_hash;
  102. peer->hw_peer_id = hw_peer_id;
  103. ether_addr_copy(peer->addr, mac_addr);
  104. list_add(&peer->list, &ab->peers);
  105. wake_up(&ab->peer_mapping_wq);
  106. }
  107. ath11k_dbg(ab, ATH11K_DBG_DP_HTT, "htt peer map vdev %d peer %pM id %d\n",
  108. vdev_id, mac_addr, peer_id);
  109. exit:
  110. spin_unlock_bh(&ab->base_lock);
  111. }
  112. static int ath11k_wait_for_peer_common(struct ath11k_base *ab, int vdev_id,
  113. const u8 *addr, bool expect_mapped)
  114. {
  115. int ret;
  116. ret = wait_event_timeout(ab->peer_mapping_wq, ({
  117. bool mapped;
  118. spin_lock_bh(&ab->base_lock);
  119. mapped = !!ath11k_peer_find(ab, vdev_id, addr);
  120. spin_unlock_bh(&ab->base_lock);
  121. (mapped == expect_mapped ||
  122. test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags));
  123. }), 3 * HZ);
  124. if (ret <= 0)
  125. return -ETIMEDOUT;
  126. return 0;
  127. }
  128. static inline int ath11k_peer_rhash_insert(struct ath11k_base *ab,
  129. struct rhashtable *rtbl,
  130. struct rhash_head *rhead,
  131. struct rhashtable_params *params,
  132. void *key)
  133. {
  134. struct ath11k_peer *tmp;
  135. lockdep_assert_held(&ab->tbl_mtx_lock);
  136. tmp = rhashtable_lookup_get_insert_fast(rtbl, rhead, *params);
  137. if (!tmp)
  138. return 0;
  139. else if (IS_ERR(tmp))
  140. return PTR_ERR(tmp);
  141. else
  142. return -EEXIST;
  143. }
  144. static inline int ath11k_peer_rhash_remove(struct ath11k_base *ab,
  145. struct rhashtable *rtbl,
  146. struct rhash_head *rhead,
  147. struct rhashtable_params *params)
  148. {
  149. int ret;
  150. lockdep_assert_held(&ab->tbl_mtx_lock);
  151. ret = rhashtable_remove_fast(rtbl, rhead, *params);
  152. if (ret && ret != -ENOENT)
  153. return ret;
  154. return 0;
  155. }
  156. static int ath11k_peer_rhash_add(struct ath11k_base *ab, struct ath11k_peer *peer)
  157. {
  158. int ret;
  159. lockdep_assert_held(&ab->base_lock);
  160. lockdep_assert_held(&ab->tbl_mtx_lock);
  161. if (!ab->rhead_peer_id || !ab->rhead_peer_addr)
  162. return -EPERM;
  163. ret = ath11k_peer_rhash_insert(ab, ab->rhead_peer_id, &peer->rhash_id,
  164. &ab->rhash_peer_id_param, &peer->peer_id);
  165. if (ret) {
  166. ath11k_warn(ab, "failed to add peer %pM with id %d in rhash_id ret %d\n",
  167. peer->addr, peer->peer_id, ret);
  168. return ret;
  169. }
  170. ret = ath11k_peer_rhash_insert(ab, ab->rhead_peer_addr, &peer->rhash_addr,
  171. &ab->rhash_peer_addr_param, &peer->addr);
  172. if (ret) {
  173. ath11k_warn(ab, "failed to add peer %pM with id %d in rhash_addr ret %d\n",
  174. peer->addr, peer->peer_id, ret);
  175. goto err_clean;
  176. }
  177. return 0;
  178. err_clean:
  179. ath11k_peer_rhash_remove(ab, ab->rhead_peer_id, &peer->rhash_id,
  180. &ab->rhash_peer_id_param);
  181. return ret;
  182. }
  183. void ath11k_peer_cleanup(struct ath11k *ar, u32 vdev_id)
  184. {
  185. struct ath11k_peer *peer, *tmp;
  186. struct ath11k_base *ab = ar->ab;
  187. lockdep_assert_held(&ar->conf_mutex);
  188. mutex_lock(&ab->tbl_mtx_lock);
  189. spin_lock_bh(&ab->base_lock);
  190. list_for_each_entry_safe(peer, tmp, &ab->peers, list) {
  191. if (peer->vdev_id != vdev_id)
  192. continue;
  193. ath11k_warn(ab, "removing stale peer %pM from vdev_id %d\n",
  194. peer->addr, vdev_id);
  195. ath11k_peer_rhash_delete(ab, peer);
  196. list_del(&peer->list);
  197. kfree(peer);
  198. ar->num_peers--;
  199. }
  200. spin_unlock_bh(&ab->base_lock);
  201. mutex_unlock(&ab->tbl_mtx_lock);
  202. }
  203. static int ath11k_wait_for_peer_deleted(struct ath11k *ar, int vdev_id, const u8 *addr)
  204. {
  205. return ath11k_wait_for_peer_common(ar->ab, vdev_id, addr, false);
  206. }
  207. int ath11k_wait_for_peer_delete_done(struct ath11k *ar, u32 vdev_id,
  208. const u8 *addr)
  209. {
  210. int ret;
  211. unsigned long time_left;
  212. ret = ath11k_wait_for_peer_deleted(ar, vdev_id, addr);
  213. if (ret) {
  214. ath11k_warn(ar->ab, "failed wait for peer deleted");
  215. return ret;
  216. }
  217. time_left = wait_for_completion_timeout(&ar->peer_delete_done,
  218. 3 * HZ);
  219. if (time_left == 0) {
  220. ath11k_warn(ar->ab, "Timeout in receiving peer delete response\n");
  221. return -ETIMEDOUT;
  222. }
  223. return 0;
  224. }
  225. static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr)
  226. {
  227. int ret;
  228. struct ath11k_peer *peer;
  229. struct ath11k_base *ab = ar->ab;
  230. lockdep_assert_held(&ar->conf_mutex);
  231. mutex_lock(&ab->tbl_mtx_lock);
  232. spin_lock_bh(&ab->base_lock);
  233. peer = ath11k_peer_find_by_addr(ab, addr);
  234. /* Check if the found peer is what we want to remove.
  235. * While the sta is transitioning to another band we may
  236. * have 2 peer with the same addr assigned to different
  237. * vdev_id. Make sure we are deleting the correct peer.
  238. */
  239. if (peer && peer->vdev_id == vdev_id)
  240. ath11k_peer_rhash_delete(ab, peer);
  241. /* Fallback to peer list search if the correct peer can't be found.
  242. * Skip the deletion of the peer from the rhash since it has already
  243. * been deleted in peer add.
  244. */
  245. if (!peer)
  246. peer = ath11k_peer_find(ab, vdev_id, addr);
  247. if (!peer) {
  248. spin_unlock_bh(&ab->base_lock);
  249. mutex_unlock(&ab->tbl_mtx_lock);
  250. ath11k_warn(ab,
  251. "failed to find peer vdev_id %d addr %pM in delete\n",
  252. vdev_id, addr);
  253. return -EINVAL;
  254. }
  255. spin_unlock_bh(&ab->base_lock);
  256. mutex_unlock(&ab->tbl_mtx_lock);
  257. reinit_completion(&ar->peer_delete_done);
  258. ret = ath11k_wmi_send_peer_delete_cmd(ar, addr, vdev_id);
  259. if (ret) {
  260. ath11k_warn(ab,
  261. "failed to delete peer vdev_id %d addr %pM ret %d\n",
  262. vdev_id, addr, ret);
  263. return ret;
  264. }
  265. ret = ath11k_wait_for_peer_delete_done(ar, vdev_id, addr);
  266. if (ret)
  267. return ret;
  268. return 0;
  269. }
  270. int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr)
  271. {
  272. int ret;
  273. lockdep_assert_held(&ar->conf_mutex);
  274. ret = __ath11k_peer_delete(ar, vdev_id, addr);
  275. if (ret)
  276. return ret;
  277. ar->num_peers--;
  278. return 0;
  279. }
  280. static int ath11k_wait_for_peer_created(struct ath11k *ar, int vdev_id, const u8 *addr)
  281. {
  282. return ath11k_wait_for_peer_common(ar->ab, vdev_id, addr, true);
  283. }
  284. int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,
  285. struct ieee80211_sta *sta, struct peer_create_params *param)
  286. {
  287. struct ath11k_peer *peer;
  288. struct ath11k_sta *arsta;
  289. int ret, fbret;
  290. lockdep_assert_held(&ar->conf_mutex);
  291. if (ar->num_peers > (ar->max_num_peers - 1)) {
  292. ath11k_warn(ar->ab,
  293. "failed to create peer due to insufficient peer entry resource in firmware\n");
  294. return -ENOBUFS;
  295. }
  296. mutex_lock(&ar->ab->tbl_mtx_lock);
  297. spin_lock_bh(&ar->ab->base_lock);
  298. peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr);
  299. if (peer) {
  300. if (peer->vdev_id == param->vdev_id) {
  301. spin_unlock_bh(&ar->ab->base_lock);
  302. mutex_unlock(&ar->ab->tbl_mtx_lock);
  303. return -EINVAL;
  304. }
  305. /* Assume sta is transitioning to another band.
  306. * Remove here the peer from rhash.
  307. */
  308. ath11k_peer_rhash_delete(ar->ab, peer);
  309. }
  310. spin_unlock_bh(&ar->ab->base_lock);
  311. mutex_unlock(&ar->ab->tbl_mtx_lock);
  312. ret = ath11k_wmi_send_peer_create_cmd(ar, param);
  313. if (ret) {
  314. ath11k_warn(ar->ab,
  315. "failed to send peer create vdev_id %d ret %d\n",
  316. param->vdev_id, ret);
  317. return ret;
  318. }
  319. ret = ath11k_wait_for_peer_created(ar, param->vdev_id,
  320. param->peer_addr);
  321. if (ret)
  322. return ret;
  323. mutex_lock(&ar->ab->tbl_mtx_lock);
  324. spin_lock_bh(&ar->ab->base_lock);
  325. peer = ath11k_peer_find(ar->ab, param->vdev_id, param->peer_addr);
  326. if (!peer) {
  327. spin_unlock_bh(&ar->ab->base_lock);
  328. mutex_unlock(&ar->ab->tbl_mtx_lock);
  329. ath11k_warn(ar->ab, "failed to find peer %pM on vdev %i after creation\n",
  330. param->peer_addr, param->vdev_id);
  331. ret = -ENOENT;
  332. goto cleanup;
  333. }
  334. ret = ath11k_peer_rhash_add(ar->ab, peer);
  335. if (ret) {
  336. spin_unlock_bh(&ar->ab->base_lock);
  337. mutex_unlock(&ar->ab->tbl_mtx_lock);
  338. goto cleanup;
  339. }
  340. peer->pdev_idx = ar->pdev_idx;
  341. peer->sta = sta;
  342. if (arvif->vif->type == NL80211_IFTYPE_STATION) {
  343. arvif->ast_hash = peer->ast_hash;
  344. arvif->ast_idx = peer->hw_peer_id;
  345. }
  346. peer->sec_type = HAL_ENCRYPT_TYPE_OPEN;
  347. peer->sec_type_grp = HAL_ENCRYPT_TYPE_OPEN;
  348. if (sta) {
  349. arsta = (struct ath11k_sta *)sta->drv_priv;
  350. arsta->tcl_metadata |= FIELD_PREP(HTT_TCL_META_DATA_TYPE, 0) |
  351. FIELD_PREP(HTT_TCL_META_DATA_PEER_ID,
  352. peer->peer_id);
  353. /* set HTT extension valid bit to 0 by default */
  354. arsta->tcl_metadata &= ~HTT_TCL_META_DATA_VALID_HTT;
  355. }
  356. ar->num_peers++;
  357. spin_unlock_bh(&ar->ab->base_lock);
  358. mutex_unlock(&ar->ab->tbl_mtx_lock);
  359. return 0;
  360. cleanup:
  361. fbret = __ath11k_peer_delete(ar, param->vdev_id, param->peer_addr);
  362. if (fbret)
  363. ath11k_warn(ar->ab, "failed peer %pM delete vdev_id %d fallback ret %d\n",
  364. param->peer_addr, param->vdev_id, fbret);
  365. return ret;
  366. }
  367. int ath11k_peer_rhash_delete(struct ath11k_base *ab, struct ath11k_peer *peer)
  368. {
  369. int ret;
  370. lockdep_assert_held(&ab->base_lock);
  371. lockdep_assert_held(&ab->tbl_mtx_lock);
  372. if (!ab->rhead_peer_id || !ab->rhead_peer_addr)
  373. return -EPERM;
  374. ret = ath11k_peer_rhash_remove(ab, ab->rhead_peer_addr, &peer->rhash_addr,
  375. &ab->rhash_peer_addr_param);
  376. if (ret) {
  377. ath11k_warn(ab, "failed to remove peer %pM id %d in rhash_addr ret %d\n",
  378. peer->addr, peer->peer_id, ret);
  379. return ret;
  380. }
  381. ret = ath11k_peer_rhash_remove(ab, ab->rhead_peer_id, &peer->rhash_id,
  382. &ab->rhash_peer_id_param);
  383. if (ret) {
  384. ath11k_warn(ab, "failed to remove peer %pM id %d in rhash_id ret %d\n",
  385. peer->addr, peer->peer_id, ret);
  386. return ret;
  387. }
  388. return 0;
  389. }
  390. static int ath11k_peer_rhash_id_tbl_init(struct ath11k_base *ab)
  391. {
  392. struct rhashtable_params *param;
  393. struct rhashtable *rhash_id_tbl;
  394. int ret;
  395. size_t size;
  396. lockdep_assert_held(&ab->tbl_mtx_lock);
  397. if (ab->rhead_peer_id)
  398. return 0;
  399. size = sizeof(*ab->rhead_peer_id);
  400. rhash_id_tbl = kzalloc(size, GFP_KERNEL);
  401. if (!rhash_id_tbl) {
  402. ath11k_warn(ab, "failed to init rhash id table due to no mem (size %zu)\n",
  403. size);
  404. return -ENOMEM;
  405. }
  406. param = &ab->rhash_peer_id_param;
  407. param->key_offset = offsetof(struct ath11k_peer, peer_id);
  408. param->head_offset = offsetof(struct ath11k_peer, rhash_id);
  409. param->key_len = sizeof_field(struct ath11k_peer, peer_id);
  410. param->automatic_shrinking = true;
  411. param->nelem_hint = ab->num_radios * TARGET_NUM_PEERS_PDEV(ab);
  412. ret = rhashtable_init(rhash_id_tbl, param);
  413. if (ret) {
  414. ath11k_warn(ab, "failed to init peer id rhash table %d\n", ret);
  415. goto err_free;
  416. }
  417. spin_lock_bh(&ab->base_lock);
  418. if (!ab->rhead_peer_id) {
  419. ab->rhead_peer_id = rhash_id_tbl;
  420. } else {
  421. spin_unlock_bh(&ab->base_lock);
  422. goto cleanup_tbl;
  423. }
  424. spin_unlock_bh(&ab->base_lock);
  425. return 0;
  426. cleanup_tbl:
  427. rhashtable_destroy(rhash_id_tbl);
  428. err_free:
  429. kfree(rhash_id_tbl);
  430. return ret;
  431. }
  432. static int ath11k_peer_rhash_addr_tbl_init(struct ath11k_base *ab)
  433. {
  434. struct rhashtable_params *param;
  435. struct rhashtable *rhash_addr_tbl;
  436. int ret;
  437. size_t size;
  438. lockdep_assert_held(&ab->tbl_mtx_lock);
  439. if (ab->rhead_peer_addr)
  440. return 0;
  441. size = sizeof(*ab->rhead_peer_addr);
  442. rhash_addr_tbl = kzalloc(size, GFP_KERNEL);
  443. if (!rhash_addr_tbl) {
  444. ath11k_warn(ab, "failed to init rhash addr table due to no mem (size %zu)\n",
  445. size);
  446. return -ENOMEM;
  447. }
  448. param = &ab->rhash_peer_addr_param;
  449. param->key_offset = offsetof(struct ath11k_peer, addr);
  450. param->head_offset = offsetof(struct ath11k_peer, rhash_addr);
  451. param->key_len = sizeof_field(struct ath11k_peer, addr);
  452. param->automatic_shrinking = true;
  453. param->nelem_hint = ab->num_radios * TARGET_NUM_PEERS_PDEV(ab);
  454. ret = rhashtable_init(rhash_addr_tbl, param);
  455. if (ret) {
  456. ath11k_warn(ab, "failed to init peer addr rhash table %d\n", ret);
  457. goto err_free;
  458. }
  459. spin_lock_bh(&ab->base_lock);
  460. if (!ab->rhead_peer_addr) {
  461. ab->rhead_peer_addr = rhash_addr_tbl;
  462. } else {
  463. spin_unlock_bh(&ab->base_lock);
  464. goto cleanup_tbl;
  465. }
  466. spin_unlock_bh(&ab->base_lock);
  467. return 0;
  468. cleanup_tbl:
  469. rhashtable_destroy(rhash_addr_tbl);
  470. err_free:
  471. kfree(rhash_addr_tbl);
  472. return ret;
  473. }
  474. static inline void ath11k_peer_rhash_id_tbl_destroy(struct ath11k_base *ab)
  475. {
  476. lockdep_assert_held(&ab->tbl_mtx_lock);
  477. if (!ab->rhead_peer_id)
  478. return;
  479. rhashtable_destroy(ab->rhead_peer_id);
  480. kfree(ab->rhead_peer_id);
  481. ab->rhead_peer_id = NULL;
  482. }
  483. static inline void ath11k_peer_rhash_addr_tbl_destroy(struct ath11k_base *ab)
  484. {
  485. lockdep_assert_held(&ab->tbl_mtx_lock);
  486. if (!ab->rhead_peer_addr)
  487. return;
  488. rhashtable_destroy(ab->rhead_peer_addr);
  489. kfree(ab->rhead_peer_addr);
  490. ab->rhead_peer_addr = NULL;
  491. }
  492. int ath11k_peer_rhash_tbl_init(struct ath11k_base *ab)
  493. {
  494. int ret;
  495. mutex_lock(&ab->tbl_mtx_lock);
  496. ret = ath11k_peer_rhash_id_tbl_init(ab);
  497. if (ret)
  498. goto out;
  499. ret = ath11k_peer_rhash_addr_tbl_init(ab);
  500. if (ret)
  501. goto cleanup_tbl;
  502. mutex_unlock(&ab->tbl_mtx_lock);
  503. return 0;
  504. cleanup_tbl:
  505. ath11k_peer_rhash_id_tbl_destroy(ab);
  506. out:
  507. mutex_unlock(&ab->tbl_mtx_lock);
  508. return ret;
  509. }
  510. void ath11k_peer_rhash_tbl_destroy(struct ath11k_base *ab)
  511. {
  512. mutex_lock(&ab->tbl_mtx_lock);
  513. ath11k_peer_rhash_addr_tbl_destroy(ab);
  514. ath11k_peer_rhash_id_tbl_destroy(ab);
  515. mutex_unlock(&ab->tbl_mtx_lock);
  516. }