FreeBSD/sys/dev/bxe/ecore_sp.c
/**
 * ecore_validate_vlan_mac_del - check if the DEL command can be executed
 *
 * @sc:		device handle
 * @qo:		quable object to check
 * @elem:	element that needs to be deleted
 *
 * Checks that the requested configuration can be deleted. If yes and if
 * requested, returns a CAM credit.
 *
 * The 'validate' is run after the 'optimize'.
 */
check if the DEL command can be executed
@sc:         device handle
@qo:         quable object to check
@elem:       element that needs to be deleted

Checks that the requested configuration can be deleted. If yes and if
requested, returns a CAM credit.

The 'validate' is run after the 'optimize'.
check if the DEL command can be executed @sc : device handle @qo : quable object to check @elem : element that needs to be deleted Checks that the requested configuration can be deleted . If yes and if requested returns a CAM credit . The ' validate ' is run after the ' optimize ' .
static inline int ecore_validate_vlan_mac_del(struct bxe_softc *sc,
					      union ecore_qable_obj *qo,
					      struct ecore_exeq_elem *elem)
{
	struct ecore_vlan_mac_obj *o = &qo->vlan_mac;
	struct ecore_vlan_mac_registry_elem *pos;
	struct ecore_exe_queue_obj *exeq = &o->exe_queue;
	struct ecore_exeq_elem query_elem;
	pos = o->check_del(sc, o, &elem->cmd_data.vlan_mac.u);
	if (!pos) {
		ECORE_MSG(sc, "DEL command is not allowed considering current registry state\n");
		return ECORE_EXISTS;
	}
	ECORE_MEMCPY(&query_elem, elem, sizeof(query_elem));
	query_elem.cmd_data.vlan_mac.cmd = ECORE_VLAN_MAC_MOVE;
	if (exeq->get(exeq, &query_elem)) {
		ECORE_ERR("There is a pending MOVE command already\n");
		return ECORE_INVAL;
	}
	if (exeq->get(exeq, elem)) {
		ECORE_MSG(sc, "There is a pending DEL command already\n");
		return ECORE_EXISTS;
	}
	if (!(ECORE_TEST_BIT(ECORE_DONT_CONSUME_CAM_CREDIT,
			     &elem->cmd_data.vlan_mac.vlan_mac_flags) ||
	    o->put_credit(o))) {
		ECORE_ERR("Failed to return a credit\n");
		return ECORE_INVAL;
	}
	return ECORE_SUCCESS;
}
static inline int ecore_validate_vlan_mac_del ( struct bxe_softc * sc , union ecore_qable_obj * qo , struct ecore_exeq_elem * elem ) { struct ecore_vlan_mac_obj * o = & qo -> vlan_mac ; struct ecore_vlan_mac_registry_elem * pos ; struct ecore_exe_queue_obj * exeq = & o -> exe_queue ; struct ecore_exeq_elem query_elem ; pos = o -> check_del ( sc , o , & elem -> cmd_data . vlan_mac . u ) ; if ( ! pos ) { ECORE_MSG ( sc , " \n " ) ; return ECORE_EXISTS ; } ECORE_MEMCPY ( & query_elem , elem , sizeof ( query_elem ) ) ; query_elem . cmd_data . vlan_mac . cmd = ECORE_VLAN_MAC_MOVE ; if ( exeq -> get ( exeq , & query_elem ) ) { ECORE_ERR ( " \n " ) ; return ECORE_INVAL ; } if ( exeq -> get ( exeq , elem ) ) { ECORE_MSG ( sc , " \n " ) ; return ECORE_EXISTS ; } if ( ! ( ECORE_TEST_BIT ( ECORE_DONT_CONSUME_CAM_CREDIT , & elem -> cmd_data . vlan_mac . vlan_mac_flags ) || o -> put_credit ( o ) ) ) { ECORE_ERR ( " \n " ) ; return ECORE_INVAL ; } return ECORE_SUCCESS ; }
ecore_validate_vlan_mac_del - check if the DEL command can be executed
 @sc:         device handle
 @qo:         quable object to check
 @elem:       element that needs to be deleted
ecore_validate_vlan_mac_del - check if the DEL command can be executed @sc : device handle @qo : quable object to check @elem : element that needs to be deleted
/* If this classification can not be deleted (doesn't exist)
	 * - return a ECORE_EXIST.
	 */ /* Check if there are pending DEL or MOVE commands for this
	 * MAC/VLAN/VLAN-MAC. Return an error if so.
	 */ /* Check for MOVE commands */ /* Check for DEL commands */ /* Return the credit to the credit pool if not requested not to */