03/06/2021 09:49, Andrew Rybchenko: > On 6/3/21 10:26 AM, Thomas Monjalon wrote: > > 03/06/2021 09:06, Andrew Rybchenko: > >> On 6/2/21 11:35 PM, Thomas Monjalon wrote: > >>> + * Allocate a chunk of memory on the GPU. > >> > >> Looking a below function it is required to clarify here if > >> the memory is visible or invisible to GPU (or both allowed). > > > > This function allocates on the GPU so it is visible by the GPU. > > I feel I misunderstand your question. > > Below function says rte_gpu_malloc_visible() and its > description highlights that allocated memory is visible to GPU. > My problem that I don't understand what's the difference > between these two functions.
One function allocates in GPU mem, the other allows the GPU to use CPU mem. > >>> + */ > >>> +__rte_experimental > >>> +int rte_gpu_malloc(uint16_t gpu_id, size_t size, void **ptr); > >> > >> May be *malloc() should return a pointer and "negative" > >> values used to report various errnos? > > > > I don't understand what you mean by negative values if it is a pointer. > > We could return a pointer and use rte_errno. > > I was talking about something like (void *)(-ENOMEM), but it is > a bad idea. NULL + rte_errno is much better. > > However, may be I'd kept callback as is set rte_error in lib if > negative value is returned by the callback. This way we'll be > safe against lost rte_errno update in drivers. OK