tx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /****************************************************************************
  3. * Driver for Solarflare network controllers and boards
  4. * Copyright 2005-2006 Fen Systems Ltd.
  5. * Copyright 2005-2013 Solarflare Communications Inc.
  6. */
  7. #include <linux/pci.h>
  8. #include <linux/tcp.h>
  9. #include <linux/ip.h>
  10. #include <linux/in.h>
  11. #include <linux/ipv6.h>
  12. #include <linux/slab.h>
  13. #include <net/ipv6.h>
  14. #include <linux/if_ether.h>
  15. #include <linux/highmem.h>
  16. #include <linux/cache.h>
  17. #include "net_driver.h"
  18. #include "efx.h"
  19. #include "io.h"
  20. #include "nic.h"
  21. #include "tx.h"
  22. #include "tx_common.h"
  23. #include "workarounds.h"
  24. #include "ef10_regs.h"
  25. #ifdef EFX_USE_PIO
  26. #define EFX_PIOBUF_SIZE_DEF ALIGN(256, L1_CACHE_BYTES)
  27. unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF;
  28. #endif /* EFX_USE_PIO */
  29. static inline u8 *efx_tx_get_copy_buffer(struct efx_tx_queue *tx_queue,
  30. struct efx_tx_buffer *buffer)
  31. {
  32. unsigned int index = efx_tx_queue_get_insert_index(tx_queue);
  33. struct efx_buffer *page_buf =
  34. &tx_queue->cb_page[index >> (PAGE_SHIFT - EFX_TX_CB_ORDER)];
  35. unsigned int offset =
  36. ((index << EFX_TX_CB_ORDER) + NET_IP_ALIGN) & (PAGE_SIZE - 1);
  37. if (unlikely(!page_buf->addr) &&
  38. efx_nic_alloc_buffer(tx_queue->efx, page_buf, PAGE_SIZE,
  39. GFP_ATOMIC))
  40. return NULL;
  41. buffer->dma_addr = page_buf->dma_addr + offset;
  42. buffer->unmap_len = 0;
  43. return (u8 *)page_buf->addr + offset;
  44. }
  45. static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1)
  46. {
  47. /* We need to consider all queues that the net core sees as one */
  48. struct efx_nic *efx = txq1->efx;
  49. struct efx_tx_queue *txq2;
  50. unsigned int fill_level;
  51. fill_level = efx_channel_tx_old_fill_level(txq1->channel);
  52. if (likely(fill_level < efx->txq_stop_thresh))
  53. return;
  54. /* We used the stale old_read_count above, which gives us a
  55. * pessimistic estimate of the fill level (which may even
  56. * validly be >= efx->txq_entries). Now try again using
  57. * read_count (more likely to be a cache miss).
  58. *
  59. * If we read read_count and then conditionally stop the
  60. * queue, it is possible for the completion path to race with
  61. * us and complete all outstanding descriptors in the middle,
  62. * after which there will be no more completions to wake it.
  63. * Therefore we stop the queue first, then read read_count
  64. * (with a memory barrier to ensure the ordering), then
  65. * restart the queue if the fill level turns out to be low
  66. * enough.
  67. */
  68. netif_tx_stop_queue(txq1->core_txq);
  69. smp_mb();
  70. efx_for_each_channel_tx_queue(txq2, txq1->channel)
  71. txq2->old_read_count = READ_ONCE(txq2->read_count);
  72. fill_level = efx_channel_tx_old_fill_level(txq1->channel);
  73. EFX_WARN_ON_ONCE_PARANOID(fill_level >= efx->txq_entries);
  74. if (likely(fill_level < efx->txq_stop_thresh)) {
  75. smp_mb();
  76. if (likely(!efx->loopback_selftest))
  77. netif_tx_start_queue(txq1->core_txq);
  78. }
  79. }
  80. static int efx_enqueue_skb_copy(struct efx_tx_queue *tx_queue,
  81. struct sk_buff *skb)
  82. {
  83. unsigned int copy_len = skb->len;
  84. struct efx_tx_buffer *buffer;
  85. u8 *copy_buffer;
  86. int rc;
  87. EFX_WARN_ON_ONCE_PARANOID(copy_len > EFX_TX_CB_SIZE);
  88. buffer = efx_tx_queue_get_insert_buffer(tx_queue);
  89. copy_buffer = efx_tx_get_copy_buffer(tx_queue, buffer);
  90. if (unlikely(!copy_buffer))
  91. return -ENOMEM;
  92. rc = skb_copy_bits(skb, 0, copy_buffer, copy_len);
  93. EFX_WARN_ON_PARANOID(rc);
  94. buffer->len = copy_len;
  95. buffer->skb = skb;
  96. buffer->flags = EFX_TX_BUF_SKB;
  97. ++tx_queue->insert_count;
  98. return rc;
  99. }
  100. #ifdef EFX_USE_PIO
  101. struct efx_short_copy_buffer {
  102. int used;
  103. u8 buf[L1_CACHE_BYTES];
  104. };
  105. /* Copy to PIO, respecting that writes to PIO buffers must be dword aligned.
  106. * Advances piobuf pointer. Leaves additional data in the copy buffer.
  107. */
  108. static void efx_memcpy_toio_aligned(struct efx_nic *efx, u8 __iomem **piobuf,
  109. u8 *data, int len,
  110. struct efx_short_copy_buffer *copy_buf)
  111. {
  112. int block_len = len & ~(sizeof(copy_buf->buf) - 1);
  113. __iowrite64_copy(*piobuf, data, block_len >> 3);
  114. *piobuf += block_len;
  115. len -= block_len;
  116. if (len) {
  117. data += block_len;
  118. BUG_ON(copy_buf->used);
  119. BUG_ON(len > sizeof(copy_buf->buf));
  120. memcpy(copy_buf->buf, data, len);
  121. copy_buf->used = len;
  122. }
  123. }
  124. /* Copy to PIO, respecting dword alignment, popping data from copy buffer first.
  125. * Advances piobuf pointer. Leaves additional data in the copy buffer.
  126. */
  127. static void efx_memcpy_toio_aligned_cb(struct efx_nic *efx, u8 __iomem **piobuf,
  128. u8 *data, int len,
  129. struct efx_short_copy_buffer *copy_buf)
  130. {
  131. if (copy_buf->used) {
  132. /* if the copy buffer is partially full, fill it up and write */
  133. int copy_to_buf =
  134. min_t(int, sizeof(copy_buf->buf) - copy_buf->used, len);
  135. memcpy(copy_buf->buf + copy_buf->used, data, copy_to_buf);
  136. copy_buf->used += copy_to_buf;
  137. /* if we didn't fill it up then we're done for now */
  138. if (copy_buf->used < sizeof(copy_buf->buf))
  139. return;
  140. __iowrite64_copy(*piobuf, copy_buf->buf,
  141. sizeof(copy_buf->buf) >> 3);
  142. *piobuf += sizeof(copy_buf->buf);
  143. data += copy_to_buf;
  144. len -= copy_to_buf;
  145. copy_buf->used = 0;
  146. }
  147. efx_memcpy_toio_aligned(efx, piobuf, data, len, copy_buf);
  148. }
  149. static void efx_flush_copy_buffer(struct efx_nic *efx, u8 __iomem *piobuf,
  150. struct efx_short_copy_buffer *copy_buf)
  151. {
  152. /* if there's anything in it, write the whole buffer, including junk */
  153. if (copy_buf->used)
  154. __iowrite64_copy(piobuf, copy_buf->buf,
  155. sizeof(copy_buf->buf) >> 3);
  156. }
  157. /* Traverse skb structure and copy fragments in to PIO buffer.
  158. * Advances piobuf pointer.
  159. */
  160. static void efx_skb_copy_bits_to_pio(struct efx_nic *efx, struct sk_buff *skb,
  161. u8 __iomem **piobuf,
  162. struct efx_short_copy_buffer *copy_buf)
  163. {
  164. int i;
  165. efx_memcpy_toio_aligned(efx, piobuf, skb->data, skb_headlen(skb),
  166. copy_buf);
  167. for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) {
  168. skb_frag_t *f = &skb_shinfo(skb)->frags[i];
  169. u8 *vaddr;
  170. vaddr = kmap_local_page(skb_frag_page(f));
  171. efx_memcpy_toio_aligned_cb(efx, piobuf, vaddr + skb_frag_off(f),
  172. skb_frag_size(f), copy_buf);
  173. kunmap_local(vaddr);
  174. }
  175. EFX_WARN_ON_ONCE_PARANOID(skb_shinfo(skb)->frag_list);
  176. }
  177. static int efx_enqueue_skb_pio(struct efx_tx_queue *tx_queue,
  178. struct sk_buff *skb)
  179. {
  180. struct efx_tx_buffer *buffer =
  181. efx_tx_queue_get_insert_buffer(tx_queue);
  182. u8 __iomem *piobuf = tx_queue->piobuf;
  183. /* Copy to PIO buffer. Ensure the writes are padded to the end
  184. * of a cache line, as this is required for write-combining to be
  185. * effective on at least x86.
  186. */
  187. if (skb_shinfo(skb)->nr_frags) {
  188. /* The size of the copy buffer will ensure all writes
  189. * are the size of a cache line.
  190. */
  191. struct efx_short_copy_buffer copy_buf;
  192. copy_buf.used = 0;
  193. efx_skb_copy_bits_to_pio(tx_queue->efx, skb,
  194. &piobuf, &copy_buf);
  195. efx_flush_copy_buffer(tx_queue->efx, piobuf, &copy_buf);
  196. } else {
  197. /* Pad the write to the size of a cache line.
  198. * We can do this because we know the skb_shared_info struct is
  199. * after the source, and the destination buffer is big enough.
  200. */
  201. BUILD_BUG_ON(L1_CACHE_BYTES >
  202. SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
  203. __iowrite64_copy(tx_queue->piobuf, skb->data,
  204. ALIGN(skb->len, L1_CACHE_BYTES) >> 3);
  205. }
  206. buffer->skb = skb;
  207. buffer->flags = EFX_TX_BUF_SKB | EFX_TX_BUF_OPTION;
  208. EFX_POPULATE_QWORD_5(buffer->option,
  209. ESF_DZ_TX_DESC_IS_OPT, 1,
  210. ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_PIO,
  211. ESF_DZ_TX_PIO_CONT, 0,
  212. ESF_DZ_TX_PIO_BYTE_CNT, skb->len,
  213. ESF_DZ_TX_PIO_BUF_ADDR,
  214. tx_queue->piobuf_offset);
  215. ++tx_queue->insert_count;
  216. return 0;
  217. }
  218. /* Decide whether we can use TX PIO, ie. write packet data directly into
  219. * a buffer on the device. This can reduce latency at the expense of
  220. * throughput, so we only do this if both hardware and software TX rings
  221. * are empty, including all queues for the channel. This also ensures that
  222. * only one packet at a time can be using the PIO buffer. If the xmit_more
  223. * flag is set then we don't use this - there'll be another packet along
  224. * shortly and we want to hold off the doorbell.
  225. */
  226. static bool efx_tx_may_pio(struct efx_tx_queue *tx_queue)
  227. {
  228. struct efx_channel *channel = tx_queue->channel;
  229. if (!tx_queue->piobuf)
  230. return false;
  231. EFX_WARN_ON_ONCE_PARANOID(!channel->efx->type->option_descriptors);
  232. efx_for_each_channel_tx_queue(tx_queue, channel)
  233. if (!efx_nic_tx_is_empty(tx_queue, tx_queue->packet_write_count))
  234. return false;
  235. return true;
  236. }
  237. #endif /* EFX_USE_PIO */
  238. /* Send any pending traffic for a channel. xmit_more is shared across all
  239. * queues for a channel, so we must check all of them.
  240. */
  241. static void efx_tx_send_pending(struct efx_channel *channel)
  242. {
  243. struct efx_tx_queue *q;
  244. efx_for_each_channel_tx_queue(q, channel) {
  245. if (q->xmit_pending)
  246. efx_nic_push_buffers(q);
  247. }
  248. }
  249. /*
  250. * Add a socket buffer to a TX queue
  251. *
  252. * This maps all fragments of a socket buffer for DMA and adds them to
  253. * the TX queue. The queue's insert pointer will be incremented by
  254. * the number of fragments in the socket buffer.
  255. *
  256. * If any DMA mapping fails, any mapped fragments will be unmapped,
  257. * the queue's insert pointer will be restored to its original value.
  258. *
  259. * This function is split out from efx_hard_start_xmit to allow the
  260. * loopback test to direct packets via specific TX queues.
  261. *
  262. * Returns NETDEV_TX_OK.
  263. * You must hold netif_tx_lock() to call this function.
  264. */
  265. netdev_tx_t __efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
  266. {
  267. unsigned int old_insert_count = tx_queue->insert_count;
  268. bool xmit_more = netdev_xmit_more();
  269. bool data_mapped = false;
  270. unsigned int segments;
  271. unsigned int skb_len;
  272. int rc;
  273. skb_len = skb->len;
  274. segments = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 0;
  275. if (segments == 1)
  276. segments = 0; /* Don't use TSO for a single segment. */
  277. /* Handle TSO first - it's *possible* (although unlikely) that we might
  278. * be passed a packet to segment that's smaller than the copybreak/PIO
  279. * size limit.
  280. */
  281. if (segments) {
  282. switch (tx_queue->tso_version) {
  283. case 1:
  284. rc = efx_enqueue_skb_tso(tx_queue, skb, &data_mapped);
  285. break;
  286. case 2:
  287. rc = efx_ef10_tx_tso_desc(tx_queue, skb, &data_mapped);
  288. break;
  289. case 0: /* No TSO on this queue, SW fallback needed */
  290. default:
  291. rc = -EINVAL;
  292. break;
  293. }
  294. if (rc == -EINVAL) {
  295. rc = efx_tx_tso_fallback(tx_queue, skb);
  296. tx_queue->tso_fallbacks++;
  297. if (rc == 0)
  298. return 0;
  299. }
  300. if (rc)
  301. goto err;
  302. #ifdef EFX_USE_PIO
  303. } else if (skb_len <= efx_piobuf_size && !xmit_more &&
  304. efx_tx_may_pio(tx_queue)) {
  305. /* Use PIO for short packets with an empty queue. */
  306. if (efx_enqueue_skb_pio(tx_queue, skb))
  307. goto err;
  308. tx_queue->pio_packets++;
  309. data_mapped = true;
  310. #endif
  311. } else if (skb->data_len && skb_len <= EFX_TX_CB_SIZE) {
  312. /* Pad short packets or coalesce short fragmented packets. */
  313. if (efx_enqueue_skb_copy(tx_queue, skb))
  314. goto err;
  315. tx_queue->cb_packets++;
  316. data_mapped = true;
  317. }
  318. /* Map for DMA and create descriptors if we haven't done so already. */
  319. if (!data_mapped && (efx_tx_map_data(tx_queue, skb, segments)))
  320. goto err;
  321. efx_tx_maybe_stop_queue(tx_queue);
  322. tx_queue->xmit_pending = true;
  323. /* Pass off to hardware */
  324. if (__netdev_tx_sent_queue(tx_queue->core_txq, skb_len, xmit_more))
  325. efx_tx_send_pending(tx_queue->channel);
  326. if (segments) {
  327. tx_queue->tso_bursts++;
  328. tx_queue->tso_packets += segments;
  329. tx_queue->tx_packets += segments;
  330. } else {
  331. tx_queue->tx_packets++;
  332. }
  333. return NETDEV_TX_OK;
  334. err:
  335. efx_enqueue_unwind(tx_queue, old_insert_count);
  336. dev_kfree_skb_any(skb);
  337. /* If we're not expecting another transmit and we had something to push
  338. * on this queue or a partner queue then we need to push here to get the
  339. * previous packets out.
  340. */
  341. if (!xmit_more)
  342. efx_tx_send_pending(tx_queue->channel);
  343. return NETDEV_TX_OK;
  344. }
  345. /* Transmit a packet from an XDP buffer
  346. *
  347. * Returns number of packets sent on success, error code otherwise.
  348. * Runs in NAPI context, either in our poll (for XDP TX) or a different NIC
  349. * (for XDP redirect).
  350. */
  351. int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs,
  352. bool flush)
  353. {
  354. struct efx_tx_buffer *tx_buffer;
  355. struct efx_tx_queue *tx_queue;
  356. struct xdp_frame *xdpf;
  357. dma_addr_t dma_addr;
  358. unsigned int len;
  359. int space;
  360. int cpu;
  361. int i = 0;
  362. if (unlikely(n && !xdpfs))
  363. return -EINVAL;
  364. if (unlikely(!n))
  365. return 0;
  366. cpu = raw_smp_processor_id();
  367. if (unlikely(cpu >= efx->xdp_tx_queue_count))
  368. return -EINVAL;
  369. tx_queue = efx->xdp_tx_queues[cpu];
  370. if (unlikely(!tx_queue))
  371. return -EINVAL;
  372. if (!tx_queue->initialised)
  373. return -EINVAL;
  374. if (efx->xdp_txq_queues_mode != EFX_XDP_TX_QUEUES_DEDICATED)
  375. HARD_TX_LOCK(efx->net_dev, tx_queue->core_txq, cpu);
  376. /* If we're borrowing net stack queues we have to handle stop-restart
  377. * or we might block the queue and it will be considered as frozen
  378. */
  379. if (efx->xdp_txq_queues_mode == EFX_XDP_TX_QUEUES_BORROWED) {
  380. if (netif_tx_queue_stopped(tx_queue->core_txq))
  381. goto unlock;
  382. efx_tx_maybe_stop_queue(tx_queue);
  383. }
  384. /* Check for available space. We should never need multiple
  385. * descriptors per frame.
  386. */
  387. space = efx->txq_entries +
  388. tx_queue->read_count - tx_queue->insert_count;
  389. for (i = 0; i < n; i++) {
  390. xdpf = xdpfs[i];
  391. if (i >= space)
  392. break;
  393. /* We'll want a descriptor for this tx. */
  394. prefetchw(__efx_tx_queue_get_insert_buffer(tx_queue));
  395. len = xdpf->len;
  396. /* Map for DMA. */
  397. dma_addr = dma_map_single(&efx->pci_dev->dev,
  398. xdpf->data, len,
  399. DMA_TO_DEVICE);
  400. if (dma_mapping_error(&efx->pci_dev->dev, dma_addr))
  401. break;
  402. /* Create descriptor and set up for unmapping DMA. */
  403. tx_buffer = efx_tx_map_chunk(tx_queue, dma_addr, len);
  404. tx_buffer->xdpf = xdpf;
  405. tx_buffer->flags = EFX_TX_BUF_XDP |
  406. EFX_TX_BUF_MAP_SINGLE;
  407. tx_buffer->dma_offset = 0;
  408. tx_buffer->unmap_len = len;
  409. tx_queue->tx_packets++;
  410. }
  411. /* Pass mapped frames to hardware. */
  412. if (flush && i > 0)
  413. efx_nic_push_buffers(tx_queue);
  414. unlock:
  415. if (efx->xdp_txq_queues_mode != EFX_XDP_TX_QUEUES_DEDICATED)
  416. HARD_TX_UNLOCK(efx->net_dev, tx_queue->core_txq);
  417. return i == 0 ? -EIO : i;
  418. }
  419. /* Initiate a packet transmission. We use one channel per CPU
  420. * (sharing when we have more CPUs than channels).
  421. *
  422. * Context: non-blocking.
  423. * Should always return NETDEV_TX_OK and consume the skb.
  424. */
  425. netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
  426. struct net_device *net_dev)
  427. {
  428. struct efx_nic *efx = efx_netdev_priv(net_dev);
  429. struct efx_tx_queue *tx_queue;
  430. unsigned index, type;
  431. EFX_WARN_ON_PARANOID(!netif_device_present(net_dev));
  432. index = skb_get_queue_mapping(skb);
  433. type = efx_tx_csum_type_skb(skb);
  434. /* PTP "event" packet */
  435. if (unlikely(efx_xmit_with_hwtstamp(skb)) &&
  436. ((efx_ptp_use_mac_tx_timestamps(efx) && efx->ptp_data) ||
  437. unlikely(efx_ptp_is_ptp_tx(efx, skb)))) {
  438. /* There may be existing transmits on the channel that are
  439. * waiting for this packet to trigger the doorbell write.
  440. * We need to send the packets at this point.
  441. */
  442. efx_tx_send_pending(efx_get_tx_channel(efx, index));
  443. return efx_ptp_tx(efx, skb);
  444. }
  445. tx_queue = efx_get_tx_queue(efx, index, type);
  446. if (WARN_ON_ONCE(!tx_queue)) {
  447. /* We don't have a TXQ of the right type.
  448. * This should never happen, as we don't advertise offload
  449. * features unless we can support them.
  450. */
  451. dev_kfree_skb_any(skb);
  452. /* If we're not expecting another transmit and we had something to push
  453. * on this queue or a partner queue then we need to push here to get the
  454. * previous packets out.
  455. */
  456. if (!netdev_xmit_more())
  457. efx_tx_send_pending(efx_get_tx_channel(efx, index));
  458. return NETDEV_TX_OK;
  459. }
  460. return __efx_enqueue_skb(tx_queue, skb);
  461. }
  462. void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
  463. {
  464. unsigned int xdp_pkts_compl = 0, xdp_bytes_compl = 0;
  465. unsigned int pkts_compl = 0, bytes_compl = 0;
  466. unsigned int efv_pkts_compl = 0;
  467. unsigned int read_ptr;
  468. bool finished = false;
  469. read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
  470. while (!finished) {
  471. struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
  472. if (!efx_tx_buffer_in_use(buffer)) {
  473. struct efx_nic *efx = tx_queue->efx;
  474. netif_err(efx, hw, efx->net_dev,
  475. "TX queue %d spurious single TX completion\n",
  476. tx_queue->queue);
  477. efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
  478. return;
  479. }
  480. /* Need to check the flag before dequeueing. */
  481. if (buffer->flags & EFX_TX_BUF_SKB)
  482. finished = true;
  483. efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl,
  484. &efv_pkts_compl, &xdp_pkts_compl,
  485. &xdp_bytes_compl);
  486. ++tx_queue->read_count;
  487. read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
  488. }
  489. tx_queue->pkts_compl += pkts_compl;
  490. tx_queue->bytes_compl += bytes_compl;
  491. tx_queue->complete_xdp_packets += xdp_pkts_compl;
  492. tx_queue->complete_xdp_bytes += xdp_bytes_compl;
  493. EFX_WARN_ON_PARANOID(pkts_compl + efv_pkts_compl != 1);
  494. efx_xmit_done_check_empty(tx_queue);
  495. }
  496. void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue)
  497. {
  498. struct efx_nic *efx = tx_queue->efx;
  499. /* Must be inverse of queue lookup in efx_hard_start_xmit() */
  500. tx_queue->core_txq =
  501. netdev_get_tx_queue(efx->net_dev,
  502. tx_queue->channel->channel);
  503. }