linux - Difference between usb_alloc_coherent and kzalloc/kmalloc -
what fundamental difference between using usb_alloc_coherent , kzalloc/kmalloc in context of usb driver. both same, allocate memory area urb buffer. difference of them. there benefit of using usb_alloc_coherent instead of kzalloc/kmalloc?
drivers device (endpoint) centric memory allocation must consult capabilities of usb controller. because controller performs dma memory onto usb bus. usb_alloc_coherent wraps generic dma_alloc_coherent calls controller, not endpoint. using dma-api instead of kmalloc ensures no bounce-buffers required.
this saves device driver writes code ugliness (breaking abstractions) , handling of corner cases. usb_alloc_coherent uses memory poll speed things bit.
Comments
Post a Comment