FreeBSD/sys/dev/bxe/ecore_sp.c
/**
 * ecore_init_credit_pool - initialize credit pool internals.
 *
 * @p:
 * @base:	Base entry in the CAM to use.
 * @credit:	pool size.
 *
 * If base is negative no CAM entries handling will be performed.
 * If credit is negative pool operations will always succeed (unlimited pool).
 *
 */
initialize credit pool internals.
@p:
@base:       Base entry in the CAM to use.
@credit:     pool size.

If base is negative no CAM entries handling will be performed.
If credit is negative pool operations will always succeed (unlimited pool).
initialize credit pool internals . @p : @base : Base entry in the CAM to use . @credit : pool size . If base is negative no CAM entries handling will be performed . If credit is negative pool operations will always succeed ( unlimited pool ) .
void ecore_init_credit_pool(struct ecore_credit_pool_obj *p,
					  int base, int credit)
{
	ECORE_MEMSET(p, 0, sizeof(*p));
	ECORE_MEMSET(&p->pool_mirror, 0xff, sizeof(p->pool_mirror));
	ECORE_ATOMIC_SET(&p->credit, credit);
	p->pool_sz = credit;
	p->base_pool_offset = base;
	ECORE_SMP_MB();
	p->check = ecore_credit_pool_check;
	if (credit >= 0) {
		p->put      = ecore_credit_pool_put;
		p->get      = ecore_credit_pool_get;
		p->put_entry = ecore_credit_pool_put_entry;
		p->get_entry = ecore_credit_pool_get_entry;
	} else {
		p->put      = ecore_credit_pool_always_TRUE;
		p->get      = ecore_credit_pool_always_TRUE;
		p->put_entry = ecore_credit_pool_put_entry_always_TRUE;
		p->get_entry = ecore_credit_pool_get_entry_always_TRUE;
	}
	if (base < 0) {
		p->put_entry = ecore_credit_pool_put_entry_always_TRUE;
		p->get_entry = ecore_credit_pool_get_entry_always_TRUE;
	}
}
void ecore_init_credit_pool ( struct ecore_credit_pool_obj * p , int base , int credit ) { ECORE_MEMSET ( p , 0 , sizeof ( * p ) ) ; ECORE_MEMSET ( & p -> pool_mirror , 0xff , sizeof ( p -> pool_mirror ) ) ; ECORE_ATOMIC_SET ( & p -> credit , credit ) ; p -> pool_sz = credit ; p -> base_pool_offset = base ; ECORE_SMP_MB ( ) ; p -> check = ecore_credit_pool_check ; if ( credit >= 0 ) { p -> put = ecore_credit_pool_put ; p -> get = ecore_credit_pool_get ; p -> put_entry = ecore_credit_pool_put_entry ; p -> get_entry = ecore_credit_pool_get_entry ; } else { p -> put = ecore_credit_pool_always_TRUE ; p -> get = ecore_credit_pool_always_TRUE ; p -> put_entry = ecore_credit_pool_put_entry_always_TRUE ; p -> get_entry = ecore_credit_pool_get_entry_always_TRUE ; } if ( base < 0 ) { p -> put_entry = ecore_credit_pool_put_entry_always_TRUE ; p -> get_entry = ecore_credit_pool_get_entry_always_TRUE ; } }
ecore_init_credit_pool - initialize credit pool internals.
ecore_init_credit_pool - initialize credit pool internals .
/* Zero the object first */ /* Set the table to all 1s */ /* Init a pool as full */ /* The total poll size */ /* Commit the change */ /* if pool credit is negative - disable the checks */ /* If base is negative - disable entries handling */