Struct swbus

Struct Documentation

struct swbus

Manage publisher-subscriber needs in an embedded environment.

Memory efficient. Basically a fully connected network (in the parallel computing sense).

Public Members

size_t n_pools

buffer pools (static during lifetime).

size_t n_rxqs

Number of active receive queues (dynamic during lifetime).

size_t max_rxqs

Max number of receive queues allowed.

size_t max_subs

Max number of subscribers (RXQ-pid pairs) allowed.

struct mutex mutex

Mutex to protect access to bus metadata.

uint32_t flags

Configuration flags.

Valid flags are:

All other flags are ignored.

struct mpool *pools

Array of buffer pool entries. Published data stored here. This is always allocated by SWB during initialization.

struct pcqueue *rxqs

Array of receive queues. Used by the application to subscribe to packets and to receive published packets. This is always allocated during initialization.

struct llist *subscribers

List of swbus_sub. Always sorted.

struct rdwrlock syncl

Prevents applications from servicing their receive queues for the packet currently being pushed out via swbus_publish_release() until all subscribers have been notified if RCSW_SWBUS_ASYNC is not passed.

char name[32]

Name for instance. Used to assist with debugging if multiple SWB instances are active. Has no effect on SWB operation.