Re: [PATCH rdma-core 05/11] libbnxtre: Allow apps to poll for flushed completions

Jason Gunthorpe
2017-01-29T23:11:03Z

On Sat, Jan 28, 2017 at 05:13:36PM -0500, Devesh Sharma wrote:
> +#ifndef __BNXT_RE_LIST_H__
> +#define __BNXT_RE_LIST_H__
> +
> +struct bnxt_re_list_node {
> + uint8_t valid;
> + struct bnxt_re_list_node *next, *prev;
> +};
> +
> +struct bnxt_re_list_head {
> + struct bnxt_re_list_node node;
> + pthread_mutex_t lock;
> +};
> +
> +#define DBLY_LIST_HEAD_INIT(name) {{true, &name.node, &name.node},\
> + PTHREAD_MUTEX_INITIALIZER}
> +
> +#define DBLY_LIST_HEAD(name) \
> + struct bnxt_re_list_head name = DBLY_LIST_HEAD_INIT(name) \
> +
> +#define INIT_DBLY_LIST_NODE(ptr) do { \
> + (ptr)->next = (ptr); (ptr)->prev = (ptr); (ptr)->valid = false; \
> +} while (0)
> +
> +#define INIT_DBLY_LIST_HEAD(ptr) INIT_DBLY_LIST_NODE(ptr.node)
> +
> +static inline void __list_add_node(struct bnxt_re_list_node *new,
> + struct bnxt_re_list_node *prev,
> + struct bnxt_re_list_node *next)
> +{
> + next->prev = new;
> + new->next = next;
> + new->prev = prev;
> + prev->next = new;
> +}

Nope on this entire file, use ccan/list.h

Jason