src/dpdk/drivers/net/cxgbe/cxgbe_main.c
static int tid_init(struct tid_info *t)
{
	size_t size;
	unsigned int ftid_bmap_size;
	unsigned int natids = t->natids;
	unsigned int max_ftids = t->nftids;

	ftid_bmap_size = rte_bitmap_get_memory_footprint(t->nftids);
	size = t->ntids * sizeof(*t->tid_tab) +
		max_ftids * sizeof(*t->ftid_tab) +
		natids * sizeof(*t->atid_tab);

	t->tid_tab = t4_os_alloc(size);
	if (!t->tid_tab)
		return -ENOMEM;

	t->atid_tab = (union aopen_entry *)&t->tid_tab[t->ntids];
	t->ftid_tab = (struct filter_entry *)&t->atid_tab[t->natids];
	t->ftid_bmap_array = t4_os_alloc(ftid_bmap_size);
	if (!t->ftid_bmap_array) {
		tid_free(t);
		return -ENOMEM;
	}

	t4_os_lock_init(&t->atid_lock);
	t4_os_lock_init(&t->ftid_lock);

	t->afree = NULL;
	t->atids_in_use = 0;
	rte_atomic32_init(&t->tids_in_use);
	rte_atomic32_set(&t->tids_in_use, 0);
	rte_atomic32_init(&t->conns_in_use);
	rte_atomic32_set(&t->conns_in_use, 0);

	/* Setup the free list for atid_tab and clear the stid bitmap. */
	if (natids) {
		while (--natids)
			t->atid_tab[natids - 1].next = &t->atid_tab[natids];
		t->afree = t->atid_tab;
	}

	t->ftid_bmap = rte_bitmap_init(t->nftids, t->ftid_bmap_array,
				       ftid_bmap_size);
	if (!t->ftid_bmap) {
		tid_free(t);
		return -ENOMEM;
	}

	return 0;
}
/**
 * Allocate and initialize the TID tables.  Returns 0 on success.
 */
Allocate and initialize the TID tables.  Returns 0 on success.
Allocate and initialize the TID tables . Returns 0 on success .
static int tid_init(struct tid_info *t)
{
	size_t size;
	unsigned int ftid_bmap_size;
	unsigned int natids = t->natids;
	unsigned int max_ftids = t->nftids;
	ftid_bmap_size = rte_bitmap_get_memory_footprint(t->nftids);
	size = t->ntids * sizeof(*t->tid_tab) +
		max_ftids * sizeof(*t->ftid_tab) +
		natids * sizeof(*t->atid_tab);
	t->tid_tab = t4_os_alloc(size);
	if (!t->tid_tab)
		return -ENOMEM;
	t->atid_tab = (union aopen_entry *)&t->tid_tab[t->ntids];
	t->ftid_tab = (struct filter_entry *)&t->atid_tab[t->natids];
	t->ftid_bmap_array = t4_os_alloc(ftid_bmap_size);
	if (!t->ftid_bmap_array) {
		tid_free(t);
		return -ENOMEM;
	}
	t4_os_lock_init(&t->atid_lock);
	t4_os_lock_init(&t->ftid_lock);
	t->afree = NULL;
	t->atids_in_use = 0;
	rte_atomic32_init(&t->tids_in_use);
	rte_atomic32_set(&t->tids_in_use, 0);
	rte_atomic32_init(&t->conns_in_use);
	rte_atomic32_set(&t->conns_in_use, 0);
	if (natids) {
		while (--natids)
			t->atid_tab[natids - 1].next = &t->atid_tab[natids];
		t->afree = t->atid_tab;
	}
	t->ftid_bmap = rte_bitmap_init(t->nftids, t->ftid_bmap_array,
				       ftid_bmap_size);
	if (!t->ftid_bmap) {
		tid_free(t);
		return -ENOMEM;
	}
	return 0;
}
static int tid_init ( struct tid_info * t ) { size_t size ; unsigned int ftid_bmap_size ; unsigned int natids = t -> natids ; unsigned int max_ftids = t -> nftids ; ftid_bmap_size = rte_bitmap_get_memory_footprint ( t -> nftids ) ; size = t -> ntids * sizeof ( * t -> tid_tab ) + max_ftids * sizeof ( * t -> ftid_tab ) + natids * sizeof ( * t -> atid_tab ) ; t -> tid_tab = t4_os_alloc ( size ) ; if ( ! t -> tid_tab ) return - ENOMEM ; t -> atid_tab = ( union aopen_entry * ) & t -> tid_tab [ t -> ntids ] ; t -> ftid_tab = ( struct filter_entry * ) & t -> atid_tab [ t -> natids ] ; t -> ftid_bmap_array = t4_os_alloc ( ftid_bmap_size ) ; if ( ! t -> ftid_bmap_array ) { tid_free ( t ) ; return - ENOMEM ; } t4_os_lock_init ( & t -> atid_lock ) ; t4_os_lock_init ( & t -> ftid_lock ) ; t -> afree = NULL ; t -> atids_in_use = 0 ; rte_atomic32_init ( & t -> tids_in_use ) ; rte_atomic32_set ( & t -> tids_in_use , 0 ) ; rte_atomic32_init ( & t -> conns_in_use ) ; rte_atomic32_set ( & t -> conns_in_use , 0 ) ; if ( natids ) { while ( -- natids ) t -> atid_tab [ natids - 1 ] . next = & t -> atid_tab [ natids ] ; t -> afree = t -> atid_tab ; } t -> ftid_bmap = rte_bitmap_init ( t -> nftids , t -> ftid_bmap_array , ftid_bmap_size ) ; if ( ! t -> ftid_bmap ) { tid_free ( t ) ; return - ENOMEM ; } return 0 ; }
Allocate and initialize the TID tables.
Allocate and initialize the TID tables .
/* Setup the free list for atid_tab and clear the stid bitmap. */