Lines Matching refs:cb
40 static int hnae_alloc_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) in hnae_alloc_buffer() argument
48 cb->priv = p; in hnae_alloc_buffer()
49 cb->page_offset = 0; in hnae_alloc_buffer()
50 cb->reuse_flag = 0; in hnae_alloc_buffer()
51 cb->buf = page_address(p); in hnae_alloc_buffer()
52 cb->length = hnae_page_size(ring); in hnae_alloc_buffer()
53 cb->type = DESC_TYPE_PAGE; in hnae_alloc_buffer()
58 static void hnae_free_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) in hnae_free_buffer() argument
60 if (cb->type == DESC_TYPE_SKB) in hnae_free_buffer()
61 dev_kfree_skb_any((struct sk_buff *)cb->priv); in hnae_free_buffer()
63 put_page((struct page *)cb->priv); in hnae_free_buffer()
64 memset(cb, 0, sizeof(*cb)); in hnae_free_buffer()
67 static int hnae_map_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) in hnae_map_buffer() argument
69 cb->dma = dma_map_page(ring_to_dev(ring), cb->priv, 0, in hnae_map_buffer()
70 cb->length, ring_to_dma_dir(ring)); in hnae_map_buffer()
72 if (dma_mapping_error(ring_to_dev(ring), cb->dma)) in hnae_map_buffer()
78 static void hnae_unmap_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) in hnae_unmap_buffer() argument
80 if (cb->type == DESC_TYPE_SKB) in hnae_unmap_buffer()
81 dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length, in hnae_unmap_buffer()
84 dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length, in hnae_unmap_buffer()