Lines Matching refs:tx_ring
208 static void ixgbevf_unmap_and_free_tx_resource(struct ixgbevf_ring *tx_ring, in ixgbevf_unmap_and_free_tx_resource() argument
214 dma_unmap_single(tx_ring->dev, in ixgbevf_unmap_and_free_tx_resource()
219 dma_unmap_page(tx_ring->dev, in ixgbevf_unmap_and_free_tx_resource()
250 static inline bool ixgbevf_check_tx_hang(struct ixgbevf_ring *tx_ring) in ixgbevf_check_tx_hang() argument
252 u32 tx_done = ixgbevf_get_tx_completed(tx_ring); in ixgbevf_check_tx_hang()
253 u32 tx_done_old = tx_ring->tx_stats.tx_done_old; in ixgbevf_check_tx_hang()
254 u32 tx_pending = ixgbevf_get_tx_pending(tx_ring); in ixgbevf_check_tx_hang()
256 clear_check_for_tx_hang(tx_ring); in ixgbevf_check_tx_hang()
266 &tx_ring->state); in ixgbevf_check_tx_hang()
269 clear_bit(__IXGBEVF_HANG_CHECK_ARMED, &tx_ring->state); in ixgbevf_check_tx_hang()
272 tx_ring->tx_stats.tx_done_old = tx_done; in ixgbevf_check_tx_hang()
304 struct ixgbevf_ring *tx_ring, int napi_budget) in ixgbevf_clean_tx_irq() argument
310 unsigned int budget = tx_ring->count / 2; in ixgbevf_clean_tx_irq()
311 unsigned int i = tx_ring->next_to_clean; in ixgbevf_clean_tx_irq()
316 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_clean_tx_irq()
317 tx_desc = IXGBEVF_TX_DESC(tx_ring, i); in ixgbevf_clean_tx_irq()
318 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
345 dma_unmap_single(tx_ring->dev, in ixgbevf_clean_tx_irq()
360 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
361 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_irq()
362 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_clean_tx_irq()
367 dma_unmap_page(tx_ring->dev, in ixgbevf_clean_tx_irq()
380 i -= tx_ring->count; in ixgbevf_clean_tx_irq()
381 tx_buffer = tx_ring->tx_buffer_info; in ixgbevf_clean_tx_irq()
382 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_clean_tx_irq()
392 i += tx_ring->count; in ixgbevf_clean_tx_irq()
393 tx_ring->next_to_clean = i; in ixgbevf_clean_tx_irq()
394 u64_stats_update_begin(&tx_ring->syncp); in ixgbevf_clean_tx_irq()
395 tx_ring->stats.bytes += total_bytes; in ixgbevf_clean_tx_irq()
396 tx_ring->stats.packets += total_packets; in ixgbevf_clean_tx_irq()
397 u64_stats_update_end(&tx_ring->syncp); in ixgbevf_clean_tx_irq()
401 if (check_for_tx_hang(tx_ring) && ixgbevf_check_tx_hang(tx_ring)) { in ixgbevf_clean_tx_irq()
405 eop_desc = tx_ring->tx_buffer_info[i].next_to_watch; in ixgbevf_clean_tx_irq()
417 tx_ring->queue_index, in ixgbevf_clean_tx_irq()
418 IXGBE_READ_REG(hw, IXGBE_VFTDH(tx_ring->reg_idx)), in ixgbevf_clean_tx_irq()
419 IXGBE_READ_REG(hw, IXGBE_VFTDT(tx_ring->reg_idx)), in ixgbevf_clean_tx_irq()
420 tx_ring->next_to_use, i, in ixgbevf_clean_tx_irq()
422 tx_ring->tx_buffer_info[i].time_stamp, jiffies); in ixgbevf_clean_tx_irq()
424 netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); in ixgbevf_clean_tx_irq()
433 if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) && in ixgbevf_clean_tx_irq()
434 (ixgbevf_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) { in ixgbevf_clean_tx_irq()
440 if (__netif_subqueue_stopped(tx_ring->netdev, in ixgbevf_clean_tx_irq()
441 tx_ring->queue_index) && in ixgbevf_clean_tx_irq()
443 netif_wake_subqueue(tx_ring->netdev, in ixgbevf_clean_tx_irq()
444 tx_ring->queue_index); in ixgbevf_clean_tx_irq()
445 ++tx_ring->tx_stats.restart_queue; in ixgbevf_clean_tx_irq()
1330 a->tx_ring[t_idx]->next = q_vector->tx.ring; in map_vector_to_txq()
1331 q_vector->tx.ring = a->tx_ring[t_idx]; in map_vector_to_txq()
1630 ixgbevf_configure_tx_ring(adapter, adapter->tx_ring[i]); in ixgbevf_configure_tx()
1999 adapter->tx_ring[0]->reg_idx = def_q; in ixgbevf_configure_dcb()
2175 static void ixgbevf_clean_tx_ring(struct ixgbevf_ring *tx_ring) in ixgbevf_clean_tx_ring() argument
2181 if (!tx_ring->tx_buffer_info) in ixgbevf_clean_tx_ring()
2185 for (i = 0; i < tx_ring->count; i++) { in ixgbevf_clean_tx_ring()
2186 tx_buffer_info = &tx_ring->tx_buffer_info[i]; in ixgbevf_clean_tx_ring()
2187 ixgbevf_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); in ixgbevf_clean_tx_ring()
2190 size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count; in ixgbevf_clean_tx_ring()
2191 memset(tx_ring->tx_buffer_info, 0, size); in ixgbevf_clean_tx_ring()
2193 memset(tx_ring->desc, 0, tx_ring->size); in ixgbevf_clean_tx_ring()
2217 ixgbevf_clean_tx_ring(adapter->tx_ring[i]); in ixgbevf_clean_all_tx_rings()
2250 u8 reg_idx = adapter->tx_ring[i]->reg_idx; in ixgbevf_down()
2405 adapter->tx_ring[tx] = ring; in ixgbevf_alloc_queues()
2427 kfree(adapter->tx_ring[--tx]); in ixgbevf_alloc_queues()
2428 adapter->tx_ring[tx] = NULL; in ixgbevf_alloc_queues()
2618 kfree(adapter->tx_ring[i]); in ixgbevf_clear_interrupt_scheme()
2619 adapter->tx_ring[i] = NULL; in ixgbevf_clear_interrupt_scheme()
2816 set_check_for_tx_hang(adapter->tx_ring[i]); in ixgbevf_check_hang_subtask()
2958 void ixgbevf_free_tx_resources(struct ixgbevf_ring *tx_ring) in ixgbevf_free_tx_resources() argument
2960 ixgbevf_clean_tx_ring(tx_ring); in ixgbevf_free_tx_resources()
2962 vfree(tx_ring->tx_buffer_info); in ixgbevf_free_tx_resources()
2963 tx_ring->tx_buffer_info = NULL; in ixgbevf_free_tx_resources()
2966 if (!tx_ring->desc) in ixgbevf_free_tx_resources()
2969 dma_free_coherent(tx_ring->dev, tx_ring->size, tx_ring->desc, in ixgbevf_free_tx_resources()
2970 tx_ring->dma); in ixgbevf_free_tx_resources()
2972 tx_ring->desc = NULL; in ixgbevf_free_tx_resources()
2986 if (adapter->tx_ring[i]->desc) in ixgbevf_free_all_tx_resources()
2987 ixgbevf_free_tx_resources(adapter->tx_ring[i]); in ixgbevf_free_all_tx_resources()
2996 int ixgbevf_setup_tx_resources(struct ixgbevf_ring *tx_ring) in ixgbevf_setup_tx_resources() argument
2998 struct ixgbevf_adapter *adapter = netdev_priv(tx_ring->netdev); in ixgbevf_setup_tx_resources()
3001 size = sizeof(struct ixgbevf_tx_buffer) * tx_ring->count; in ixgbevf_setup_tx_resources()
3002 tx_ring->tx_buffer_info = vzalloc(size); in ixgbevf_setup_tx_resources()
3003 if (!tx_ring->tx_buffer_info) in ixgbevf_setup_tx_resources()
3007 tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc); in ixgbevf_setup_tx_resources()
3008 tx_ring->size = ALIGN(tx_ring->size, 4096); in ixgbevf_setup_tx_resources()
3010 tx_ring->desc = dma_alloc_coherent(tx_ring->dev, tx_ring->size, in ixgbevf_setup_tx_resources()
3011 &tx_ring->dma, GFP_KERNEL); in ixgbevf_setup_tx_resources()
3012 if (!tx_ring->desc) in ixgbevf_setup_tx_resources()
3018 vfree(tx_ring->tx_buffer_info); in ixgbevf_setup_tx_resources()
3019 tx_ring->tx_buffer_info = NULL; in ixgbevf_setup_tx_resources()
3039 err = ixgbevf_setup_tx_resources(adapter->tx_ring[i]); in ixgbevf_setup_all_tx_resources()
3275 static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_ctxtdesc() argument
3280 u16 i = tx_ring->next_to_use; in ixgbevf_tx_ctxtdesc()
3282 context_desc = IXGBEVF_TX_CTXTDESC(tx_ring, i); in ixgbevf_tx_ctxtdesc()
3285 tx_ring->next_to_use = (i < tx_ring->count) ? i : 0; in ixgbevf_tx_ctxtdesc()
3296 static int ixgbevf_tso(struct ixgbevf_ring *tx_ring, in ixgbevf_tso() argument
3377 ixgbevf_tx_ctxtdesc(tx_ring, vlan_macip_lens, in ixgbevf_tso()
3392 static void ixgbevf_tx_csum(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_csum() argument
3431 ixgbevf_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, 0); in ixgbevf_tx_csum()
3477 static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring, in ixgbevf_tx_map() argument
3491 u16 i = tx_ring->next_to_use; in ixgbevf_tx_map()
3493 tx_desc = IXGBEVF_TX_DESC(tx_ring, i); in ixgbevf_tx_map()
3498 dma = dma_map_single(tx_ring->dev, skb->data, size, DMA_TO_DEVICE); in ixgbevf_tx_map()
3499 if (dma_mapping_error(tx_ring->dev, dma)) in ixgbevf_tx_map()
3515 if (i == tx_ring->count) { in ixgbevf_tx_map()
3516 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_tx_map()
3534 if (i == tx_ring->count) { in ixgbevf_tx_map()
3535 tx_desc = IXGBEVF_TX_DESC(tx_ring, 0); in ixgbevf_tx_map()
3542 dma = skb_frag_dma_map(tx_ring->dev, frag, 0, size, in ixgbevf_tx_map()
3544 if (dma_mapping_error(tx_ring->dev, dma)) in ixgbevf_tx_map()
3547 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_tx_map()
3577 if (i == tx_ring->count) in ixgbevf_tx_map()
3580 tx_ring->next_to_use = i; in ixgbevf_tx_map()
3583 ixgbevf_write_tail(tx_ring, i); in ixgbevf_tx_map()
3587 dev_err(tx_ring->dev, "TX DMA map failed\n"); in ixgbevf_tx_map()
3591 tx_buffer = &tx_ring->tx_buffer_info[i]; in ixgbevf_tx_map()
3592 ixgbevf_unmap_and_free_tx_resource(tx_ring, tx_buffer); in ixgbevf_tx_map()
3596 i = tx_ring->count; in ixgbevf_tx_map()
3600 tx_ring->next_to_use = i; in ixgbevf_tx_map()
3603 static int __ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) in __ixgbevf_maybe_stop_tx() argument
3605 netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); in __ixgbevf_maybe_stop_tx()
3615 if (likely(ixgbevf_desc_unused(tx_ring) < size)) in __ixgbevf_maybe_stop_tx()
3619 netif_start_subqueue(tx_ring->netdev, tx_ring->queue_index); in __ixgbevf_maybe_stop_tx()
3620 ++tx_ring->tx_stats.restart_queue; in __ixgbevf_maybe_stop_tx()
3625 static int ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) in ixgbevf_maybe_stop_tx() argument
3627 if (likely(ixgbevf_desc_unused(tx_ring) >= size)) in ixgbevf_maybe_stop_tx()
3629 return __ixgbevf_maybe_stop_tx(tx_ring, size); in ixgbevf_maybe_stop_tx()
3636 struct ixgbevf_ring *tx_ring; in ixgbevf_xmit_frame() local
3651 tx_ring = adapter->tx_ring[skb->queue_mapping]; in ixgbevf_xmit_frame()
3665 if (ixgbevf_maybe_stop_tx(tx_ring, count + 3)) { in ixgbevf_xmit_frame()
3666 tx_ring->tx_stats.tx_busy++; in ixgbevf_xmit_frame()
3671 first = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; in ixgbevf_xmit_frame()
3686 tso = ixgbevf_tso(tx_ring, first, &hdr_len); in ixgbevf_xmit_frame()
3690 ixgbevf_tx_csum(tx_ring, first); in ixgbevf_xmit_frame()
3692 ixgbevf_tx_map(tx_ring, first, hdr_len); in ixgbevf_xmit_frame()
3694 ixgbevf_maybe_stop_tx(tx_ring, DESC_NEEDED); in ixgbevf_xmit_frame()
3908 ring = adapter->tx_ring[i]; in ixgbevf_get_stats()