sta_info.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /*
  2. * Copyright 2002-2005, Instant802 Networks, Inc.
  3. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/module.h>
  10. #include <linux/init.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/types.h>
  13. #include <linux/slab.h>
  14. #include <linux/skbuff.h>
  15. #include <linux/if_arp.h>
  16. #include <linux/timer.h>
  17. #include <linux/rtnetlink.h>
  18. #include <net/mac80211.h>
  19. #include "ieee80211_i.h"
  20. #include "ieee80211_rate.h"
  21. #include "sta_info.h"
  22. #include "debugfs_sta.h"
  23. #include "mesh.h"
  24. /**
  25. * DOC: STA information lifetime rules
  26. *
  27. * STA info structures (&struct sta_info) are managed in a hash table
  28. * for faster lookup and a list for iteration. They are managed using
  29. * RCU, i.e. access to the list and hash table is protected by RCU.
  30. *
  31. * STA info structures are always "alive" when they are added with
  32. * @sta_info_add() [this may be changed in the future to allow allocating
  33. * outside of a critical section!], they are then added to the hash
  34. * table and list. Therefore, @sta_info_add() must also be RCU protected,
  35. * also, the caller of @sta_info_add() cannot assume that it owns the
  36. * structure.
  37. *
  38. * Because there are debugfs entries for each station, and adding those
  39. * must be able to sleep, it is also possible to "pin" a station entry,
  40. * that means it can be removed from the hash table but not be freed.
  41. * See the comment in @__sta_info_unlink() for more information.
  42. *
  43. * In order to remove a STA info structure, the caller needs to first
  44. * unlink it (@sta_info_unlink()) from the list and hash tables and
  45. * then wait for an RCU synchronisation before it can be freed. Due to
  46. * the pinning and the possibility of multiple callers trying to remove
  47. * the same STA info at the same time, @sta_info_unlink() can clear the
  48. * STA info pointer it is passed to indicate that the STA info is owned
  49. * by somebody else now.
  50. *
  51. * If @sta_info_unlink() did not clear the pointer then the caller owns
  52. * the STA info structure now and is responsible of destroying it with
  53. * a call to @sta_info_destroy(), not before RCU synchronisation, of
  54. * course. Note that sta_info_destroy() must be protected by the RTNL.
  55. *
  56. * In all other cases, there is no concept of ownership on a STA entry,
  57. * each structure is owned by the global hash table/list until it is
  58. * removed. All users of the structure need to be RCU protected so that
  59. * the structure won't be freed before they are done using it.
  60. */
  61. /* Caller must hold local->sta_lock */
  62. static int sta_info_hash_del(struct ieee80211_local *local,
  63. struct sta_info *sta)
  64. {
  65. struct sta_info *s;
  66. s = local->sta_hash[STA_HASH(sta->addr)];
  67. if (!s)
  68. return -ENOENT;
  69. if (s == sta) {
  70. rcu_assign_pointer(local->sta_hash[STA_HASH(sta->addr)],
  71. s->hnext);
  72. return 0;
  73. }
  74. while (s->hnext && s->hnext != sta)
  75. s = s->hnext;
  76. if (s->hnext) {
  77. rcu_assign_pointer(s->hnext, sta->hnext);
  78. return 0;
  79. }
  80. return -ENOENT;
  81. }
  82. /* protected by RCU */
  83. static struct sta_info *__sta_info_find(struct ieee80211_local *local,
  84. u8 *addr)
  85. {
  86. struct sta_info *sta;
  87. sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
  88. while (sta) {
  89. if (compare_ether_addr(sta->addr, addr) == 0)
  90. break;
  91. sta = rcu_dereference(sta->hnext);
  92. }
  93. return sta;
  94. }
  95. struct sta_info *sta_info_get(struct ieee80211_local *local, u8 *addr)
  96. {
  97. return __sta_info_find(local, addr);
  98. }
  99. EXPORT_SYMBOL(sta_info_get);
  100. struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
  101. struct net_device *dev)
  102. {
  103. struct sta_info *sta;
  104. int i = 0;
  105. list_for_each_entry_rcu(sta, &local->sta_list, list) {
  106. if (i < idx) {
  107. ++i;
  108. continue;
  109. } else if (!dev || dev == sta->sdata->dev) {
  110. return sta;
  111. }
  112. }
  113. return NULL;
  114. }
  115. void sta_info_destroy(struct sta_info *sta)
  116. {
  117. struct ieee80211_local *local = sta->local;
  118. struct sk_buff *skb;
  119. int i;
  120. ASSERT_RTNL();
  121. might_sleep();
  122. rate_control_remove_sta_debugfs(sta);
  123. ieee80211_sta_debugfs_remove(sta);
  124. #ifdef CONFIG_MAC80211_MESH
  125. if (ieee80211_vif_is_mesh(&sta->sdata->vif))
  126. mesh_plink_deactivate(sta);
  127. #endif
  128. /*
  129. * NOTE: This will call synchronize_rcu() internally to
  130. * make sure no key references can be in use. We rely on
  131. * that here for the mesh code!
  132. */
  133. ieee80211_key_free(sta->key);
  134. WARN_ON(sta->key);
  135. #ifdef CONFIG_MAC80211_MESH
  136. if (ieee80211_vif_is_mesh(&sta->sdata->vif))
  137. del_timer_sync(&sta->plink_timer);
  138. #endif
  139. while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
  140. local->total_ps_buffered--;
  141. dev_kfree_skb_any(skb);
  142. }
  143. while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL)
  144. dev_kfree_skb_any(skb);
  145. for (i = 0; i < STA_TID_NUM; i++) {
  146. del_timer_sync(&sta->ampdu_mlme.tid_rx[i].session_timer);
  147. del_timer_sync(&sta->ampdu_mlme.tid_tx[i].addba_resp_timer);
  148. }
  149. rate_control_free_sta(sta->rate_ctrl, sta->rate_ctrl_priv);
  150. rate_control_put(sta->rate_ctrl);
  151. kfree(sta);
  152. }
  153. /* Caller must hold local->sta_lock */
  154. static void sta_info_hash_add(struct ieee80211_local *local,
  155. struct sta_info *sta)
  156. {
  157. sta->hnext = local->sta_hash[STA_HASH(sta->addr)];
  158. rcu_assign_pointer(local->sta_hash[STA_HASH(sta->addr)], sta);
  159. }
  160. struct sta_info *sta_info_add(struct ieee80211_sub_if_data *sdata,
  161. u8 *addr)
  162. {
  163. struct ieee80211_local *local = sdata->local;
  164. struct sta_info *sta;
  165. int i;
  166. DECLARE_MAC_BUF(mac);
  167. unsigned long flags;
  168. sta = kzalloc(sizeof(*sta), GFP_ATOMIC);
  169. if (!sta)
  170. return ERR_PTR(-ENOMEM);
  171. memcpy(sta->addr, addr, ETH_ALEN);
  172. sta->local = local;
  173. sta->sdata = sdata;
  174. sta->rate_ctrl = rate_control_get(local->rate_ctrl);
  175. sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  176. GFP_ATOMIC);
  177. if (!sta->rate_ctrl_priv) {
  178. rate_control_put(sta->rate_ctrl);
  179. kfree(sta);
  180. return ERR_PTR(-ENOMEM);
  181. }
  182. spin_lock_init(&sta->ampdu_mlme.ampdu_rx);
  183. spin_lock_init(&sta->ampdu_mlme.ampdu_tx);
  184. for (i = 0; i < STA_TID_NUM; i++) {
  185. /* timer_to_tid must be initialized with identity mapping to
  186. * enable session_timer's data differentiation. refer to
  187. * sta_rx_agg_session_timer_expired for useage */
  188. sta->timer_to_tid[i] = i;
  189. /* tid to tx queue: initialize according to HW (0 is valid) */
  190. sta->tid_to_tx_q[i] = local->hw.queues;
  191. /* rx timers */
  192. sta->ampdu_mlme.tid_rx[i].session_timer.function =
  193. sta_rx_agg_session_timer_expired;
  194. sta->ampdu_mlme.tid_rx[i].session_timer.data =
  195. (unsigned long)&sta->timer_to_tid[i];
  196. init_timer(&sta->ampdu_mlme.tid_rx[i].session_timer);
  197. /* tx timers */
  198. sta->ampdu_mlme.tid_tx[i].addba_resp_timer.function =
  199. sta_addba_resp_timer_expired;
  200. sta->ampdu_mlme.tid_tx[i].addba_resp_timer.data =
  201. (unsigned long)&sta->timer_to_tid[i];
  202. init_timer(&sta->ampdu_mlme.tid_tx[i].addba_resp_timer);
  203. }
  204. skb_queue_head_init(&sta->ps_tx_buf);
  205. skb_queue_head_init(&sta->tx_filtered);
  206. spin_lock_irqsave(&local->sta_lock, flags);
  207. /* check if STA exists already */
  208. if (__sta_info_find(local, addr)) {
  209. spin_unlock_irqrestore(&local->sta_lock, flags);
  210. return ERR_PTR(-EEXIST);
  211. }
  212. list_add(&sta->list, &local->sta_list);
  213. local->num_sta++;
  214. sta_info_hash_add(local, sta);
  215. /* notify driver */
  216. if (local->ops->sta_notify) {
  217. if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
  218. sdata = sdata->u.vlan.ap;
  219. local->ops->sta_notify(local_to_hw(local), &sdata->vif,
  220. STA_NOTIFY_ADD, addr);
  221. }
  222. spin_unlock_irqrestore(&local->sta_lock, flags);
  223. #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
  224. printk(KERN_DEBUG "%s: Added STA %s\n",
  225. wiphy_name(local->hw.wiphy), print_mac(mac, addr));
  226. #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
  227. #ifdef CONFIG_MAC80211_DEBUGFS
  228. /* debugfs entry adding might sleep, so schedule process
  229. * context task for adding entry for STAs that do not yet
  230. * have one. */
  231. queue_work(local->hw.workqueue, &local->sta_debugfs_add);
  232. #endif
  233. return sta;
  234. }
  235. static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid)
  236. {
  237. /*
  238. * This format has been mandated by the IEEE specifications,
  239. * so this line may not be changed to use the __set_bit() format.
  240. */
  241. bss->tim[aid / 8] |= (1 << (aid % 8));
  242. }
  243. static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid)
  244. {
  245. /*
  246. * This format has been mandated by the IEEE specifications,
  247. * so this line may not be changed to use the __clear_bit() format.
  248. */
  249. bss->tim[aid / 8] &= ~(1 << (aid % 8));
  250. }
  251. static void __sta_info_set_tim_bit(struct ieee80211_if_ap *bss,
  252. struct sta_info *sta)
  253. {
  254. if (bss)
  255. __bss_tim_set(bss, sta->aid);
  256. if (sta->local->ops->set_tim) {
  257. sta->local->tim_in_locked_section = true;
  258. sta->local->ops->set_tim(local_to_hw(sta->local), sta->aid, 1);
  259. sta->local->tim_in_locked_section = false;
  260. }
  261. }
  262. void sta_info_set_tim_bit(struct sta_info *sta)
  263. {
  264. unsigned long flags;
  265. spin_lock_irqsave(&sta->local->sta_lock, flags);
  266. __sta_info_set_tim_bit(sta->sdata->bss, sta);
  267. spin_unlock_irqrestore(&sta->local->sta_lock, flags);
  268. }
  269. static void __sta_info_clear_tim_bit(struct ieee80211_if_ap *bss,
  270. struct sta_info *sta)
  271. {
  272. if (bss)
  273. __bss_tim_clear(bss, sta->aid);
  274. if (sta->local->ops->set_tim) {
  275. sta->local->tim_in_locked_section = true;
  276. sta->local->ops->set_tim(local_to_hw(sta->local), sta->aid, 0);
  277. sta->local->tim_in_locked_section = false;
  278. }
  279. }
  280. void sta_info_clear_tim_bit(struct sta_info *sta)
  281. {
  282. unsigned long flags;
  283. spin_lock_irqsave(&sta->local->sta_lock, flags);
  284. __sta_info_clear_tim_bit(sta->sdata->bss, sta);
  285. spin_unlock_irqrestore(&sta->local->sta_lock, flags);
  286. }
  287. /*
  288. * See comment in __sta_info_unlink,
  289. * caller must hold local->sta_lock.
  290. */
  291. static void __sta_info_pin(struct sta_info *sta)
  292. {
  293. WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_NORMAL);
  294. sta->pin_status = STA_INFO_PIN_STAT_PINNED;
  295. }
  296. /*
  297. * See comment in __sta_info_unlink, returns sta if it
  298. * needs to be destroyed.
  299. */
  300. static struct sta_info *__sta_info_unpin(struct sta_info *sta)
  301. {
  302. struct sta_info *ret = NULL;
  303. unsigned long flags;
  304. spin_lock_irqsave(&sta->local->sta_lock, flags);
  305. WARN_ON(sta->pin_status != STA_INFO_PIN_STAT_DESTROY &&
  306. sta->pin_status != STA_INFO_PIN_STAT_PINNED);
  307. if (sta->pin_status == STA_INFO_PIN_STAT_DESTROY)
  308. ret = sta;
  309. sta->pin_status = STA_INFO_PIN_STAT_NORMAL;
  310. spin_unlock_irqrestore(&sta->local->sta_lock, flags);
  311. return ret;
  312. }
  313. static void __sta_info_unlink(struct sta_info **sta)
  314. {
  315. struct ieee80211_local *local = (*sta)->local;
  316. struct ieee80211_sub_if_data *sdata = (*sta)->sdata;
  317. #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
  318. DECLARE_MAC_BUF(mbuf);
  319. #endif
  320. /*
  321. * pull caller's reference if we're already gone.
  322. */
  323. if (sta_info_hash_del(local, *sta)) {
  324. *sta = NULL;
  325. return;
  326. }
  327. /*
  328. * Also pull caller's reference if the STA is pinned by the
  329. * task that is adding the debugfs entries. In that case, we
  330. * leave the STA "to be freed".
  331. *
  332. * The rules are not trivial, but not too complex either:
  333. * (1) pin_status is only modified under the sta_lock
  334. * (2) sta_info_debugfs_add_work() will set the status
  335. * to PINNED when it found an item that needs a new
  336. * debugfs directory created. In that case, that item
  337. * must not be freed although all *RCU* users are done
  338. * with it. Hence, we tell the caller of _unlink()
  339. * that the item is already gone (as can happen when
  340. * two tasks try to unlink/destroy at the same time)
  341. * (3) We set the pin_status to DESTROY here when we
  342. * find such an item.
  343. * (4) sta_info_debugfs_add_work() will reset the pin_status
  344. * from PINNED to NORMAL when it is done with the item,
  345. * but will check for DESTROY before resetting it in
  346. * which case it will free the item.
  347. */
  348. if ((*sta)->pin_status == STA_INFO_PIN_STAT_PINNED) {
  349. (*sta)->pin_status = STA_INFO_PIN_STAT_DESTROY;
  350. *sta = NULL;
  351. return;
  352. }
  353. list_del(&(*sta)->list);
  354. if ((*sta)->flags & WLAN_STA_PS) {
  355. (*sta)->flags &= ~WLAN_STA_PS;
  356. if (sdata->bss)
  357. atomic_dec(&sdata->bss->num_sta_ps);
  358. __sta_info_clear_tim_bit(sdata->bss, *sta);
  359. }
  360. local->num_sta--;
  361. if (local->ops->sta_notify) {
  362. if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
  363. sdata = sdata->u.vlan.ap;
  364. local->ops->sta_notify(local_to_hw(local), &sdata->vif,
  365. STA_NOTIFY_REMOVE, (*sta)->addr);
  366. }
  367. if (ieee80211_vif_is_mesh(&sdata->vif)) {
  368. mesh_accept_plinks_update(sdata);
  369. #ifdef CONFIG_MAC80211_MESH
  370. del_timer(&(*sta)->plink_timer);
  371. #endif
  372. }
  373. #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
  374. printk(KERN_DEBUG "%s: Removed STA %s\n",
  375. wiphy_name(local->hw.wiphy), print_mac(mbuf, (*sta)->addr));
  376. #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
  377. }
  378. void sta_info_unlink(struct sta_info **sta)
  379. {
  380. struct ieee80211_local *local = (*sta)->local;
  381. unsigned long flags;
  382. spin_lock_irqsave(&local->sta_lock, flags);
  383. __sta_info_unlink(sta);
  384. spin_unlock_irqrestore(&local->sta_lock, flags);
  385. }
  386. static inline int sta_info_buffer_expired(struct ieee80211_local *local,
  387. struct sta_info *sta,
  388. struct sk_buff *skb)
  389. {
  390. struct ieee80211_tx_packet_data *pkt_data;
  391. int timeout;
  392. if (!skb)
  393. return 0;
  394. pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
  395. /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */
  396. timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 /
  397. 15625) * HZ;
  398. if (timeout < STA_TX_BUFFER_EXPIRE)
  399. timeout = STA_TX_BUFFER_EXPIRE;
  400. return time_after(jiffies, pkt_data->jiffies + timeout);
  401. }
  402. static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
  403. struct sta_info *sta)
  404. {
  405. unsigned long flags;
  406. struct sk_buff *skb;
  407. struct ieee80211_sub_if_data *sdata;
  408. DECLARE_MAC_BUF(mac);
  409. if (skb_queue_empty(&sta->ps_tx_buf))
  410. return;
  411. for (;;) {
  412. spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
  413. skb = skb_peek(&sta->ps_tx_buf);
  414. if (sta_info_buffer_expired(local, sta, skb))
  415. skb = __skb_dequeue(&sta->ps_tx_buf);
  416. else
  417. skb = NULL;
  418. spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags);
  419. if (!skb)
  420. break;
  421. sdata = sta->sdata;
  422. local->total_ps_buffered--;
  423. printk(KERN_DEBUG "Buffered frame expired (STA "
  424. "%s)\n", print_mac(mac, sta->addr));
  425. dev_kfree_skb(skb);
  426. if (skb_queue_empty(&sta->ps_tx_buf))
  427. sta_info_clear_tim_bit(sta);
  428. }
  429. }
  430. static void sta_info_cleanup(unsigned long data)
  431. {
  432. struct ieee80211_local *local = (struct ieee80211_local *) data;
  433. struct sta_info *sta;
  434. rcu_read_lock();
  435. list_for_each_entry_rcu(sta, &local->sta_list, list)
  436. sta_info_cleanup_expire_buffered(local, sta);
  437. rcu_read_unlock();
  438. local->sta_cleanup.expires =
  439. round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
  440. add_timer(&local->sta_cleanup);
  441. }
  442. #ifdef CONFIG_MAC80211_DEBUGFS
  443. static void sta_info_debugfs_add_work(struct work_struct *work)
  444. {
  445. struct ieee80211_local *local =
  446. container_of(work, struct ieee80211_local, sta_debugfs_add);
  447. struct sta_info *sta, *tmp;
  448. unsigned long flags;
  449. while (1) {
  450. sta = NULL;
  451. spin_lock_irqsave(&local->sta_lock, flags);
  452. list_for_each_entry(tmp, &local->sta_list, list) {
  453. if (!tmp->debugfs.dir) {
  454. sta = tmp;
  455. __sta_info_pin(sta);
  456. break;
  457. }
  458. }
  459. spin_unlock_irqrestore(&local->sta_lock, flags);
  460. if (!sta)
  461. break;
  462. ieee80211_sta_debugfs_add(sta);
  463. rate_control_add_sta_debugfs(sta);
  464. sta = __sta_info_unpin(sta);
  465. if (sta) {
  466. synchronize_rcu();
  467. sta_info_destroy(sta);
  468. }
  469. }
  470. }
  471. #endif
  472. void sta_info_init(struct ieee80211_local *local)
  473. {
  474. spin_lock_init(&local->sta_lock);
  475. INIT_LIST_HEAD(&local->sta_list);
  476. setup_timer(&local->sta_cleanup, sta_info_cleanup,
  477. (unsigned long)local);
  478. local->sta_cleanup.expires =
  479. round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
  480. #ifdef CONFIG_MAC80211_DEBUGFS
  481. INIT_WORK(&local->sta_debugfs_add, sta_info_debugfs_add_work);
  482. #endif
  483. }
  484. int sta_info_start(struct ieee80211_local *local)
  485. {
  486. add_timer(&local->sta_cleanup);
  487. return 0;
  488. }
  489. void sta_info_stop(struct ieee80211_local *local)
  490. {
  491. del_timer(&local->sta_cleanup);
  492. sta_info_flush(local, NULL);
  493. }
  494. /**
  495. * sta_info_flush - flush matching STA entries from the STA table
  496. * @local: local interface data
  497. * @sdata: matching rule for the net device (sta->dev) or %NULL to match all STAs
  498. */
  499. void sta_info_flush(struct ieee80211_local *local,
  500. struct ieee80211_sub_if_data *sdata)
  501. {
  502. struct sta_info *sta, *tmp;
  503. LIST_HEAD(tmp_list);
  504. unsigned long flags;
  505. might_sleep();
  506. spin_lock_irqsave(&local->sta_lock, flags);
  507. list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
  508. if (!sdata || sdata == sta->sdata) {
  509. __sta_info_unlink(&sta);
  510. if (sta)
  511. list_add_tail(&sta->list, &tmp_list);
  512. }
  513. }
  514. spin_unlock_irqrestore(&local->sta_lock, flags);
  515. synchronize_rcu();
  516. list_for_each_entry_safe(sta, tmp, &tmp_list, list)
  517. sta_info_destroy(sta);
  518. }