/*
* 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
*/
/*
*/
/*
* Declarations private to this file
*/
static void eib_ctl_comp_intr(ibt_cq_hdl_t, void *);
int
{
/*
* Allocate a eib_chan_t to store stuff about this vnic's ctl qp
* and initialize it with default admin qp pkey parameters. We'll
* re-associate this with the pkey we receive from the gw once we
* receive the login ack.
*/
/*
* Setup a combined CQ and completion handler
*/
"eib_ctl_setup_cq() failed");
goto ctl_create_qp_fail;
}
/*
* Setup UD channel
*/
"eib_ctl_setup_ud_channel() failed");
goto ctl_create_qp_fail;
}
return (EIB_E_SUCCESS);
return (EIB_E_FAILURE);
}
/*ARGSUSED*/
{
int i;
/*
* Re-arm the notification callback before we start polling
* the completion queue. There's nothing much we can do if the
* enable_cq_notify fails - we issue a warning and move on.
*/
if (ret != IBT_SUCCESS) {
"ibt_enable_cq_notify() failed, ret=%d", ret);
}
/*
* Handle tx and rx completions
*/
&polled)) == IBT_SUCCESS) {
} else {
}
}
}
return (DDI_INTR_CLAIMED);
}
void
{
}
static int
{
int rv;
/*
* Allocate a completion queue for sending vhub table request
* and vhub-update/vnic-alive messages and responses from the
* gateway
*/
else
if (ret != IBT_SUCCESS) {
"ibt_alloc_cq(cq_sz=0x%lx) failed, ret=%d",
goto ctl_setup_cq_fail;
}
/*
* Set up other parameters for collecting completion information
*/
/*
* Allocate soft interrupt for this vnic's control channel cq
* handler and set up the IBTL cq handler.
*/
"ddi_intr_add_softint() failed for vnic %d ctl qp, ret=%d",
goto ctl_setup_cq_fail;
}
/*
* Now, set up this vnic's control channel completion queue handler
*/
if (ret != IBT_SUCCESS) {
"ibt_enable_cq_notify() failed, ret=%d", ret);
goto ctl_setup_cq_fail;
}
return (EIB_E_SUCCESS);
return (EIB_E_FAILURE);
}
static int
{
if (ret != IBT_SUCCESS) {
"ibt_alloc_ud_channel(port=0x%x, pkey_ix=0x%x) "
}
if (ret != IBT_SUCCESS) {
"ibt_query_ud_channel() failed, ret=%d", ret);
}
chan->ch_ip_hdr_align = 0;
return (EIB_E_SUCCESS);
return (EIB_E_FAILURE);
}
static void
{
"cq_hdl(0x%llx) != chan->ch_cq_hdl(0x%llx), "
return;
}
}
static void
{
/*
* Skip the GRH and parse the message in the packet
*/
/*
* Try to repost the rwqe. For control channels, we take the shortcut
* and not go through eib_chan_post_recv(), since we know that the
* qe_info flag, qe_chan and qe_vinst are all already set correctly; we
* just took this out of the rx queue, so the ch_rx_posted will be ok
* if we just posted it back. And there are no mblk allocation or
* buffer alignment restrictions for this channel as well.
*/
if (chan->ch_tear_down) {
} else {
if (ret != IBT_SUCCESS) {
"ibt_post_recv() failed, ret=%d", ret);
}
}
}
static void
{
}
static void
{
/*
* Currently, all we do is report
*/
case IBT_WC_WR_FLUSHED_ERR:
break;
case IBT_WC_LOCAL_CHAN_OP_ERR:
"IBT_WC_LOCAL_CHAN_OP_ERR seen, wqe_info=0x%lx ",
break;
case IBT_WC_LOCAL_PROTECT_ERR:
"IBT_WC_LOCAL_PROTECT_ERR seen, wqe_info=0x%lx ",
break;
}
/*
* When a wc indicates error, we do not attempt to repost but
* simply return it to the wqe pool.
*/
else
}
/*ARGSUSED*/
static void
{
return;
/*
* Reset any completion handler we may have set up
*/
/*
* Remove any softint we may have allocated for this cq
*/
if (vnic->vn_ctl_si_hdl) {
}
/*
* Release any work completion buffers we may have allocated
*/
/*
* Free any completion queue we may have allocated
*/
if (ret != IBT_SUCCESS) {
"eib_rb_ctl_setup_cq: "
"ibt_free_cq() failed, ret=%d", ret);
}
}
}
/*ARGSUSED*/
static void
{
return;
/*
* We're trying to tear down this UD channel. Make sure that
* we don't attempt to refill (repost) at any point from now on.
*/
"eib_rb_ctl_setup_ud_channel: "
"ibt_flush_channel() failed, ret=%d", ret);
}
/*
* Wait until all posted tx wqes on this channel are back with
* the wqe pool.
*/
while (chan->ch_tx_posted > 0)
/*
* Wait until all posted rx wqes on this channel are back with
* the wqe pool.
*/
while (chan->ch_rx_posted > 0)
/*
* Now we're ready to free this channel
*/
"eib_rb_ctl_setup_ud_channel: "
"ibt_free_channel() failed, ret=%d", ret);
}
chan->ch_ip_hdr_align = 0;
chan->ch_rwqe_bktsz = 0;
chan->ch_lwm_rwqes = 0;
chan->ch_max_rwqes = 0;
chan->ch_max_swqes = 0;
}
}