oce_intr.c revision 3abb112f8485b33b6b9b52b340bede0a333c10bf
/*
* 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 © 2003-2011 Emulex. All rights reserved. */
/*
* Source file interrupt registration
* and related helper functions
*/
#include <oce_impl.h>
/*
* top level function to setup interrupts
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
int
{
int ret;
int intr_types = 0;
int navail = 0;
int nsupported = 0;
int min = 0;
int nreqd = 0;
int nallocd = 0;
/* get supported intr types */
if (ret != DDI_SUCCESS) {
"Failed to retrieve intr types ");
return (DDI_FAILURE);
}
if (intr_types & DDI_INTR_TYPE_MSIX) {
/* one vector is shared by MCC and Tx */
} else if (intr_types & DDI_INTR_TYPE_FIXED) {
}
if (ret != DDI_SUCCESS) {
"Could not get nintrs:0x%d", ret);
return (DDI_FAILURE);
}
/* get the number of vectors available */
"Could not get msix vectors:0x%x",
navail);
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
/* if the requested number is more than available reset reqd */
}
/* allocate htable */
return (DDI_FAILURE);
nallocd = 0;
/* allocate interrupt handlers */
if (ret != DDI_SUCCESS) {
goto fail_intr;
}
goto fail_intr;
}
/*
* get the interrupt priority. Assumption is that all handlers have
* equal priority
*/
if (ret != DDI_SUCCESS) {
goto fail_intr;
}
} else {
}
return (DDI_SUCCESS);
(void) oce_teardown_intr(dev);
(intr_types & DDI_INTR_TYPE_FIXED)) {
"Could not get MSIX vectors, trying for FIXED vectors");
goto retry_intr;
}
return (DDI_FAILURE);
}
/*
* top level function to undo initialization in oce_setup_intr
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
int
{
int i;
/* release handlers */
for (i = 0; i < dev->num_vectors; i++) {
}
/* release htable */
return (DDI_SUCCESS);
}
/*
* helper function to add ISR based on interrupt type
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
int
{
int i = 0;
int ret;
for (i = 0; i < dev->num_vectors; i++) {
if (ret != DDI_SUCCESS) {
"Failed to add interrupt handlers");
for (i--; i >= 0; i--) {
}
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
/*
* helper function to remove ISRs added in oce_setup_handlers
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
void
{
int nvec;
}
}
void
{
reg |= HOSTINTR_MASK;
}
/*
* function to enable interrupts
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
void
{
int i;
int ret;
} else {
for (i = 0; i < dev->num_vectors; i++) {
if (ret != DDI_SUCCESS) {
for (i--; i >= 0; i--) {
}
}
}
}
} /* oce_ei */
void
{
reg &= ~HOSTINTR_MASK;
}
/*
* function to disable interrupts
*
* dev - software handle to the device
*
* return DDI_SUCCESS => success, failure otherwise
*/
void
{
int i;
int ret;
} else {
for (i = 0; i < dev->num_vectors; i++) {
if (ret != DDI_SUCCESS) {
"Failed to disable interrupts 0x%x", ret);
}
}
}
} /* oce_di */
/*
* command interrupt handler routine added to all vectors
*
* arg1 = callback data
* arg2 - callback data
*
* return DDI_INTR_CLAIMED => interrupt was claimed by the ISR
*/
static uint_t
{
/* if not CQ then continue else flag an error */
"NOT a CQ event. 0x%x",
}
/* get the cq from the eqe */
/* Call the completion handler */
/* clear valid bit and progress eqe */
num_eqe++;
} /* for all EQEs */
/* ring the eq doorbell, signify that it's done processing */
if (num_eqe > 0) {
return (DDI_INTR_CLAIMED);
} else {
return (DDI_INTR_UNCLAIMED);
}
} /* oce_msix_handler */