a23fd118e437af0a7877dd313db8fdaa3537c675yl * CDDL HEADER START
a23fd118e437af0a7877dd313db8fdaa3537c675yl * The contents of this file are subject to the terms of the
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Common Development and Distribution License (the "License").
a23fd118e437af0a7877dd313db8fdaa3537c675yl * You may not use this file except in compliance with the License.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a23fd118e437af0a7877dd313db8fdaa3537c675yl * See the License for the specific language governing permissions
a23fd118e437af0a7877dd313db8fdaa3537c675yl * and limitations under the License.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * When distributing Covered Code, include this CDDL HEADER in each
a23fd118e437af0a7877dd313db8fdaa3537c675yl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * If applicable, add the following below this CDDL HEADER, with the
a23fd118e437af0a7877dd313db8fdaa3537c675yl * fields enclosed by brackets "[]" replaced with your own identifying
a23fd118e437af0a7877dd313db8fdaa3537c675yl * information: Portions Copyright [yyyy] [name of copyright owner]
a23fd118e437af0a7877dd313db8fdaa3537c675yl * CDDL HEADER END
8347601bcb0a439f6e50fc36b4039a73d08700e1yl * Copyright (c) 2002-2006 Neterion, Inc.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * enum xge_queue_status_e - Enumerates return codes of the xge_queue
a23fd118e437af0a7877dd313db8fdaa3537c675yl * manipulation APIs.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @XGE_QUEUE_IS_FULL: Queue is full, need to grow.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @XGE_QUEUE_IS_EMPTY: Queue is empty.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @XGE_QUEUE_OUT_OF_MEMORY: Out of memory.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @XGE_QUEUE_NOT_ENOUGH_SPACE: Exceeded specified event size,
a23fd118e437af0a7877dd313db8fdaa3537c675yl * see xge_queue_consume().
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @XGE_QUEUE_OK: Neither one of the codes listed above.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Enumerates return codes of xge_queue_consume()
a23fd118e437af0a7877dd313db8fdaa3537c675yl * and xge_queue_produce() APIs.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * struct xge_queue_item_t - Queue item.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @item: List item. Note that the queue is "built" on top of
a23fd118e437af0a7877dd313db8fdaa3537c675yl * the bi-directional linked list.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @event_type: Event type. Includes (but is not restricted to)
a23fd118e437af0a7877dd313db8fdaa3537c675yl * one of the xge_hal_event_e{} enumerated types.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @data_size: Size of the enqueued user data. Note that xge_queue_t
a23fd118e437af0a7877dd313db8fdaa3537c675yl * items are allowed to have variable sizes.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @is_critical: For critical events, e.g. ECC.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @context: Opaque (void*) "context", for instance event producer object.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Item of the xge_queue_t{}. The queue is protected
a23fd118e437af0a7877dd313db8fdaa3537c675yl * in terms of multi-threaded concurrent access.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * See also: xge_queue_t{}.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * function xge_queued_f - Item-enqueued callback.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @data: Per-queue context independent of the event. E.g., device handle.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @event_type: HAL or ULD-defined event type. Note that HAL own
a23fd118e437af0a7877dd313db8fdaa3537c675yl * events are enumerated by xge_hal_event_e{}.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Per-queue optional callback. If not NULL, called by HAL each
a23fd118e437af0a7877dd313db8fdaa3537c675yl * time an event gets added to the queue.
a23fd118e437af0a7877dd313db8fdaa3537c675yltypedef void (*xge_queued_f) (void *data, int event_type);
a23fd118e437af0a7877dd313db8fdaa3537c675yl * struct xge_queue_t - Protected dynamic queue of variable-size items.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @start_ptr: Points to the start of the queue.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @end_ptr: Points to the end of the queue.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @head_ptr: Points to the head of the queue. It gets changed during queue
a23fd118e437af0a7877dd313db8fdaa3537c675yl * produce/consume operations.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @tail_ptr: Points to the tail of the queue. It gets changed during queue
a23fd118e437af0a7877dd313db8fdaa3537c675yl * produce/consume operations.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @lock: Lock for queue operations(syncronization purpose).
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @pages_initial:Number of pages to be initially allocated at the time
a23fd118e437af0a7877dd313db8fdaa3537c675yl * of queue creation.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @pages_max: Max number of pages that can be allocated in the queue.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @pages_current: Number of pages currently allocated
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @list_head: Points to the list of queue elements that are produced, but yet
a23fd118e437af0a7877dd313db8fdaa3537c675yl * to be consumed.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @signal_callback: (TODO)
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @pdev: PCI device handle
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @irqh: PCI device IRQ handle.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @queued_func: Optional callback function to be called each time a new
a23fd118e437af0a7877dd313db8fdaa3537c675yl * item is added to the queue.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @queued_data: Arguments to the callback function.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * @has_critical_event: Non-zero, if the queue contains a critical event,
a23fd118e437af0a7877dd313db8fdaa3537c675yl * see xge_hal_event_e{}.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Protected dynamically growing queue. The queue is used to support multiple
a23fd118e437af0a7877dd313db8fdaa3537c675yl * producer/consumer type scenarios. The queue is a strict FIFO: first come
a23fd118e437af0a7877dd313db8fdaa3537c675yl * first served.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * Queue users may "produce" (see xge_queue_produce()) and "consume"
a23fd118e437af0a7877dd313db8fdaa3537c675yl * (see xge_queue_consume()) items (a.k.a. events) variable sizes.
a23fd118e437af0a7877dd313db8fdaa3537c675yl * See also: xge_queue_item_t{}.
a23fd118e437af0a7877dd313db8fdaa3537c675yl/* ========================== PUBLIC API ================================= */
a23fd118e437af0a7877dd313db8fdaa3537c675ylxge_queue_h xge_queue_create(pci_dev_h pdev, pci_irq_h irqh, int pages_initial,
a23fd118e437af0a7877dd313db8fdaa3537c675yl int pages_max, xge_queued_f queued_func, void *queued_data);
a23fd118e437af0a7877dd313db8fdaa3537c675ylxge_queue_produce(xge_queue_h queueh, int event_type, void *context,
a23fd118e437af0a7877dd313db8fdaa3537c675ylxge_queue_produce_context(xge_queue_h queueh, int event_type, void *context) {
a23fd118e437af0a7877dd313db8fdaa3537c675yl return xge_queue_produce(queueh, event_type, context, 0, 0, 0);
a23fd118e437af0a7877dd313db8fdaa3537c675ylxge_queue_status_e xge_queue_consume(xge_queue_h queueh, int data_max_size,
a23fd118e437af0a7877dd313db8fdaa3537c675yl/* ========================== PRIVATE API ================================= */
a23fd118e437af0a7877dd313db8fdaa3537c675yl#endif /* XGE_QUEUE_H */