FreeBSD/sys/dev/bxe/ecore_sp.c
/**
 * ecore_vlan_mac_get_registry_elem - prepare a registry element
 *
 * @sc:	  device handle
 * @o:
 * @elem:
 * @restore:
 * @re:
 *
 * prepare a registry element according to the current command request.
 */


prepare a registry element according to the current command request.
prepare a registry element according to the current command request .
static inline int ecore_vlan_mac_get_registry_elem(
	struct bxe_softc *sc,
	struct ecore_vlan_mac_obj *o,
	struct ecore_exeq_elem *elem,
	bool restore,
	struct ecore_vlan_mac_registry_elem **re)
{
	enum ecore_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
	struct ecore_vlan_mac_registry_elem *reg_elem;
	if (!restore &&
	    ((cmd == ECORE_VLAN_MAC_ADD) || (cmd == ECORE_VLAN_MAC_MOVE))) {
		reg_elem = ECORE_ZALLOC(sizeof(*reg_elem), GFP_ATOMIC, sc);
		if (!reg_elem)
			return ECORE_NOMEM;
		if (!o->get_cam_offset(o, &reg_elem->cam_offset)) {
			ECORE_DBG_BREAK_IF(1);
			ECORE_FREE(sc, reg_elem, sizeof(*reg_elem));
			return ECORE_INVAL;
		}
		ECORE_MSG(sc, "Got cam offset %d\n", reg_elem->cam_offset);
		ECORE_MEMCPY(&reg_elem->u, &elem->cmd_data.vlan_mac.u,
			  sizeof(reg_elem->u));
		reg_elem->vlan_mac_flags =
			elem->cmd_data.vlan_mac.vlan_mac_flags;
	} else 
		reg_elem = o->check_del(sc, o, &elem->cmd_data.vlan_mac.u);
	*re = reg_elem;
	return ECORE_SUCCESS;
}
static inline int ecore_vlan_mac_get_registry_elem ( struct bxe_softc * sc , struct ecore_vlan_mac_obj * o , struct ecore_exeq_elem * elem , bool restore , struct ecore_vlan_mac_registry_elem * * re ) { enum ecore_vlan_mac_cmd cmd = elem -> cmd_data . vlan_mac . cmd ; struct ecore_vlan_mac_registry_elem * reg_elem ; if ( ! restore && ( ( cmd == ECORE_VLAN_MAC_ADD ) || ( cmd == ECORE_VLAN_MAC_MOVE ) ) ) { reg_elem = ECORE_ZALLOC ( sizeof ( * reg_elem ) , GFP_ATOMIC , sc ) ; if ( ! reg_elem ) return ECORE_NOMEM ; if ( ! o -> get_cam_offset ( o , & reg_elem -> cam_offset ) ) { ECORE_DBG_BREAK_IF ( 1 ) ; ECORE_FREE ( sc , reg_elem , sizeof ( * reg_elem ) ) ; return ECORE_INVAL ; } ECORE_MSG ( sc , " \n " , reg_elem -> cam_offset ) ; ECORE_MEMCPY ( & reg_elem -> u , & elem -> cmd_data . vlan_mac . u , sizeof ( reg_elem -> u ) ) ; reg_elem -> vlan_mac_flags = elem -> cmd_data . vlan_mac . vlan_mac_flags ; } else reg_elem = o -> check_del ( sc , o , & elem -> cmd_data . vlan_mac . u ) ; * re = reg_elem ; return ECORE_SUCCESS ; }
ecore_vlan_mac_get_registry_elem - prepare a registry element
 @sc:   device handle
 @o:
 @elem:
 @restore:
 @re:
ecore_vlan_mac_get_registry_elem - prepare a registry element @sc : device handle @o : @elem : @restore : @re :
/* Allocate a new registry element if needed. */ /* Get a new CAM offset */ /* This shall never happen, because we have checked the
			 * CAM availability in the 'validate'.
			 */ /* Set a VLAN-MAC data */ /* Copy the flags (needed for DEL and RESTORE flows) */ /* DEL, RESTORE */