enx_impl.h revision b494511a9cf72b1fc4eb13a0e593f55c624ab829
/*
* 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_EOIB_ENX_IMPL_H
#define _SYS_IB_EOIB_ENX_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Driver specific constants
*/
#define ENX_E_SUCCESS 0
#define ENX_E_FAILURE -1
#define ENX_MAX_LINE 128
#define ENX_GRH_SZ (sizeof (ib_grh_t))
/*
* Debug messages
*/
#define ENX_MSGS_CRIT 0x01
#define ENX_MSGS_ERR 0x02
#define ENX_MSGS_WARN 0x04
#define ENX_MSGS_DEBUG 0x08
#define ENX_MSGS_ARGS 0x10
#define ENX_MSGS_VERBOSE 0x20
#define ENX_LOGSZ_DEFAULT 0x20000
#define ENX_DPRINTF_CRIT eibnx_dprintf_crit
#define ENX_DPRINTF_ERR eibnx_dprintf_err
#define ENX_DPRINTF_WARN eibnx_dprintf_warn
#ifdef ENX_DEBUG
#define ENX_DPRINTF_DEBUG eibnx_dprintf_debug
#define ENX_DPRINTF_ARGS eibnx_dprintf_args
#else
#define ENX_DPRINTF_DEBUG 0 &&
#define ENX_DPRINTF_ARGS 0 &&
#define ENX_DPRINTF_VERBOSE 0 &&
#endif
/*
* EoIB Nexus service threads
*/
#define ENX_PORT_MONITOR "eibnx_port_%d_monitor"
#define ENX_NODE_CREATOR "eibnx_node_creator"
/*
* Default period (us) for unicast solicitations to discovered gateways.
* EoIB specification requires that hosts send solicitation atleast every
* 4 * GW_ADV_PERIOD.
*/
#define ENX_DFL_SOLICIT_PERIOD_USEC 32000000
/*
* Portinfo list per HCA
*/
typedef struct eibnx_port_s {
struct eibnx_port_s *po_next;
} eibnx_port_t;
/*
* HCA details
*/
typedef struct eibnx_hca_s {
struct eibnx_hca_s *hc_next;
} eibnx_hca_t;
/*
* The port_monitor thread in EoIB nexus driver only sends two types of
* packets: multicast solicitation the first time around, and periodic
* unicast solicitations later to gateways that have been discovered. So
* we need a couple of send wqes for the multicast solicitation and
* probably as many send wqes as the number of gateways that may be
* discovered from each port, for sending the unicast solicitations.
* For unicast solicitations though, the UD destination needs to be set
* up at the time we receive the advertisement from the gateway, using
* ibt_modify_reply_ud_dest(), so we'll assign one send wqe for each
* gateway that we discover. This means that we need to acquire these
* send wqe entries during rx processing in the completion handler, which
* means we must avoid sleeping in trying to acquire the swqe. Therefore,
* we'll pre-allocate these unicast solication send wqes to be atleast
* twice the number of recv wqes.
*
* The receive packets expected by the EoIB nexus driver are the multicast
* and unicast messages on the SOLICIT and ADVERTISE groups. These
* shouldn't be too many, and should be tuned as we gain experience on
* the traffic pattern. We'll start with 16.
*/
#define ENX_NUM_SWQE 46
#define ENX_NUM_RWQE 16
/*
* qe_type values
*/
#define ENX_QETYP_RWQE 0x1
#define ENX_QETYP_SWQE 0x2
/*
* qe_flags bitmasks (protected by qe_lock). None of the
* flag values may be zero.
*/
#define ENX_QEFL_INUSE 0x01
#define ENX_QEFL_POSTED 0x02
#define ENX_QEFL_RELONCOMP 0x04
/*
* Recv and send workq entries
*/
typedef struct eibnx_wqe_s {
} eibnx_wqe_t;
/*
* Tx descriptor
*/
typedef struct eibnx_tx_s {
} eibnx_tx_t;
/*
* Rx descriptor
*/
typedef struct eibnx_rx_s {
} eibnx_rx_t;
/*
* Details about the address of each gateway we discover.
*/
typedef struct eibnx_gw_addr_s {
/*
* States for each GW
*/
typedef struct eibnx_gw_info_s {
struct eibnx_gw_info_s *gw_next;
/*
* Values for gw_adv_flag (non-zero only)
*/
#define ENX_GW_DEAD 1
#define ENX_GW_ALIVE 2
#define ENX_GW_AWARE 3
/*
* Currently, we only expect the advertisement type of packets
* from the gw. But we do get login acks from the gateway also
* here in the nexus, so we'll need an identifier for that.
*/
typedef enum {
/*
* Currently, the only gw response handled by the eibnx driver
* both these responses may be packed into a eibnx_gw_info_t.
* In the future, if we decide to handle other types of responses
* from the gw, we could simply add the new types to the union.
*/
typedef struct eibnx_gw_msg_s {
union {
} u;
/*
* List to hold the devinfo nodes of eoib instances
*/
typedef struct eibnx_child_s {
struct eibnx_child_s *ch_next;
char *ch_node_name;
/*
* Event bitmasks for the port-monitor to wait on. None of these flags
* may be zero.
*/
#define ENX_EVENT_LINK_UP 0x01
#define ENX_EVENT_MCGS_AVAILABLE 0x02
#define ENX_EVENT_TIMED_OUT 0x04
#define ENX_EVENT_DIE 0x08
#define ENX_EVENT_COMPLETION 0x10
/*
*/
#define ENX_MCGS_FOUND 0x1
#define ENX_MCGS_JOINED 0x2
/*
* Information that each port-monitor thread cares about
*/
typedef struct eibnx_thr_info_s {
struct eibnx_thr_info_s *ti_next;
/*
* Our kernel thread id
*/
/*
* HCA, port and protection domain information
*/
char *ti_ident;
/*
* Well-known multicast groups for solicitations
* and advertisements.
*/
/*
* Completion queue stuff
*/
/*
* Channel related
*/
/*
*/
/*
* GW related stuff
*/
/*
* Devinfo nodes for the eoib children
*/
/*
*/
/*
* Workq entry for creation of eoib nodes
*/
typedef struct eibnx_nodeq_s {
struct eibnx_nodeq_s *nc_next;
/*
* Bus config status flags. The in-prog is protected by
* nx_lock, and the rest of the flags (currently only
* buscfg-complete) is protected by the in-prog bit itself.
*/
#define NX_FL_BUSOP_INPROG 0x1
#define NX_FL_BUSCFG_COMPLETE 0x2
#define NX_FL_BUSOP_MASK 0x3
/*
* EoIB nexus per-instance state
*/
typedef struct eibnx_s {
} eibnx_t;
/*
* Event tags for EoIB Nexus events delivered to EoIB instances
*/
#define ENX_EVENT_TAG_GW_INFO_UPDATE 0
#define ENX_EVENT_TAG_GW_AVAILABLE 1
#define ENX_EVENT_TAG_LOGIN_ACK 2
/*
* FUNCTION PROTOTYPES FOR CROSS-FILE LINKAGE
*/
/*
* Threads and Event Handlers
*/
void eibnx_port_monitor(eibnx_thr_info_t *);
void eibnx_create_eoib_node(void);
void eibnx_comp_intr(ibt_cq_hdl_t, void *);
/*
* IBT related functions
*/
int eibnx_ibt_init(eibnx_t *);
int eibnx_find_mgroups(eibnx_thr_info_t *);
int eibnx_setup_cq(eibnx_thr_info_t *);
int eibnx_setup_bufs(eibnx_thr_info_t *);
int eibnx_join_mcgs(eibnx_thr_info_t *);
int eibnx_rejoin_mcgs(eibnx_thr_info_t *);
int eibnx_ibt_fini(eibnx_t *);
void eibnx_rb_find_mgroups(eibnx_thr_info_t *);
void eibnx_rb_setup_cq(eibnx_thr_info_t *);
void eibnx_rb_setup_bufs(eibnx_thr_info_t *);
void eibnx_rb_join_mcgs(eibnx_thr_info_t *);
int eibnx_cleanup_hca(eibnx_hca_t *);
/*
* FIP packetizing related functions
*/
/*
* Queue and List related routines
*/
void eibnx_return_swqe(eibnx_wqe_t *);
void eibnx_release_swqe(eibnx_wqe_t *);
dev_info_t *);
/*
* Logging and Error reporting routines
*/
void eibnx_debug_init(void);
void eibnx_debug_fini(void);
void eibnx_dprintf_crit(const char *fmt, ...);
void eibnx_dprintf_err(const char *fmt, ...);
void eibnx_dprintf_warn(const char *fmt, ...);
#ifdef ENX_DEBUG
void eibnx_dprintf_debug(const char *fmt, ...);
void eibnx_dprintf_args(const char *fmt, ...);
void eibnx_dprintf_verbose(const char *fmt, ...);
#endif
/*
* Miscellaneous
*/
void eibnx_cleanup_port_nodes(eibnx_thr_info_t *);
eibnx_gw_info_t *);
void eibnx_busop_inprog_enter(eibnx_t *);
void eibnx_busop_inprog_exit(eibnx_t *);
void eibnx_stop_port_monitor(eibnx_thr_info_t *);
void eibnx_terminate_monitors(void);
/*
* Devctl cbops (currently dummy)
*/
/*
* External variable references
*/
extern pri_t minclsyspri;
extern eibnx_t *enx_global_ss;
extern ib_gid_t enx_solicit_mgid;
extern ib_gid_t enx_advertise_mgid;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_EOIB_ENX_IMPL_H */