For consistency with the shared header file (and to avoid confusion
with mbufs normally called *m in one place), rename the function arguments to "mem". This is a non-functional change. Reviewed by: gnn, eric.joyner intel.com MFC after: 3 days
This commit is contained in:
parent
581980cff8
commit
ea022094f2
@ -49,21 +49,21 @@ i40e_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nseg, int error)
|
||||
}
|
||||
|
||||
i40e_status
|
||||
i40e_allocate_virt(struct i40e_hw *hw, struct i40e_virt_mem *m, u32 size)
|
||||
i40e_allocate_virt(struct i40e_hw *hw, struct i40e_virt_mem *mem, u32 size)
|
||||
{
|
||||
m->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
return(m->va == NULL);
|
||||
mem->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
return(mem->va == NULL);
|
||||
}
|
||||
|
||||
i40e_status
|
||||
i40e_free_virt(struct i40e_hw *hw, struct i40e_virt_mem *m)
|
||||
i40e_free_virt(struct i40e_hw *hw, struct i40e_virt_mem *mem)
|
||||
{
|
||||
free(m->va, M_DEVBUF);
|
||||
free(mem->va, M_DEVBUF);
|
||||
return(0);
|
||||
}
|
||||
|
||||
i40e_status
|
||||
i40e_allocate_dma(struct i40e_hw *hw, struct i40e_dma_mem *dma,
|
||||
i40e_allocate_dma(struct i40e_hw *hw, struct i40e_dma_mem *mem,
|
||||
bus_size_t size, u32 alignment)
|
||||
{
|
||||
device_t dev = ((struct i40e_osdep *)hw->back)->dev;
|
||||
@ -81,25 +81,25 @@ i40e_allocate_dma(struct i40e_hw *hw, struct i40e_dma_mem *dma,
|
||||
BUS_DMA_ALLOCNOW, /* flags */
|
||||
NULL, /* lockfunc */
|
||||
NULL, /* lockfuncarg */
|
||||
&dma->tag);
|
||||
&mem->tag);
|
||||
if (err != 0) {
|
||||
device_printf(dev,
|
||||
"i40e_allocate_dma: bus_dma_tag_create failed, "
|
||||
"error %u\n", err);
|
||||
goto fail_0;
|
||||
}
|
||||
err = bus_dmamem_alloc(dma->tag, (void **)&dma->va,
|
||||
BUS_DMA_NOWAIT | BUS_DMA_ZERO, &dma->map);
|
||||
err = bus_dmamem_alloc(mem->tag, (void **)&mem->va,
|
||||
BUS_DMA_NOWAIT | BUS_DMA_ZERO, &mem->map);
|
||||
if (err != 0) {
|
||||
device_printf(dev,
|
||||
"i40e_allocate_dma: bus_dmamem_alloc failed, "
|
||||
"error %u\n", err);
|
||||
goto fail_1;
|
||||
}
|
||||
err = bus_dmamap_load(dma->tag, dma->map, dma->va,
|
||||
err = bus_dmamap_load(mem->tag, mem->map, mem->va,
|
||||
size,
|
||||
i40e_dmamap_cb,
|
||||
&dma->pa,
|
||||
&mem->pa,
|
||||
BUS_DMA_NOWAIT);
|
||||
if (err != 0) {
|
||||
device_printf(dev,
|
||||
@ -107,28 +107,28 @@ i40e_allocate_dma(struct i40e_hw *hw, struct i40e_dma_mem *dma,
|
||||
"error %u\n", err);
|
||||
goto fail_2;
|
||||
}
|
||||
dma->size = size;
|
||||
bus_dmamap_sync(dma->tag, dma->map,
|
||||
mem->size = size;
|
||||
bus_dmamap_sync(mem->tag, mem->map,
|
||||
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
|
||||
return (0);
|
||||
fail_2:
|
||||
bus_dmamem_free(dma->tag, dma->va, dma->map);
|
||||
bus_dmamem_free(mem->tag, mem->va, mem->map);
|
||||
fail_1:
|
||||
bus_dma_tag_destroy(dma->tag);
|
||||
bus_dma_tag_destroy(mem->tag);
|
||||
fail_0:
|
||||
dma->map = NULL;
|
||||
dma->tag = NULL;
|
||||
mem->map = NULL;
|
||||
mem->tag = NULL;
|
||||
return (err);
|
||||
}
|
||||
|
||||
i40e_status
|
||||
i40e_free_dma(struct i40e_hw *hw, struct i40e_dma_mem *dma)
|
||||
i40e_free_dma(struct i40e_hw *hw, struct i40e_dma_mem *mem)
|
||||
{
|
||||
bus_dmamap_sync(dma->tag, dma->map,
|
||||
bus_dmamap_sync(mem->tag, mem->map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(dma->tag, dma->map);
|
||||
bus_dmamem_free(dma->tag, dma->va, dma->map);
|
||||
bus_dma_tag_destroy(dma->tag);
|
||||
bus_dmamap_unload(mem->tag, mem->map);
|
||||
bus_dmamem_free(mem->tag, mem->va, mem->map);
|
||||
bus_dma_tag_destroy(mem->tag);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user