Lines Matching refs:desc_cb
1606 struct hns3_desc_cb *desc_cb, in hns3_handle_csum_partial() argument
1640 ¶m->type_cs_vlan_tso, &desc_cb->send_bytes); in hns3_handle_csum_partial()
1650 struct hns3_desc_cb *desc_cb) in hns3_fill_skb_desc() argument
1660 desc_cb->send_bytes = skb->len; in hns3_fill_skb_desc()
1663 ret = hns3_handle_csum_partial(ring, skb, desc_cb, ¶m); in hns3_fill_skb_desc()
1726 struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_map_and_fill_desc() local
1759 desc_cb->priv = priv; in hns3_map_and_fill_desc()
1760 desc_cb->length = size; in hns3_map_and_fill_desc()
1761 desc_cb->dma = dma; in hns3_map_and_fill_desc()
1762 desc_cb->type = type; in hns3_map_and_fill_desc()
1977 struct hns3_desc_cb *desc_cb; in hns3_clear_desc() local
1988 desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_clear_desc()
1990 if (!desc_cb->dma) in hns3_clear_desc()
1994 if (desc_cb->type & (DESC_TYPE_SKB | DESC_TYPE_FRAGLIST_SKB)) in hns3_clear_desc()
1995 dma_unmap_single(dev, desc_cb->dma, desc_cb->length, in hns3_clear_desc()
1997 else if (desc_cb->type & in hns3_clear_desc()
1999 hns3_tx_spare_rollback(ring, desc_cb->length); in hns3_clear_desc()
2000 else if (desc_cb->length) in hns3_clear_desc()
2001 dma_unmap_page(dev, desc_cb->dma, desc_cb->length, in hns3_clear_desc()
2004 desc_cb->length = 0; in hns3_clear_desc()
2005 desc_cb->dma = 0; in hns3_clear_desc()
2006 desc_cb->type = DESC_TYPE_UNKNOWN; in hns3_clear_desc()
2147 struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_handle_tx_bounce() local
2173 desc_cb->priv = skb; in hns3_handle_tx_bounce()
2174 desc_cb->length = cb_len; in hns3_handle_tx_bounce()
2175 desc_cb->dma = dma; in hns3_handle_tx_bounce()
2176 desc_cb->type = type; in hns3_handle_tx_bounce()
2200 struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_handle_tx_sgl() local
2236 desc_cb->priv = skb; in hns3_handle_tx_sgl()
2237 desc_cb->length = cb_len; in hns3_handle_tx_sgl()
2238 desc_cb->dma = dma; in hns3_handle_tx_sgl()
2239 desc_cb->type = DESC_TYPE_SGL_SKB; in hns3_handle_tx_sgl()
2271 struct hns3_desc_cb *desc_cb, in hns3_handle_skb_desc() argument
2277 desc_cb); in hns3_handle_skb_desc()
2298 struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_nic_net_xmit() local
2326 ret = hns3_handle_skb_desc(ring, skb, desc_cb, ring->next_to_use); in hns3_nic_net_xmit()
2344 doorbell = __netdev_tx_sent_queue(dev_queue, desc_cb->send_bytes, in hns3_nic_net_xmit()
3443 hns3_unmap_buffer(ring, &ring->desc_cb[i]); in hns3_buffer_detach()
3445 ring->desc_cb[i].refill = 0; in hns3_buffer_detach()
3451 struct hns3_desc_cb *cb = &ring->desc_cb[i]; in hns3_free_buffer_detach()
3453 if (!ring->desc_cb[i].dma) in hns3_free_buffer_detach()
3517 int ret = hns3_alloc_and_map_buffer(ring, &ring->desc_cb[i]); in hns3_alloc_and_attach_buffer()
3522 ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma + in hns3_alloc_and_attach_buffer()
3523 ring->desc_cb[i].page_offset); in hns3_alloc_and_attach_buffer()
3524 ring->desc_cb[i].refill = 1; in hns3_alloc_and_attach_buffer()
3555 hns3_unmap_buffer(ring, &ring->desc_cb[i]); in hns3_replace_buffer()
3556 ring->desc_cb[i] = *res_cb; in hns3_replace_buffer()
3557 ring->desc_cb[i].refill = 1; in hns3_replace_buffer()
3558 ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma + in hns3_replace_buffer()
3559 ring->desc_cb[i].page_offset); in hns3_replace_buffer()
3565 ring->desc_cb[i].reuse_flag = 0; in hns3_reuse_buffer()
3566 ring->desc_cb[i].refill = 1; in hns3_reuse_buffer()
3567 ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma + in hns3_reuse_buffer()
3568 ring->desc_cb[i].page_offset); in hns3_reuse_buffer()
3572 ring->desc_cb[i].dma + ring->desc_cb[i].page_offset, in hns3_reuse_buffer()
3585 struct hns3_desc_cb *desc_cb; in hns3_nic_reclaim_desc() local
3596 desc_cb = &ring->desc_cb[ntc]; in hns3_nic_reclaim_desc()
3598 if (desc_cb->type & (DESC_TYPE_SKB | DESC_TYPE_BOUNCE_ALL | in hns3_nic_reclaim_desc()
3602 (*bytes) += desc_cb->send_bytes; in hns3_nic_reclaim_desc()
3612 prefetch(&ring->desc_cb[ntc]); in hns3_nic_reclaim_desc()
3672 if (unlikely(ntc == ntu && !ring->desc_cb[ntc].refill)) in hns3_desc_unused()
3682 struct hns3_desc_cb *desc_cb; in hns3_nic_alloc_rx_buffers() local
3687 desc_cb = &ring->desc_cb[ring->next_to_use]; in hns3_nic_alloc_rx_buffers()
3688 if (desc_cb->reuse_flag) { in hns3_nic_alloc_rx_buffers()
3725 struct hns3_desc_cb *desc_cb) in hns3_handle_rx_copybreak() argument
3728 u32 frag_offset = desc_cb->page_offset + pull_len; in hns3_handle_rx_copybreak()
3741 desc_cb->reuse_flag = 1; in hns3_handle_rx_copybreak()
3742 memcpy(frag, desc_cb->buf + frag_offset, frag_size); in hns3_handle_rx_copybreak()
3752 struct hns3_desc_cb *desc_cb) in hns3_nic_reuse_page() argument
3755 u32 frag_offset = desc_cb->page_offset + pull_len; in hns3_nic_reuse_page()
3763 skb_add_rx_frag(skb, i, desc_cb->priv, frag_offset, in hns3_nic_reuse_page()
3769 if (unlikely(!dev_page_is_reusable(desc_cb->priv))) in hns3_nic_reuse_page()
3772 reused = hns3_can_reuse_page(desc_cb); in hns3_nic_reuse_page()
3785 if ((!desc_cb->page_offset && reused) || in hns3_nic_reuse_page()
3786 ((desc_cb->page_offset + truesize + truesize) <= in hns3_nic_reuse_page()
3787 hns3_page_size(ring) && desc_cb->page_offset)) { in hns3_nic_reuse_page()
3788 desc_cb->page_offset += truesize; in hns3_nic_reuse_page()
3789 desc_cb->reuse_flag = 1; in hns3_nic_reuse_page()
3790 } else if (desc_cb->page_offset && reused) { in hns3_nic_reuse_page()
3791 desc_cb->page_offset = 0; in hns3_nic_reuse_page()
3792 desc_cb->reuse_flag = 1; in hns3_nic_reuse_page()
3794 ret = hns3_handle_rx_copybreak(skb, i, ring, pull_len, desc_cb); in hns3_nic_reuse_page()
3800 desc_cb->pagecnt_bias--; in hns3_nic_reuse_page()
3802 if (unlikely(!desc_cb->pagecnt_bias)) { in hns3_nic_reuse_page()
3803 page_ref_add(desc_cb->priv, USHRT_MAX); in hns3_nic_reuse_page()
3804 desc_cb->pagecnt_bias = USHRT_MAX; in hns3_nic_reuse_page()
3807 skb_add_rx_frag(skb, i, desc_cb->priv, frag_offset, in hns3_nic_reuse_page()
3810 if (unlikely(!desc_cb->reuse_flag)) in hns3_nic_reuse_page()
3811 __page_frag_cache_drain(desc_cb->priv, desc_cb->pagecnt_bias); in hns3_nic_reuse_page()
4024 ring->desc_cb[ring->next_to_clean].refill = 0; in hns3_rx_ring_move_fw()
4034 struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_clean]; in hns3_alloc_skb() local
4057 if (dev_page_is_reusable(desc_cb->priv)) in hns3_alloc_skb()
4058 desc_cb->reuse_flag = 1; in hns3_alloc_skb()
4059 else if (desc_cb->type & DESC_TYPE_PP_FRAG) in hns3_alloc_skb()
4060 page_pool_put_full_page(ring->page_pool, desc_cb->priv, in hns3_alloc_skb()
4063 __page_frag_cache_drain(desc_cb->priv, in hns3_alloc_skb()
4064 desc_cb->pagecnt_bias); in hns3_alloc_skb()
4078 desc_cb); in hns3_alloc_skb()
4089 struct hns3_desc_cb *desc_cb; in hns3_add_frag() local
4095 desc_cb = &ring->desc_cb[ring->next_to_clean]; in hns3_add_frag()
4132 desc_cb->dma + desc_cb->page_offset, in hns3_add_frag()
4136 hns3_nic_reuse_page(skb, ring->frag_num++, ring, 0, desc_cb); in hns3_add_frag()
4327 struct hns3_desc_cb *desc_cb; in hns3_handle_rx_bd() local
4334 desc_cb = &ring->desc_cb[ring->next_to_clean]; in hns3_handle_rx_bd()
4347 ring->va = desc_cb->buf + desc_cb->page_offset; in hns3_handle_rx_bd()
4350 desc_cb->dma + desc_cb->page_offset, in hns3_handle_rx_bd()
4895 ring->desc_cb = NULL; in hns3_ring_get_cfg()
4968 ring->desc_cb = devm_kcalloc(ring_to_dev(ring), ring->desc_num, in hns3_alloc_ring_memory()
4969 sizeof(ring->desc_cb[0]), GFP_KERNEL); in hns3_alloc_ring_memory()
4970 if (!ring->desc_cb) { in hns3_alloc_ring_memory()
4995 devm_kfree(ring_to_dev(ring), ring->desc_cb); in hns3_alloc_ring_memory()
4996 ring->desc_cb = NULL; in hns3_alloc_ring_memory()
5004 devm_kfree(ring_to_dev(ring), ring->desc_cb); in hns3_fini_ring()
5005 ring->desc_cb = NULL; in hns3_fini_ring()
5503 if (!ring->desc_cb[ring->next_to_use].reuse_flag) { in hns3_clear_rx_ring()
5537 if (!ring->desc_cb[ring->next_to_use].reuse_flag) { in hns3_force_clear_rx_ring()
5539 &ring->desc_cb[ring->next_to_use]); in hns3_force_clear_rx_ring()
5540 ring->desc_cb[ring->next_to_use].dma = 0; in hns3_force_clear_rx_ring()