FreeBSD/sys/dev/bxe/ecore_sp.c
/**
 * ecore_queue_state_change - perform Queue state change transition
 *
 * @sc:		device handle
 * @params:	parameters to perform the transition
 *
 * returns 0 in case of successfully completed transition, negative error
 * code in case of failure, positive (EBUSY) value if there is a completion
 * to that is still pending (possible only if RAMROD_COMP_WAIT is
 * not set in params->ramrod_flags for asynchronous commands).
 *
 */
perform Queue state change transition
@sc:         device handle
@params:     parameters to perform the transition

returns 0 in case of successfully completed transition, negative error
code in case of failure, positive (EBUSY) value if there is a completion
to that is still pending (possible only if RAMROD_COMP_WAIT is
not set in params->ramrod_flags for asynchronous commands).
perform Queue state change transition @sc : device handle @params : parameters to perform the transition returns 0 in case of successfully completed transition negative error code in case of failure positive ( EBUSY ) value if there is a completion to that is still pending ( possible only if RAMROD_COMP_WAIT is not set in params - > ramrod_flags for asynchronous commands ) .
int ecore_queue_state_change(struct bxe_softc *sc,
			     struct ecore_queue_state_params *params)
{
	struct ecore_queue_sp_obj *o = params->q_obj;
	int rc, pending_bit;
	unsigned long *pending = &o->pending;
	rc = o->check_transition(sc, o, params);
	if (rc) {
		ECORE_ERR("check transition returned an error. rc %d\n", rc);
		return ECORE_INVAL;
	}
	ECORE_MSG(sc, "pending bit was=%lx\n", o->pending);
	pending_bit = o->set_pending(o, params);
	ECORE_MSG(sc, "pending bit now=%lx\n", o->pending);
	if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &params->ramrod_flags))
		o->complete_cmd(sc, o, pending_bit);
	else {
		rc = o->send_cmd(sc, params);
		if (rc) {
			o->next_state = ECORE_Q_STATE_MAX;
			ECORE_CLEAR_BIT(pending_bit, pending);
			ECORE_SMP_MB_AFTER_CLEAR_BIT();
			return rc;
		}
		if (ECORE_TEST_BIT(RAMROD_COMP_WAIT, &params->ramrod_flags)) {
			rc = o->wait_comp(sc, o, pending_bit);
			if (rc)
				return rc;
			return ECORE_SUCCESS;
		}
	}
	return ECORE_RET_PENDING(pending_bit, pending);
}
int ecore_queue_state_change ( struct bxe_softc * sc , struct ecore_queue_state_params * params ) { struct ecore_queue_sp_obj * o = params -> q_obj ; int rc , pending_bit ; unsigned long * pending = & o -> pending ; rc = o -> check_transition ( sc , o , params ) ; if ( rc ) { ECORE_ERR ( " \n " , rc ) ; return ECORE_INVAL ; } ECORE_MSG ( sc , " \n " , o -> pending ) ; pending_bit = o -> set_pending ( o , params ) ; ECORE_MSG ( sc , " \n " , o -> pending ) ; if ( ECORE_TEST_BIT ( RAMROD_DRV_CLR_ONLY , & params -> ramrod_flags ) ) o -> complete_cmd ( sc , o , pending_bit ) ; else { rc = o -> send_cmd ( sc , params ) ; if ( rc ) { o -> next_state = ECORE_Q_STATE_MAX ; ECORE_CLEAR_BIT ( pending_bit , pending ) ; ECORE_SMP_MB_AFTER_CLEAR_BIT ( ) ; return rc ; } if ( ECORE_TEST_BIT ( RAMROD_COMP_WAIT , & params -> ramrod_flags ) ) { rc = o -> wait_comp ( sc , o , pending_bit ) ; if ( rc ) return rc ; return ECORE_SUCCESS ; } } return ECORE_RET_PENDING ( pending_bit , pending ) ; }
ecore_queue_state_change - perform Queue state change transition
 @sc:         device handle
 @params:     parameters to perform the transition
ecore_queue_state_change - perform Queue state change transition @sc : device handle @params : parameters to perform the transition
/* Check that the requested transition is legal */ /* Set "pending" bit */ /* Don't send a command if only driver cleanup was requested */ /* Send a ramrod */