fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * You can obtain a copy of the license at
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * Copyright (c) 2004-2011 Emulex. All rights reserved.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_ip_handle_event(emlxs_hba_t *hba, CHANNEL *cp, IOCBQ *iocbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_stray_ip_completion_msg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "cmd=0x%x iotag=0x%x status=0x%x perr=0x%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint32_t)cmd->ULPCOMMAND, (uint32_t)cmd->ULPIOTAG,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * Error: Abnormal BCAST command completion (Local error)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "XMIT BCAST completion error cmd=0x%x status=0x%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "[%08x,%08x]", cmd->ULPCOMMAND, cmd->ULPSTATUS,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * Error: Abnormal XMIT SEQUENCE command completion
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * (Local error)
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "XMIT SEQUENCE CR completion error: cmd=%x status=0x%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "[%08x,%08x]", cmd->ULPCOMMAND, cmd->ULPSTATUS,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan cmd->un.ulpWord[4], cmd->un.ulpWord[5]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Normal BCAST completion
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "XMIT BCAST CN completion: cmd=%x status=0x%x [%08x,%08x]",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan cmd->ULPCOMMAND, cmd->ULPSTATUS, cmd->un.ulpWord[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Normal XMIT SEQUENCE completion
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "XMIT SEQUENCE CR completion: cmd=%x status=0x%x"
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "[%08x,%08x]", cmd->ULPCOMMAND, cmd->ULPSTATUS,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((cmd->ULPSTATUS == IOSTAT_LOCAL_REJECT) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((cmd->ULPCONTEXT == ndlp->nlp_Xri) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_create_xri(port, cp, ndlp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Invalid iocb: cmd=0x%x", cmd->ULPCOMMAND);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan } /* switch(cmd->ULPCOMMAND) */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_ip_handle_event() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_ip_handle_unsol_req(emlxs_port_t *port, CHANNEL *cp, IOCBQ *iocbq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < MAX_VPORTS; i++) {
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (fc_unsol_buf_t *)emlxs_ub_get(port, size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Theoretically we should never get here. */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* There should be one DMA buffer for every ub */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* buffer. If we are out of ub buffers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* then some how this matching has been corrupted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_unsol_ip_dropped_msg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Buffer not found. paddr=%lx",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan !(ndlp->nlp_flag[hba->channel_ip] & NLP_RPI_XRI)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_create_xri(port, cp, ndlp);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * If no node is found, then check if this is a
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * broadcast frame
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* We have to drop this frame because we do not have */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan /* the S_ID of the request */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_unsol_ip_dropped_msg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Node not found. mac=%02x%02x%02x%02x%02x%02x",
a9800beb32c1006bb21c8da39e0180ea440b7badGarrett D'Amore (void) emlxs_fca_ub_release((opaque_t)port, 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup frame header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ubp->ub_frame.r_ctl = cmd->un.xrseq.w5.hcsw.Rctl;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_ip_handle_unsol_req() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_ip_handle_rcv_seq_list(emlxs_hba_t *hba, CHANNEL *cp, IOCBQ *iocbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * No action required for now.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rp = &hba->sli.sli3.ring[cp->channelno];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Receive sequence list: cmd=0x%x iotag=0x%x status=0x%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "w4=0x%x channelno=0x%x", cmd->ULPCOMMAND, cmd->ULPIOTAG,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan cmd->ULPSTATUS, cmd->un.ulpWord[4], cp->channelno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for valid buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(cmd->un.cont64[0].tus.f.bdeFlags & BUFF_TYPE_INVALID)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_ip_handle_rcv_seq_list() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Process a create_xri command completion.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_handle_create_xri(emlxs_hba_t *hba, CHANNEL *cp, IOCBQ *iocbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_stray_ip_completion_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "create_xri: cmd=0x%x iotag=0x%x status=0x%x w4=0x%x. "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "NULL sbp found.",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan cmd->ULPCOMMAND, cmd->ULPIOTAG, cmd->ULPSTATUS,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check for first xmit completion in sequence */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_bad_ip_completion_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "create_xri: cmd=0x%x iotag=0x%x status=0x%x w4=0x%x. "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "NULL node found.",
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld cmd->ULPCOMMAND, cmd->ULPIOTAG, cmd->ULPSTATUS,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_bad_ip_completion_msg,
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "create_xri: cmd=0x%x iotag=0x%x status=0x%x w4=0x%x. "
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld "Completion error.",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan cmd->ULPCOMMAND, cmd->ULPIOTAG, cmd->ULPSTATUS,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[cp->channelno] &= ~NLP_RPI_XRI;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[cp->channelno] &= ~NLP_RPI_XRI;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "create_xri completed: DID=0x%x Xri=0x%x iotag=0x%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_DID, ndlp->nlp_Xri, cmd->ULPIOTAG);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_handle_create_xri() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * Issue an iocb command to create an exchange with the remote Nport
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * specified by the NODELIST entry.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_create_xri(emlxs_port_t *port, CHANNEL *cp, NODELIST *ndlp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if an XRI has already been requested */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (ndlp->nlp_flag[cp->channelno] & NLP_RPI_XRI)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[cp->channelno] |= NLP_RPI_XRI;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(pkt = emlxs_pkt_alloc(port, 0, 0, 0, KM_NOSLEEP))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "create_xri failed: Unable to allocate pkt. did=0x%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Clear the PACKET_ULP_OWNED flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the iotag by registering the packet */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * No more command slots available, retry later
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "create_xri failed: Unable to allocate IOTAG. did=0x%x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initalize iocbq */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "create_xri sent: DID=0x%x Xri=0x%x iotag=0x%x", ndlp->nlp_DID,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_SLI_ISSUE_IOCB_CMD(hba, cp, iocbq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Clear the XRI flag */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[cp->channelno] &= ~NLP_RPI_XRI;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_create_xri() */