MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tid_init

Function tid_init

dpdk/drivers/net/cxgbe/cxgbe_main.c:482–529  ·  view source on GitHub ↗

* Allocate and initialize the TID tables. Returns 0 on success. */

Source from the content-addressed store, hash-verified

480 * Allocate and initialize the TID tables. Returns 0 on success.
481 */
482static int tid_init(struct tid_info *t)
483{
484 size_t size;
485 unsigned int ftid_bmap_size;
486 unsigned int natids = t->natids;
487 unsigned int max_ftids = t->nftids;
488
489 ftid_bmap_size = rte_bitmap_get_memory_footprint(t->nftids);
490 size = t->ntids * sizeof(*t->tid_tab) +
491 max_ftids * sizeof(*t->ftid_tab) +
492 natids * sizeof(*t->atid_tab);
493
494 t->tid_tab = t4_os_alloc(size);
495 if (!t->tid_tab)
496 return -ENOMEM;
497
498 t->atid_tab = (union aopen_entry *)&t->tid_tab[t->ntids];
499 t->ftid_tab = (struct filter_entry *)&t->atid_tab[t->natids];
500 t->ftid_bmap_array = t4_os_alloc(ftid_bmap_size);
501 if (!t->ftid_bmap_array) {
502 tid_free(t);
503 return -ENOMEM;
504 }
505
506 t4_os_lock_init(&t->atid_lock);
507 t4_os_lock_init(&t->ftid_lock);
508
509 t->afree = NULL;
510 t->atids_in_use = 0;
511 t->tids_in_use = 0;
512 t->conns_in_use = 0;
513
514 /* Setup the free list for atid_tab and clear the stid bitmap. */
515 if (natids) {
516 while (--natids)
517 t->atid_tab[natids - 1].next = &t->atid_tab[natids];
518 t->afree = t->atid_tab;
519 }
520
521 t->ftid_bmap = rte_bitmap_init(t->nftids, t->ftid_bmap_array,
522 ftid_bmap_size);
523 if (!t->ftid_bmap) {
524 tid_free(t);
525 return -ENOMEM;
526 }
527
528 return 0;
529}
530
531static inline void init_rspq(struct adapter *adap, struct sge_rspq *q,
532 unsigned int us, unsigned int cnt,

Callers 1

cxgbe_probeFunction · 0.85

Calls 3

rte_bitmap_initFunction · 0.85
tid_freeFunction · 0.70

Tested by

no test coverage detected