/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_IB_ADAPTERS_TAVOR_QP_H
#define _SYS_IB_ADAPTERS_TAVOR_QP_H
/*
* Contains all of the prototypes, #defines, and structures necessary
* for all of the Queue Pair Processing routines.
* Specifically it contains the various flags, structures used for managing
* Tavor queue pairs, and prototypes for many of the functions consumed by
* other parts of the Tavor driver (including those routines directly
* exposed through the IBTF CI interface).
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following defines specify the default number of Queue Pairs (QP) and
* their maximum size. Settings exist for the supported DDR DIMM sizes of
* 128MB and 256MB. If a DIMM greater than 256 is found, then the 256MB
* profile is used. See tavor_cfg.c for more discussion on config profiles.
*
* For manual configuration (not using config profiles), these values are
* controllable through the "tavor_log_max_qp_sz" and "tavor_log_num_qp"
* configuration variables, respectively. To override config profile settings
* the 'tavor_alt_config_enable' configuration variable must first be set.
*
* Note: We also have a define for the minimum size of a QP. QPs allocated
* with size 0, 1, 2, or 3 will always get back a QP of size 4. This is the
* smallest size that Tavor hardware and software can correctly handle.
*/
/*
* Minimal configuration values.
*/
/*
* The following macro determines whether the contents of QP memory (WQEs)
* need to be sync'd (with ddi_dma_sync()). This decision is based on whether
* the QP memory is in DDR memory (no sync) or system memory (sync required).
* And it also supports the possibility that if a CQ in system memory is mapped
* DDI_DMA_CONSISTENT, it can be configured to not be sync'd because of the
* "sync override" parameter in the config profile.
*/
? 0 : 1)
/*
* The following defines specify the size of the individual Queue Pair
* Context (QPC) entries. Below we also specify the size of the "Extended
* QPC entries as well.
*/
/*
* The following defines specify the default number of Tavor RDMA Backing
* entries (RDB). Settings exist for the supported DDR DIMM sizes of 128MB and
* 256MB. If a DIMM greater than 256 is found, then the 256MB profile is used.
* See tavor_cfg.c for more discussion on config profiles.
*
* For manual configuration (not using config profiles), this value is
* controllable through the "tavor_log_num_rdb" configuration variable. To
* override config profile settings the 'tavor_alt_config_enable' configuration
* variable must first be set.
*
* Below we also include the defines that are used to specify four (4)
*/
/*
* Minimal configuration value.
*/
/*
* The following defines specify the size of the individual RDMA Backing
* entries (RDB).
*/
/*
* This defines the maximum number of SGLs per WQE. This value is
* controllable through the "tavor_wqe_max_sgl" configuration variable (but
* should not be set larger than this value).
*/
/* Define for maximum QP number mask (QP number is 24 bits) */
/*
* This define and the following macro are used to find a schedule queue for
* a new QP based on its queue pair number. Note: This is a rather simple
* method that we use today. We simply choose from the schedule queue based
* on the 4 least significant bits of the QP number.
*/
/*
* This define determines the frequency with which the AckReq bit will be
* set in outgoing RC packets. By default it is set to five (5) or 2^5 = 32.
* So AckReq will be set once every 32 packets sent. This value is
* controllable through the "tavor_qp_ackreq_freq" configuration variable.
*/
/*
* Define the maximum message size (log 2). Note: This value corresponds
* to the maximum allowable message sized as defined by the IBA spec.
*/
/*
* This macro is used to determine the appropriate alignment for a Tavor
* work queue (see tavor_qp_alloc() and tavor_special_qp_alloc()). Note:
* Tavor work queues are aligned on their combined size (i.e. combined size
* of send queue and receive queue) because of certain hardware limitations
* (i.e. work queue memory cannot cross a 32-bit boundary).
*/
/*
* This macro is used to determine if the tavor known QP type (qp_serv) is the
* same as the caller passed in IBT type (qp_trans). This is used in QP modify
* to ensure the types match.
*/
/*
* The following enumerated type is used to capture all the various types
* of Tavor work queue types. Note: It is specifically used as an argument
* to the tavor_qp_sgl_to_logwqesz() routine.
* The defines below are also used by the tavor_qp_sgl_to_logwqesz() routine
* they indicate the amount of overhead (in WQE header size) consumed by
* each of the following types of WQEs. This information is used to round
* the WQE size to the next largest power-of-2 (and to determine the number
* of SGLs that are supported for the given WQE type). There is also a define
* below used to specify the minimum size for a WQE. The minimum size is set
* to 64 bytes (a single cacheline).
*/
typedef enum {
/*
* The tavor_qp_info_t structure is used internally by the Tavor driver to
* pass information to and from the tavor_qp_alloc() and
* tavor_special_qp_alloc() routines. It contains placeholders for all of the
* potential inputs and outputs that either routine can take.
*/
typedef struct tavor_qp_info_s {
/*
* The QPN entry which is stored in the AVL tree
*/
typedef struct tavor_qpn_entry_s {
/*
* The tavor_sw_qp_s structure is also referred to using the "tavor_qphdl_t"
* typedef (see tavor_typedef.h). It encodes all the information necessary
* to track the various resources needed to allocate, query, modify, and
* (later) free both normal QP and special QP.
*
* Specifically, it has a lock to ensure single threaded access to the QP.
* It has QP state, type, and number, pointers to the PD, MR, and CQ handles
* associated with the QP, and pointers to the buffer where the work queues
* come from.
*
* It has two pointers (one per work queue) to the workQ headers for the WRID
* list, as well as pointers to the last WQE on each chain (used when
* connecting a new chain of WQEs to a previously executing chain - see
* tavor_wr.c). It's also got the real WQE size, real number of SGL per WQE,
* and the size of each of the work queues (in number of WQEs).
*
* Additionally, it has pointers to the resources associated with the QP
* (including the obligatory backpointer to the resource for the QP handle
* itself. But it also has some flags, like "qp_forward_sqd_event" and
* "qp_sqd_still_draining" (which are used to indicate whether a Send Queue
* Drained Event should be forwarded to the IBTF) or "qp_is_special",
* "qp_portnum", and "qp_pkeyindx" (which are used by special QP to store
* necessary information about the type of the QP, which port it's connected
* to, and what its current PKey index is set to).
*/
struct tavor_sw_qp_s {
/* Send Work Queue */
/* Receive Work Queue */
void *qp_hdlrarg;
/* Shared Receive Queue */
/* Refcnt of QP belongs to an MCG */
/* save the mtu & srate from init2rtr for future use */
};
/*
* The following defines are used to indicate whether a QP is special or
* not (and what type it is). They are used in the "qp_is_special" field
* above.
*/
/*
* The tavor_qp_options_t structure is used in the Tavor QP allocation
* routines to provide additional option functionality. When a NULL pointer
* is passed in place of a pointer to this struct, it is a way of specifying
* the "default" behavior. Using this structure, however, is a way of
* controlling any extended behavior.
*
* Currently, the only defined "extended" behavior is for specifying whether
* a given QP's work queues should be allocated from kernel system memory
* (TAVOR_QUEUE_LOCATION_NORMAL) or should be allocated from local DDR memory
* (TAVOR_QUEUE_LOCATION_INDDR). This defaults today to always allocating
* from kernel system memory but can be changed by using the
* "tavor_qp_wq_inddr" configuration variable.
*/
typedef struct tavor_qp_options_s {
/* Defined in tavor_qp.c */
int flags);
/* Defined in tavor_qpmod.c */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_ADAPTERS_TAVOR_QP_H */