52 unsigned int align_log2;
59 padding = (
sizeof ( *iobuf ) + __alignof__ ( *iobuf ) - 1 );
64 if (
align < padding )
71 if ( align_log2 >= ( 8 *
sizeof (
align ) ) )
73 align = ( 1UL << align_log2 );
77 threshold = (
align - padding );
83 if (
len <= threshold ) {
88 len += ( ( -
len -
offset ) & ( __alignof__ ( *iobuf ) - 1 ) );
105 iobuf =
malloc (
sizeof ( *iobuf ) );
161 if ( iobuf->
end == iobuf ) {
264 if ( ! concatenated )
static __always_inline void struct dma_mapping size_t size_t align
#define iob_pull(iobuf, len)
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
struct dma_mapping map
DMA mapping.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
A doubly-linked list entry (or list head)
Dynamic memory allocation.
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
#define list_del(list)
Delete an entry from a list.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline int dma_mapped(struct dma_mapping *map)
Check if DMA unmapping is required.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static __always_inline void iob_unmap(struct io_buffer *iobuf)
Unmap I/O buffer for DMA.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
struct io_buffer * iob_concatenate(struct list_head *list)
Concatenate I/O buffers into a single buffer.
static void(* free)(struct refcnt *refcnt))
struct io_buffer * alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
void * end
End of the buffer.
void * malloc(size_t size)
Allocate memory.
#define INIT_LIST_HEAD(list)
Initialise a list head.
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
#define list_is_singular(list)
Test whether a list has just one entry.
struct list_head list
List of which this buffer is a member.
static __always_inline int iob_map_rx(struct io_buffer *iobuf, struct dma_device *dma)
Map empty I/O buffer for receive DMA.
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
#define ENOBUFS
No buffer space available.
void * head
Start of the buffer.
struct io_buffer * iob_split(struct io_buffer *iobuf, size_t len)
Split I/O buffer.
#define IOB_ZLEN
Minimum I/O buffer length.
void * data
Start of data.
uint8_t data[48]
Additional event data.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
uint16_t offset
Offset to command line.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static __always_inline physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
#define fls(x)
Find last (i.e.
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
#define NULL
NULL pointer (VOID *)
static void *__malloc malloc_phys_offset(size_t size, size_t phys_align, size_t offset)
Allocate memory with specified physical alignment and offset.
void * memset(void *dest, int character, size_t len) __nonnull