hermon_qp.h revision 17a2b317610f531d565bf4e940433aab2d9e6985
/*
* 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_QP_H
#define _SYS_IB_ADAPTERS_HERMON_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
* Hermon queue pairs, 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 Queue Pairs. This value is
* controlled via the "hermon_log_num_qp" configuration variables.
* 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.
*
* Note: Increasing #QPs from 64K to 256K for reserved ranges for FCoIB.
*/
#define HERMON_NUM_QP_SHIFT 0x12
#define HERMON_QP_MIN_SIZE 0xf
/*
* The following defines the default number of Hermon RDMA Remote read
* database (RDB) entries per QP. This value is controllable through the
* "hermon_log_num_rdb_per_qp" configuration variable.
*/
#define HERMON_LOG_NUM_RDB_PER_QP 0x4
/*
* This defines the maximum number of SGLs per WQE. This value is
* controllable through the "hermon_wqe_max_sgl" configuration variable
* (but should not be set larger than this value).
*/
#define HERMON_NUM_SGL_PER_WQE 0x10
/*
* Maximum QP number mask (QP number is 24 bits).
* We reserve the most significant bit to indicate an "XRC" QP
* as recommended by the PRM. All XRC QPs will have this bit set.
*/
#define HERMON_QP_MAXNUMBER_MSK 0x7FFFFF
#define HERMON_QP_XRC_MSK 0x800000
/*
* 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.
*/
/*
* 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
* below in qp_state. If "qp_is_special" == 0 then an ordinary data qp.
*/
/*
* QP0, which is defined as being 0xF
*/
#define HERMON_QP_SMI 0x1
#define HERMON_QP_GSI 0x2
#define HERMON_DEF_SCHED_POLICY 0x03
#define HERMON_DEF_SCHED_SELECTION 0x0F
/*
* 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 "hermon_qp_ackreq_freq" configuration variable.
*/
#define HERMON_QP_ACKREQ_FREQ 0x5
/*
* Define the maximum message size (log 2). Note: This value corresponds
* to the maximum allowable message sized as defined by the IBA spec.
*/
#define HERMON_QP_LOG_MAX_MSGSZ 0x1F
/*
* This macro is used to determine if the hermon 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.
*/
qp_serv == HERMON_QP_FEXCH)) || \
/*
* The following enumerated type is used to capture all the various types
* of Hermon work queue types. It is specifically used as an argument to the
* to the hermon_qp_sgl_to_logwqesz() routine to determine the amount of
* overhead (in WQE header size) consumed by each of the types. 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 {
#define HERMON_QP_WQE_MLX_SND_HDRS 0x40
#define HERMON_QP_WQE_MLX_RCV_HDRS 0x00
#define HERMON_QP_WQE_MLX_SRQ_HDRS 0x10
#define HERMON_QP_WQE_MLX_QP0_HDRS 0x40
#define HERMON_QP_WQE_MLX_QP1_HDRS 0x70
#define HERMON_QP_WQE_LOG_MINIMUM 0x6
/*
* The hermon_qp_range_t is used to manage a qp_range for RSS and FEXCH.
* It has a reference count. When the reference count goes to 0,
* the qpc resource can be freed.
*/
typedef struct hermon_qp_range_s {
/*
* The hermon_qp_info_t structure is used internally by the Hermon driver to
* pass information to and from the hermon_qp_alloc() and
* hermon_special_qp_alloc() routines. It contains placeholders for all of the
* potential inputs and outputs that either routine can take.
*/
typedef struct hermon_qp_info_s {
/*
* The QPN entry which is stored in the AVL tree
*/
typedef struct hermon_qpn_entry_s {
#define HERMON_QPN_NOFLAG 0x0
#define HERMON_QPN_RELEASE 0x1
#define HERMON_QPN_FREE_ONLY 0x2
#define HERMON_QP_OH_SIZE 0x0800
/*
*/
/*
* The hermon_sw_qp_s structure is also referred to using the "hermon_qphdl_t"
* typedef (see hermon_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
* hermon_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 hermon_sw_qp_s {
/* prefetch == 0, none == 1, for headroom */
/* Send Work Queue */
/* Receive Work Queue - not used when SRQ is used */
/* DoorBell Record information */
void *qp_hdlrarg;
/* Shared Receive Queue */
/* Refcnt of QP belongs to an MCG */
/* save the mtu from init2rtr for future use */
struct hermon_qalloc_info_s qp_wqinfo;
struct hermon_qp_range_s *qp_rangep;
/* Beware: 8-byte alignment needed here */
struct hermon_hw_qpc_s qpc;
};
/* Defined in hermon_qp.c */
int flags);
/* Defined in hermon_qpmod.c */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_ADAPTERS_HERMON_QP_H */