Lines Matching refs:tx_ring
213 static inline bool ixgbevf_check_tx_hang(struct ixgbevf_ring *tx_ring) in ixgbevf_check_tx_hang() argument
215 u32 tx_done = ixgbevf_get_tx_completed(tx_ring); in ixgbevf_check_tx_hang()
216 u32 tx_done_old = tx_ring->tx_stats.tx_done_old; in ixgbevf_check_tx_hang()
217 u32 tx_pending = ixgbevf_get_tx_pending(tx_ring); in ixgbevf_check_tx_hang()
219 clear_check_for_tx_hang(tx_ring); in ixgbevf_check_tx_hang()
229 &tx_ring->state); in ixgbevf_check_tx_hang()
232 clear_bit(__IXGBEVF_HANG_CHECK_ARMED, &tx_ring->state); in ixgbevf_check_tx_hang()
235 tx_ring->tx_stats.tx_done_old = tx_done; in ixgbevf_check_tx_hang()
267 struct ixgbevf_ring *tx_ring, int napi_budget) in ixgbevf_clean_tx_irq() argument
273 unsigned int budget = tx_ring->count / 2; in ixgbevf_clean_tx_irq()
274 unsigned int i = tx_ring->next_to_clean; in ixgbevf_clean_tx_irq()
279 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_clean_tx_irq()
280 tx_desc = IXGBEVF_TX_DESC(tx_ring, i); in ixgbevf_clean_tx_irq()
281 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
307 if (ring_is_xdp(tx_ring)) in ixgbevf_clean_tx_irq()
313 dma_unmap_single(tx_ring->dev, in ixgbevf_clean_tx_irq()
327 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
328 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_irq()
329 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_clean_tx_irq()
334 dma_unmap_page(tx_ring->dev, in ixgbevf_clean_tx_irq()
347 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
348 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_irq()
349 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_clean_tx_irq()
359 i += tx_ring->count; in ixgbevf_clean_tx_irq()
360 tx_ring->next_to_clean = i; in ixgbevf_clean_tx_irq()
361 u64_stats_update_begin(&tx_ring->syncp); in ixgbevf_clean_tx_irq()
362 tx_ring->stats.bytes += total_bytes; in ixgbevf_clean_tx_irq()
363 tx_ring->stats.packets += total_packets; in ixgbevf_clean_tx_irq()
364 u64_stats_update_end(&tx_ring->syncp); in ixgbevf_clean_tx_irq()
369 if (check_for_tx_hang(tx_ring) && ixgbevf_check_tx_hang(tx_ring)) { in ixgbevf_clean_tx_irq()
373 eop_desc = tx_ring->tx_buffer_info[i].next_to_watch; in ixgbevf_clean_tx_irq()
385 ring_is_xdp(tx_ring) ? " XDP" : "", in ixgbevf_clean_tx_irq()
386 tx_ring->queue_index, in ixgbevf_clean_tx_irq()
387 IXGBE_READ_REG(hw, IXGBE_VFTDH(tx_ring->reg_idx)), in ixgbevf_clean_tx_irq()
388 IXGBE_READ_REG(hw, IXGBE_VFTDT(tx_ring->reg_idx)), in ixgbevf_clean_tx_irq()
389 tx_ring->next_to_use, i, in ixgbevf_clean_tx_irq()
391 tx_ring->tx_buffer_info[i].time_stamp, jiffies); in ixgbevf_clean_tx_irq()
393 if (!ring_is_xdp(tx_ring)) in ixgbevf_clean_tx_irq()
394 netif_stop_subqueue(tx_ring->netdev, in ixgbevf_clean_tx_irq()
395 tx_ring->queue_index); in ixgbevf_clean_tx_irq()
403 if (ring_is_xdp(tx_ring)) in ixgbevf_clean_tx_irq()
407 if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) && in ixgbevf_clean_tx_irq()
408 (ixgbevf_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) { in ixgbevf_clean_tx_irq()
414 if (__netif_subqueue_stopped(tx_ring->netdev, in ixgbevf_clean_tx_irq()
415 tx_ring->queue_index) && in ixgbevf_clean_tx_irq()
417 netif_wake_subqueue(tx_ring->netdev, in ixgbevf_clean_tx_irq()
418 tx_ring->queue_index); in ixgbevf_clean_tx_irq()
419 ++tx_ring->tx_stats.restart_queue; in ixgbevf_clean_tx_irq()
1752 ixgbevf_configure_tx_ring(adapter, adapter->tx_ring[i]); in ixgbevf_configure_tx()
2192 adapter->tx_ring[0]->reg_idx = def_q; in ixgbevf_configure_dcb()
2381 static void ixgbevf_clean_tx_ring(struct ixgbevf_ring *tx_ring) in ixgbevf_clean_tx_ring() argument
2383 u16 i = tx_ring->next_to_clean; in ixgbevf_clean_tx_ring()
2384 struct ixgbevf_tx_buffer *tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_clean_tx_ring()
2386 while (i != tx_ring->next_to_use) { in ixgbevf_clean_tx_ring()
2390 if (ring_is_xdp(tx_ring)) in ixgbevf_clean_tx_ring()
2396 dma_unmap_single(tx_ring->dev, in ixgbevf_clean_tx_ring()
2403 tx_desc = IXGBEVF_TX_DESC(tx_ring, i); in ixgbevf_clean_tx_ring()
2410 if (unlikely(i == tx_ring->count)) { in ixgbevf_clean_tx_ring()
2412 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_ring()
2413 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_clean_tx_ring()
2418 dma_unmap_page(tx_ring->dev, in ixgbevf_clean_tx_ring()
2427 if (unlikely(i == tx_ring->count)) { in ixgbevf_clean_tx_ring()
2429 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_ring()
2434 tx_ring->next_to_use = 0; in ixgbevf_clean_tx_ring()
2435 tx_ring->next_to_clean = 0; in ixgbevf_clean_tx_ring()
2460 ixgbevf_clean_tx_ring(adapter->tx_ring[i]); in ixgbevf_clean_all_tx_rings()
2495 u8 reg_idx = adapter->tx_ring[i]->reg_idx; in ixgbevf_down()
2745 adapter->tx_ring[txr_idx] = ring; in ixgbevf_alloc_q_vector()
2833 adapter->tx_ring[ring->queue_index] = NULL; in ixgbevf_free_q_vector()
3203 set_check_for_tx_hang(adapter->tx_ring[i]); in ixgbevf_check_hang_subtask()
3347 void ixgbevf_free_tx_resources(struct ixgbevf_ring *tx_ring) in ixgbevf_free_tx_resources() argument
3349 ixgbevf_clean_tx_ring(tx_ring); in ixgbevf_free_tx_resources()
3351 vfree(tx_ring->tx_buffer_info); in ixgbevf_free_tx_resources()
3352 tx_ring->tx_buffer_info = NULL; in ixgbevf_free_tx_resources()
3355 if (!tx_ring->desc) in ixgbevf_free_tx_resources()
3358 dma_free_coherent(tx_ring->dev, tx_ring->size, tx_ring->desc, in ixgbevf_free_tx_resources()
3359 tx_ring->dma); in ixgbevf_free_tx_resources()
3361 tx_ring->desc = NULL; in ixgbevf_free_tx_resources()
3375 if (adapter->tx_ring[i]->desc) in ixgbevf_free_all_tx_resources()
3376 ixgbevf_free_tx_resources(adapter->tx_ring[i]); in ixgbevf_free_all_tx_resources()
3388 int ixgbevf_setup_tx_resources(struct ixgbevf_ring *tx_ring) in ixgbevf_setup_tx_resources() argument
3390 struct ixgbevf_adapter *adapter = netdev_priv(tx_ring->netdev); in ixgbevf_setup_tx_resources()
3393 size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count; in ixgbevf_setup_tx_resources()
3394 tx_ring->tx_buffer_info = vmalloc(size); in ixgbevf_setup_tx_resources()
3395 if (!tx_ring->tx_buffer_info) in ixgbevf_setup_tx_resources()
3398 u64_stats_init(&tx_ring->syncp); in ixgbevf_setup_tx_resources()
3401 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc); in ixgbevf_setup_tx_resources()
3402 tx_ring->size = ALIGN(tx_ring->size, 4096); in ixgbevf_setup_tx_resources()
3404 tx_ring->desc = dma_alloc_coherent(tx_ring->dev, tx_ring->size, in ixgbevf_setup_tx_resources()
3405 &tx_ring->dma, GFP_KERNEL); in ixgbevf_setup_tx_resources()
3406 if (!tx_ring->desc) in ixgbevf_setup_tx_resources()
3412 vfree(tx_ring->tx_buffer_info); in ixgbevf_setup_tx_resources()
3413 tx_ring->tx_buffer_info = NULL; in ixgbevf_setup_tx_resources()
3433 err = ixgbevf_setup_tx_resources(adapter->tx_ring[i]); in ixgbevf_setup_all_tx_resources()
3454 ixgbevf_free_tx_resources(adapter->tx_ring[i]); in ixgbevf_setup_all_tx_resources()
3723 static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_ctxtdesc() argument
3728 u16 i = tx_ring->next_to_use; in ixgbevf_tx_ctxtdesc()
3730 context_desc = IXGBEVF_TX_CTXTDESC(tx_ring, i); in ixgbevf_tx_ctxtdesc()
3733 tx_ring->next_to_use = (i < tx_ring->count) ? i : 0; in ixgbevf_tx_ctxtdesc()
3744 static int ixgbevf_tso(struct ixgbevf_ring *tx_ring, in ixgbevf_tso() argument
3835 ixgbevf_tx_ctxtdesc(tx_ring, vlan_macip_lens, fceof_saidx, type_tucmd, in ixgbevf_tso()
3850 static void ixgbevf_tx_csum(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_csum() argument
3898 ixgbevf_tx_ctxtdesc(tx_ring, vlan_macip_lens, in ixgbevf_tx_csum()
3949 static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_map() argument
3961 u16 i = tx_ring->next_to_use; in ixgbevf_tx_map()
3963 tx_desc = IXGBEVF_TX_DESC(tx_ring, i); in ixgbevf_tx_map()
3970 dma = dma_map_single(tx_ring->dev, skb->data, size, DMA_TO_DEVICE); in ixgbevf_tx_map()
3975 if (dma_mapping_error(tx_ring->dev, dma)) in ixgbevf_tx_map()
3990 if (i == tx_ring->count) { in ixgbevf_tx_map()
3991 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_tx_map()
4009 if (i == tx_ring->count) { in ixgbevf_tx_map()
4010 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_tx_map()
4018 dma = skb_frag_dma_map(tx_ring->dev, frag, 0, size, in ixgbevf_tx_map()
4021 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_tx_map()
4046 if (i == tx_ring->count) in ixgbevf_tx_map()
4049 tx_ring->next_to_use = i; in ixgbevf_tx_map()
4052 ixgbevf_write_tail(tx_ring, i); in ixgbevf_tx_map()
4056 dev_err(tx_ring->dev, "TX DMA map failed\n"); in ixgbevf_tx_map()
4057 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_tx_map()
4062 dma_unmap_page(tx_ring->dev, in ixgbevf_tx_map()
4069 i += tx_ring->count; in ixgbevf_tx_map()
4070 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_tx_map()
4074 dma_unmap_single(tx_ring->dev, in ixgbevf_tx_map()
4083 tx_ring->next_to_use = i; in ixgbevf_tx_map()
4086 static int __ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) in __ixgbevf_maybe_stop_tx() argument
4088 netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); in __ixgbevf_maybe_stop_tx()
4098 if (likely(ixgbevf_desc_unused(tx_ring) < size)) in __ixgbevf_maybe_stop_tx()
4102 netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index); in __ixgbevf_maybe_stop_tx()
4103 ++tx_ring->tx_stats.restart_queue; in __ixgbevf_maybe_stop_tx()
4108 static int ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) in ixgbevf_maybe_stop_tx() argument
4110 if (likely(ixgbevf_desc_unused(tx_ring) >= size)) in ixgbevf_maybe_stop_tx()
4112 return __ixgbevf_maybe_stop_tx(tx_ring, size); in ixgbevf_maybe_stop_tx()
4116 struct ixgbevf_ring *tx_ring) in ixgbevf_xmit_frame_ring() argument
4149 if (ixgbevf_maybe_stop_tx(tx_ring, count + 3)) { in ixgbevf_xmit_frame_ring()
4150 tx_ring->tx_stats.tx_busy++; in ixgbevf_xmit_frame_ring()
4155 first = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; in ixgbevf_xmit_frame_ring()
4171 if (xfrm_offload(skb) && !ixgbevf_ipsec_tx(tx_ring, first, &ipsec_tx)) in ixgbevf_xmit_frame_ring()
4174 tso = ixgbevf_tso(tx_ring, first, &hdr_len, &ipsec_tx); in ixgbevf_xmit_frame_ring()
4178 ixgbevf_tx_csum(tx_ring, first, &ipsec_tx); in ixgbevf_xmit_frame_ring()
4180 ixgbevf_tx_map(tx_ring, first, hdr_len); in ixgbevf_xmit_frame_ring()
4182 ixgbevf_maybe_stop_tx(tx_ring, DESC_NEEDED); in ixgbevf_xmit_frame_ring()
4196 struct ixgbevf_ring *tx_ring; in ixgbevf_xmit_frame() local
4212 tx_ring = adapter->tx_ring[skb->queue_mapping]; in ixgbevf_xmit_frame()
4213 return ixgbevf_xmit_frame_ring(skb, tx_ring); in ixgbevf_xmit_frame()
4405 ring = adapter->tx_ring[i]; in ixgbevf_get_stats()