// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
*/
inlinevoid rxe_queue_reset(struct rxe_queue *q)
{ /* queue is comprised from header and the memory * of the actual queue. See "struct rxe_queue_buf" in rxe_queue.h * reset only the queue itself and not the management header
*/
memset(q->buf->data, 0, q->buf_size - sizeof(struct rxe_queue_buf));
}
/* num_elem == 0 is allowed, but uninteresting */ if (*num_elem < 0) return NULL;
q = kzalloc(sizeof(*q), GFP_KERNEL); if (!q) return NULL;
q->rxe = rxe;
q->type = type;
/* used in resize, only need to copy used part of queue */
q->elem_size = elem_size;
/* pad element up to at least a cacheline and always a power of 2 */ if (elem_size < cache_line_size())
elem_size = cache_line_size();
elem_size = roundup_pow_of_two(elem_size);
/* copies elements from original q to new q and then swaps the contents of the * two q headers. This is so that if anyone is holding a pointer to q it will * still work
*/ staticint resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, unsignedint num_elem)
{ enum queue_type type = q->type;
u32 new_prod;
u32 prod;
u32 cons;
if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.