/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_IB_ADAPTERS_HERMON_CQ_H
#define _SYS_IB_ADAPTERS_HERMON_CQ_H
/*
* Contains all of the prototypes, #defines, and structures necessary
* for the Completion Queue Processing routines.
* Specifically it contains the various completion types, flags,
* structures used for managing Hermon completion queues, and prototypes
* for many of the functions consumed by other parts of the Hermon driver
* (including those routines directly exposed through the IBTF CI
* interface).
*
* Most of the values defined below establish default values which,
* where indicated, can be controlled via their related patchable values,
* if 'hermon_alt_config_enable' is set.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following defines the default number of Completion Queues. This
* is controllable via the "hermon_log_num_cq" configuration variable.
* We also have a define for the minimum size of a CQ. CQs allocated
* with size "less than a page" will always get back a page.
*/
/*
* These are the defines for the Hermon CQ completion statuses.
*/
/*
* These are the defines for the Hermon CQ entry types. They indicate what type
* of work request is completing (for successful completions). Note: The
* "SND" or "RCV" in each define is used to indicate whether the completion
* work request was from the Send work queue or the Receive work queue on
* the associated QP.
*/
/* Define for maximum CQ number mask (CQ number is 24 bits) */
/*
* CQ Sched Management
*
* Each hermon_cq_sched struct defines a range of cq handler_id's
* assigned to the cq_sched instance. Also, the "next_alloc"
* member is used to allocate handler_id's in a round robin fashion.
*
* Valid cq handler_id's are in the range of 1 to hs_intrmsi_allocd.
* They are indexes into the hs_intrmsi_hdl array.
*/
typedef struct hermon_cq_sched_s {
/*
* new EQ mgmt - per domain (when it gets there).
* The first hs_rsvd_eqs are reserved by the firmware.
* The next hs_intrmsi_allocd are for CQ Completions.
* Each of these "completion" EQs has a unique interrupt vector.
* The EQs following that are:
*
* 1 for CQ Errors
* 1 for Asyncs and Command Completions, and finally
* 1 for All Other events.
*
* share the last of the interrupt vectors.
*/
/*
* The following defines are used for Hermon CQ error handling. Note: For
* CQEs which correspond to error events, the Hermon device requires some
* special handling by software. These defines are used to identify and
* extract the necessary information from each error CQE, including status
* code (above), doorbell count, and whether a error completion is for a
* send or receive work request.
*/
#define HERMON_CQE_ERR_STATUS_SHIFT 0
/* Defines for tracking whether a CQ is being used with special QP or not */
#define HERMON_CQ_IS_NORMAL 0
/*
* The hermon_sw_cq_s structure is also referred to using the "hermon_cqhdl_t"
* typedef (see hermon_typedef.h). It encodes all the information necessary
* to track the various resources needed to allocate, initialize, poll, resize,
* and (later) free a completion queue (CQ).
*
* Specifically, it has a consumer index and a lock to ensure single threaded
* access to it. It has pointers to the various resources allocated for the
* completion queue, i.e. a CQC resource and the memory for the completion
* queue itself. It also has a reference count and the number(s) of the EQs
* to which it is associated (for success and for errors).
*
* Additionally, it has a pointer to the associated MR handle (for the mapped
* queue memory) and a void pointer that holds the argument that should be
* passed back to the IBTF when events are generated on the CQ.
*
* We also have the always necessary backpointer to the resource for the
* CQ handle structure itself. But we also have pointers to the "Work Request
* ID" processing lists (both the lock and the regular list, as well as the
* head and tail for the "reapable" list). See hermon_wrid.c for more details.
*/
struct hermon_sw_cq_s {
/* DoorBell Record Information */
void *cq_hdlrarg;
/* For Work Request ID processing */
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_ADAPTERS_HERMON_CQ_H */