rt2x00mac.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
  3. <http://rt2x00.serialmonkey.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the
  14. Free Software Foundation, Inc.,
  15. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. /*
  18. Module: rt2x00mac
  19. Abstract: rt2x00 generic mac80211 routines.
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include "rt2x00.h"
  24. #include "rt2x00lib.h"
  25. static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
  26. struct data_queue *queue,
  27. struct sk_buff *frag_skb)
  28. {
  29. struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(frag_skb);
  30. struct ieee80211_tx_info *rts_info;
  31. struct sk_buff *skb;
  32. int size;
  33. if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
  34. size = sizeof(struct ieee80211_cts);
  35. else
  36. size = sizeof(struct ieee80211_rts);
  37. skb = dev_alloc_skb(size + rt2x00dev->hw->extra_tx_headroom);
  38. if (!skb) {
  39. WARNING(rt2x00dev, "Failed to create RTS/CTS frame.\n");
  40. return NETDEV_TX_BUSY;
  41. }
  42. skb_reserve(skb, rt2x00dev->hw->extra_tx_headroom);
  43. skb_put(skb, size);
  44. /*
  45. * Copy TX information over from original frame to
  46. * RTS/CTS frame. Note that we set the no encryption flag
  47. * since we don't want this frame to be encrypted.
  48. * RTS frames should be acked, while CTS-to-self frames
  49. * should not. The ready for TX flag is cleared to prevent
  50. * it being automatically send when the descriptor is
  51. * written to the hardware.
  52. */
  53. memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb));
  54. rts_info = IEEE80211_SKB_CB(skb);
  55. rts_info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
  56. rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS;
  57. rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT;
  58. rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
  59. if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
  60. rts_info->flags |= IEEE80211_TX_CTL_NO_ACK;
  61. else
  62. rts_info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
  63. if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
  64. ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif,
  65. frag_skb->data, size, tx_info,
  66. (struct ieee80211_cts *)(skb->data));
  67. else
  68. ieee80211_rts_get(rt2x00dev->hw, tx_info->control.vif,
  69. frag_skb->data, size, tx_info,
  70. (struct ieee80211_rts *)(skb->data));
  71. if (rt2x00queue_write_tx_frame(queue, skb)) {
  72. WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
  73. return NETDEV_TX_BUSY;
  74. }
  75. return NETDEV_TX_OK;
  76. }
  77. int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
  78. {
  79. struct rt2x00_dev *rt2x00dev = hw->priv;
  80. struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  81. struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
  82. enum data_queue_qid qid = skb_get_queue_mapping(skb);
  83. struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
  84. struct data_queue *queue;
  85. u16 frame_control;
  86. /*
  87. * Mac80211 might be calling this function while we are trying
  88. * to remove the device or perhaps suspending it.
  89. * Note that we can only stop the TX queues inside the TX path
  90. * due to possible race conditions in mac80211.
  91. */
  92. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
  93. ieee80211_stop_queues(hw);
  94. dev_kfree_skb_any(skb);
  95. return NETDEV_TX_OK;
  96. }
  97. /*
  98. * Determine which queue to put packet on.
  99. */
  100. if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
  101. test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
  102. queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM);
  103. else
  104. queue = rt2x00queue_get_queue(rt2x00dev, qid);
  105. if (unlikely(!queue)) {
  106. ERROR(rt2x00dev,
  107. "Attempt to send packet over invalid queue %d.\n"
  108. "Please file bug report to %s.\n", qid, DRV_PROJECT);
  109. dev_kfree_skb_any(skb);
  110. return NETDEV_TX_OK;
  111. }
  112. /*
  113. * If CTS/RTS is required. create and queue that frame first.
  114. * Make sure we have at least enough entries available to send
  115. * this CTS/RTS frame as well as the data frame.
  116. * Note that when the driver has set the set_rts_threshold()
  117. * callback function it doesn't need software generation of
  118. * either RTS or CTS-to-self frame and handles everything
  119. * inside the hardware.
  120. */
  121. frame_control = le16_to_cpu(ieee80211hdr->frame_control);
  122. if ((tx_info->flags & (IEEE80211_TX_CTL_USE_RTS_CTS |
  123. IEEE80211_TX_CTL_USE_CTS_PROTECT)) &&
  124. !rt2x00dev->ops->hw->set_rts_threshold) {
  125. if (rt2x00queue_available(queue) <= 1) {
  126. ieee80211_stop_queue(rt2x00dev->hw, qid);
  127. return NETDEV_TX_BUSY;
  128. }
  129. if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb)) {
  130. ieee80211_stop_queue(rt2x00dev->hw, qid);
  131. return NETDEV_TX_BUSY;
  132. }
  133. }
  134. /*
  135. * XXX: This is as wrong as the old mac80211 code was,
  136. * due to beacons not getting sequence numbers assigned
  137. * properly.
  138. */
  139. if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
  140. if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
  141. intf->seqno += 0x10;
  142. ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
  143. ieee80211hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
  144. }
  145. if (rt2x00queue_write_tx_frame(queue, skb)) {
  146. ieee80211_stop_queue(rt2x00dev->hw, qid);
  147. return NETDEV_TX_BUSY;
  148. }
  149. if (rt2x00queue_threshold(queue))
  150. ieee80211_stop_queue(rt2x00dev->hw, qid);
  151. return NETDEV_TX_OK;
  152. }
  153. EXPORT_SYMBOL_GPL(rt2x00mac_tx);
  154. int rt2x00mac_start(struct ieee80211_hw *hw)
  155. {
  156. struct rt2x00_dev *rt2x00dev = hw->priv;
  157. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
  158. return 0;
  159. return rt2x00lib_start(rt2x00dev);
  160. }
  161. EXPORT_SYMBOL_GPL(rt2x00mac_start);
  162. void rt2x00mac_stop(struct ieee80211_hw *hw)
  163. {
  164. struct rt2x00_dev *rt2x00dev = hw->priv;
  165. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
  166. return;
  167. rt2x00lib_stop(rt2x00dev);
  168. }
  169. EXPORT_SYMBOL_GPL(rt2x00mac_stop);
  170. int rt2x00mac_add_interface(struct ieee80211_hw *hw,
  171. struct ieee80211_if_init_conf *conf)
  172. {
  173. struct rt2x00_dev *rt2x00dev = hw->priv;
  174. struct rt2x00_intf *intf = vif_to_intf(conf->vif);
  175. struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, QID_BEACON);
  176. struct queue_entry *entry = NULL;
  177. unsigned int i;
  178. /*
  179. * Don't allow interfaces to be added
  180. * the device has disappeared.
  181. */
  182. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
  183. !test_bit(DEVICE_STARTED, &rt2x00dev->flags))
  184. return -ENODEV;
  185. /*
  186. * We don't support mixed combinations of sta and ap virtual
  187. * interfaces. We can only add this interface when the rival
  188. * interface count is 0.
  189. */
  190. if ((conf->type == IEEE80211_IF_TYPE_AP && rt2x00dev->intf_sta_count) ||
  191. (conf->type != IEEE80211_IF_TYPE_AP && rt2x00dev->intf_ap_count))
  192. return -ENOBUFS;
  193. /*
  194. * Check if we exceeded the maximum amount of supported interfaces.
  195. */
  196. if ((conf->type == IEEE80211_IF_TYPE_AP &&
  197. rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf) ||
  198. (conf->type != IEEE80211_IF_TYPE_AP &&
  199. rt2x00dev->intf_sta_count >= rt2x00dev->ops->max_sta_intf))
  200. return -ENOBUFS;
  201. /*
  202. * Loop through all beacon queues to find a free
  203. * entry. Since there are as much beacon entries
  204. * as the maximum interfaces, this search shouldn't
  205. * fail.
  206. */
  207. for (i = 0; i < queue->limit; i++) {
  208. entry = &queue->entries[i];
  209. if (!__test_and_set_bit(ENTRY_BCN_ASSIGNED, &entry->flags))
  210. break;
  211. }
  212. if (unlikely(i == queue->limit))
  213. return -ENOBUFS;
  214. /*
  215. * We are now absolutely sure the interface can be created,
  216. * increase interface count and start initialization.
  217. */
  218. if (conf->type == IEEE80211_IF_TYPE_AP)
  219. rt2x00dev->intf_ap_count++;
  220. else
  221. rt2x00dev->intf_sta_count++;
  222. spin_lock_init(&intf->lock);
  223. intf->beacon = entry;
  224. if (conf->type == IEEE80211_IF_TYPE_AP)
  225. memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN);
  226. memcpy(&intf->mac, conf->mac_addr, ETH_ALEN);
  227. /*
  228. * The MAC adddress must be configured after the device
  229. * has been initialized. Otherwise the device can reset
  230. * the MAC registers.
  231. */
  232. rt2x00lib_config_intf(rt2x00dev, intf, conf->type, intf->mac, NULL);
  233. /*
  234. * Some filters depend on the current working mode. We can force
  235. * an update during the next configure_filter() run by mac80211 by
  236. * resetting the current packet_filter state.
  237. */
  238. rt2x00dev->packet_filter = 0;
  239. return 0;
  240. }
  241. EXPORT_SYMBOL_GPL(rt2x00mac_add_interface);
  242. void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
  243. struct ieee80211_if_init_conf *conf)
  244. {
  245. struct rt2x00_dev *rt2x00dev = hw->priv;
  246. struct rt2x00_intf *intf = vif_to_intf(conf->vif);
  247. /*
  248. * Don't allow interfaces to be remove while
  249. * either the device has disappeared or when
  250. * no interface is present.
  251. */
  252. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
  253. (conf->type == IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_ap_count) ||
  254. (conf->type != IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_sta_count))
  255. return;
  256. if (conf->type == IEEE80211_IF_TYPE_AP)
  257. rt2x00dev->intf_ap_count--;
  258. else
  259. rt2x00dev->intf_sta_count--;
  260. /*
  261. * Release beacon entry so it is available for
  262. * new interfaces again.
  263. */
  264. __clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags);
  265. /*
  266. * Make sure the bssid and mac address registers
  267. * are cleared to prevent false ACKing of frames.
  268. */
  269. rt2x00lib_config_intf(rt2x00dev, intf,
  270. IEEE80211_IF_TYPE_INVALID, NULL, NULL);
  271. }
  272. EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface);
  273. int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
  274. {
  275. struct rt2x00_dev *rt2x00dev = hw->priv;
  276. /*
  277. * Mac80211 might be calling this function while we are trying
  278. * to remove the device or perhaps suspending it.
  279. */
  280. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
  281. return 0;
  282. /*
  283. * Check if we need to disable the radio,
  284. * if this is not the case, at least the RX must be disabled.
  285. */
  286. if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) {
  287. if (!conf->radio_enabled)
  288. rt2x00lib_disable_radio(rt2x00dev);
  289. else
  290. rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
  291. }
  292. rt2x00lib_config(rt2x00dev, conf, 0);
  293. /*
  294. * Reenable RX only if the radio should be on.
  295. */
  296. if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
  297. rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
  298. else if (conf->radio_enabled)
  299. return rt2x00lib_enable_radio(rt2x00dev);
  300. return 0;
  301. }
  302. EXPORT_SYMBOL_GPL(rt2x00mac_config);
  303. int rt2x00mac_config_interface(struct ieee80211_hw *hw,
  304. struct ieee80211_vif *vif,
  305. struct ieee80211_if_conf *conf)
  306. {
  307. struct rt2x00_dev *rt2x00dev = hw->priv;
  308. struct rt2x00_intf *intf = vif_to_intf(vif);
  309. int update_bssid = 0;
  310. int status = 0;
  311. /*
  312. * Mac80211 might be calling this function while we are trying
  313. * to remove the device or perhaps suspending it.
  314. */
  315. if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
  316. return 0;
  317. spin_lock(&intf->lock);
  318. /*
  319. * conf->bssid can be NULL if coming from the internal
  320. * beacon update routine.
  321. */
  322. if (conf->changed & IEEE80211_IFCC_BSSID && conf->bssid) {
  323. update_bssid = 1;
  324. memcpy(&intf->bssid, conf->bssid, ETH_ALEN);
  325. }
  326. spin_unlock(&intf->lock);
  327. /*
  328. * Call rt2x00_config_intf() outside of the spinlock context since
  329. * the call will sleep for USB drivers. By using the ieee80211_if_conf
  330. * values as arguments we make keep access to rt2x00_intf thread safe
  331. * even without the lock.
  332. */
  333. rt2x00lib_config_intf(rt2x00dev, intf, vif->type, NULL,
  334. update_bssid ? conf->bssid : NULL);
  335. /*
  336. * Update the beacon.
  337. */
  338. if (conf->changed & IEEE80211_IFCC_BEACON)
  339. status = rt2x00queue_update_beacon(rt2x00dev, vif);
  340. return status;
  341. }
  342. EXPORT_SYMBOL_GPL(rt2x00mac_config_interface);
  343. void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
  344. unsigned int changed_flags,
  345. unsigned int *total_flags,
  346. int mc_count, struct dev_addr_list *mc_list)
  347. {
  348. struct rt2x00_dev *rt2x00dev = hw->priv;
  349. /*
  350. * Mask off any flags we are going to ignore
  351. * from the total_flags field.
  352. */
  353. *total_flags &=
  354. FIF_ALLMULTI |
  355. FIF_FCSFAIL |
  356. FIF_PLCPFAIL |
  357. FIF_CONTROL |
  358. FIF_OTHER_BSS |
  359. FIF_PROMISC_IN_BSS;
  360. /*
  361. * Apply some rules to the filters:
  362. * - Some filters imply different filters to be set.
  363. * - Some things we can't filter out at all.
  364. * - Multicast filter seems to kill broadcast traffic so never use it.
  365. */
  366. *total_flags |= FIF_ALLMULTI;
  367. if (*total_flags & FIF_OTHER_BSS ||
  368. *total_flags & FIF_PROMISC_IN_BSS)
  369. *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
  370. /*
  371. * Check if there is any work left for us.
  372. */
  373. if (rt2x00dev->packet_filter == *total_flags)
  374. return;
  375. rt2x00dev->packet_filter = *total_flags;
  376. if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
  377. rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  378. else
  379. queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work);
  380. }
  381. EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
  382. int rt2x00mac_get_stats(struct ieee80211_hw *hw,
  383. struct ieee80211_low_level_stats *stats)
  384. {
  385. struct rt2x00_dev *rt2x00dev = hw->priv;
  386. /*
  387. * The dot11ACKFailureCount, dot11RTSFailureCount and
  388. * dot11RTSSuccessCount are updated in interrupt time.
  389. * dot11FCSErrorCount is updated in the link tuner.
  390. */
  391. memcpy(stats, &rt2x00dev->low_level_stats, sizeof(*stats));
  392. return 0;
  393. }
  394. EXPORT_SYMBOL_GPL(rt2x00mac_get_stats);
  395. int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
  396. struct ieee80211_tx_queue_stats *stats)
  397. {
  398. struct rt2x00_dev *rt2x00dev = hw->priv;
  399. unsigned int i;
  400. for (i = 0; i < rt2x00dev->ops->tx_queues; i++) {
  401. stats[i].len = rt2x00dev->tx[i].length;
  402. stats[i].limit = rt2x00dev->tx[i].limit;
  403. stats[i].count = rt2x00dev->tx[i].count;
  404. }
  405. return 0;
  406. }
  407. EXPORT_SYMBOL_GPL(rt2x00mac_get_tx_stats);
  408. void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
  409. struct ieee80211_vif *vif,
  410. struct ieee80211_bss_conf *bss_conf,
  411. u32 changes)
  412. {
  413. struct rt2x00_dev *rt2x00dev = hw->priv;
  414. struct rt2x00_intf *intf = vif_to_intf(vif);
  415. unsigned int delayed = 0;
  416. /*
  417. * When the association status has changed we must reset the link
  418. * tuner counter. This is because some drivers determine if they
  419. * should perform link tuning based on the number of seconds
  420. * while associated or not associated.
  421. */
  422. if (changes & BSS_CHANGED_ASSOC) {
  423. rt2x00dev->link.count = 0;
  424. if (bss_conf->assoc)
  425. rt2x00dev->intf_associated++;
  426. else
  427. rt2x00dev->intf_associated--;
  428. if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
  429. rt2x00leds_led_assoc(rt2x00dev,
  430. !!rt2x00dev->intf_associated);
  431. else
  432. delayed |= DELAYED_LED_ASSOC;
  433. }
  434. /*
  435. * When the erp information has changed, we should perform
  436. * additional configuration steps. For all other changes we are done.
  437. */
  438. if (changes & (BSS_CHANGED_ERP_PREAMBLE | BSS_CHANGED_ERP_CTS_PROT)) {
  439. if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
  440. rt2x00lib_config_erp(rt2x00dev, intf, bss_conf);
  441. else
  442. delayed |= DELAYED_CONFIG_ERP;
  443. }
  444. spin_lock(&intf->lock);
  445. memcpy(&intf->conf, bss_conf, sizeof(*bss_conf));
  446. if (delayed) {
  447. intf->delayed_flags |= delayed;
  448. schedule_work(&rt2x00dev->intf_work);
  449. }
  450. spin_unlock(&intf->lock);
  451. }
  452. EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed);
  453. int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
  454. const struct ieee80211_tx_queue_params *params)
  455. {
  456. struct rt2x00_dev *rt2x00dev = hw->priv;
  457. struct data_queue *queue;
  458. queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
  459. if (unlikely(!queue))
  460. return -EINVAL;
  461. /*
  462. * The passed variables are stored as real value ((2^n)-1).
  463. * Ralink registers require to know the bit number 'n'.
  464. */
  465. if (params->cw_min > 0)
  466. queue->cw_min = fls(params->cw_min);
  467. else
  468. queue->cw_min = 5; /* cw_min: 2^5 = 32. */
  469. if (params->cw_max > 0)
  470. queue->cw_max = fls(params->cw_max);
  471. else
  472. queue->cw_max = 10; /* cw_min: 2^10 = 1024. */
  473. queue->aifs = params->aifs;
  474. INFO(rt2x00dev,
  475. "Configured TX queue %d - CWmin: %d, CWmax: %d, Aifs: %d.\n",
  476. queue_idx, queue->cw_min, queue->cw_max, queue->aifs);
  477. return 0;
  478. }
  479. EXPORT_SYMBOL_GPL(rt2x00mac_conf_tx);