Lines Matching defs:dp

103 	struct dir24_8_tbl *dp = p;
105 if (dp == NULL)
108 nh_sz = dp->nh_sz;
159 tbl8_get_idx(struct dir24_8_tbl *dp)
164 for (i = 0; (i < (dp->number_tbl8s >> BITMAP_SLAB_BIT_SIZE_LOG2)) &&
165 (dp->tbl8_idxes[i] == UINT64_MAX); i++)
167 if (i < (dp->number_tbl8s >> BITMAP_SLAB_BIT_SIZE_LOG2)) {
168 bit_idx = rte_ctz64(~dp->tbl8_idxes[i]);
169 dp->tbl8_idxes[i] |= (1ULL << bit_idx);
176 tbl8_free_idx(struct dir24_8_tbl *dp, int idx)
178 dp->tbl8_idxes[idx >> BITMAP_SLAB_BIT_SIZE_LOG2] &=
183 tbl8_alloc(struct dir24_8_tbl *dp, uint64_t nh)
188 tbl8_idx = tbl8_get_idx(dp);
191 if (unlikely(tbl8_idx == -ENOSPC && dp->dq &&
192 !rte_rcu_qsbr_dq_reclaim(dp->dq, 1, NULL, NULL, NULL)))
193 tbl8_idx = tbl8_get_idx(dp);
197 tbl8_ptr = (uint8_t *)dp->tbl8 +
199 dp->nh_sz);
202 DIR24_8_EXT_ENT, dp->nh_sz,
204 dp->cur_tbl8s++;
209 tbl8_cleanup_and_free(struct dir24_8_tbl *dp, uint64_t tbl8_idx)
211 uint8_t *ptr = (uint8_t *)dp->tbl8 + (tbl8_idx * DIR24_8_TBL8_GRP_NUM_ENT << dp->nh_sz);
213 memset(ptr, 0, DIR24_8_TBL8_GRP_NUM_ENT << dp->nh_sz);
214 tbl8_free_idx(dp, tbl8_idx);
215 dp->cur_tbl8s--;
221 struct dir24_8_tbl *dp = p;
224 tbl8_cleanup_and_free(dp, tbl8_idx);
228 tbl8_recycle(struct dir24_8_tbl *dp, uint32_t ip, uint64_t tbl8_idx)
237 switch (dp->nh_sz) {
239 ptr8 = &((uint8_t *)dp->tbl8)[tbl8_idx *
246 ((uint8_t *)dp->tbl24)[ip >> 8] =
250 ptr16 = &((uint16_t *)dp->tbl8)[tbl8_idx *
257 ((uint16_t *)dp->tbl24)[ip >> 8] =
261 ptr32 = &((uint32_t *)dp->tbl8)[tbl8_idx *
268 ((uint32_t *)dp->tbl24)[ip >> 8] =
272 ptr64 = &((uint64_t *)dp->tbl8)[tbl8_idx *
279 ((uint64_t *)dp->tbl24)[ip >> 8] =
284 if (dp->v == NULL) {
285 tbl8_cleanup_and_free(dp, tbl8_idx);
286 } else if (dp->rcu_mode == RTE_FIB_QSBR_MODE_SYNC) {
287 rte_rcu_qsbr_synchronize(dp->v, RTE_QSBR_THRID_INVALID);
288 tbl8_cleanup_and_free(dp, tbl8_idx);
290 if (rte_rcu_qsbr_dq_enqueue(dp->dq, &tbl8_idx))
296 install_to_fib(struct dir24_8_tbl *dp, uint32_t ledge, uint32_t redge,
310 tbl24_tmp = get_tbl24(dp, ledge, dp->nh_sz);
318 tbl8_idx = tbl8_alloc(dp, tbl24_tmp);
319 tmp_tbl8_idx = tbl8_get_idx(dp);
323 tbl8_free_idx(dp, tbl8_idx);
326 tbl8_free_idx(dp, tmp_tbl8_idx);
328 write_to_fib(get_tbl24_p(dp, ledge,
329 dp->nh_sz), (tbl8_idx << 1)|
331 dp->nh_sz, 1);
334 tbl8_ptr = (uint8_t *)dp->tbl8 +
337 dp->nh_sz);
341 dp->nh_sz, ROUNDUP(ledge, 24) - ledge);
342 tbl8_recycle(dp, ledge, tbl8_idx);
344 write_to_fib(get_tbl24_p(dp, ROUNDUP(ledge, 24), dp->nh_sz),
345 next_hop << 1, dp->nh_sz, len);
347 tbl24_tmp = get_tbl24(dp, redge, dp->nh_sz);
350 tbl8_idx = tbl8_alloc(dp, tbl24_tmp);
354 write_to_fib(get_tbl24_p(dp, redge,
355 dp->nh_sz), (tbl8_idx << 1)|
357 dp->nh_sz, 1);
360 tbl8_ptr = (uint8_t *)dp->tbl8 +
362 dp->nh_sz);
366 dp->nh_sz, redge & ~DIR24_8_TBL24_MASK);
367 tbl8_recycle(dp, redge, tbl8_idx);
370 tbl24_tmp = get_tbl24(dp, ledge, dp->nh_sz);
373 tbl8_idx = tbl8_alloc(dp, tbl24_tmp);
377 write_to_fib(get_tbl24_p(dp, ledge, dp->nh_sz),
380 dp->nh_sz, 1);
383 tbl8_ptr = (uint8_t *)dp->tbl8 +
386 dp->nh_sz);
390 dp->nh_sz, redge - ledge);
391 tbl8_recycle(dp, ledge, tbl8_idx);
397 modify_fib(struct dir24_8_tbl *dp, struct rte_rib *rib, uint32_t ip,
420 ret = install_to_fib(dp, ledge, redge,
436 ret = install_to_fib(dp, ledge, redge,
450 struct dir24_8_tbl *dp;
461 dp = rte_fib_get_dp(fib);
463 RTE_ASSERT((dp != NULL) && (rib != NULL));
465 if (next_hop > get_max_nh(dp->nh_sz))
477 ret = modify_fib(dp, rib, ip, depth, next_hop);
486 (dp->rsvd_tbl8s >= dp->number_tbl8s))
500 ret = modify_fib(dp, rib, ip, depth, next_hop);
506 dp->rsvd_tbl8s++;
517 ret = modify_fib(dp, rib, ip, depth, par_nh);
519 ret = modify_fib(dp, rib, ip, depth, dp->def_nh);
526 dp->rsvd_tbl8s--;
540 struct dir24_8_tbl *dp;
563 dp = rte_zmalloc_socket(name, sizeof(struct dir24_8_tbl) +
566 if (dp == NULL) {
572 write_to_fib(dp->tbl24, (def_nh << 1), nh_sz, 1 << 24);
574 snprintf(mem_name, sizeof(mem_name), "TBL8_%p", dp);
577 dp->tbl8 = rte_zmalloc_socket(mem_name, tbl8_sz,
579 if (dp->tbl8 == NULL) {
581 rte_free(dp);
584 dp->def_nh = def_nh;
585 dp->nh_sz = nh_sz;
586 dp->number_tbl8s = num_tbl8;
588 snprintf(mem_name, sizeof(mem_name), "TBL8_idxes_%p", dp);
589 dp->tbl8_idxes = rte_zmalloc_socket(mem_name,
590 RTE_ALIGN_CEIL(dp->number_tbl8s, 64) >> 3,
592 if (dp->tbl8_idxes == NULL) {
594 rte_free(dp->tbl8);
595 rte_free(dp);
599 return dp;
605 struct dir24_8_tbl *dp = (struct dir24_8_tbl *)p;
607 rte_rcu_qsbr_dq_delete(dp->dq);
608 rte_free(dp->tbl8_idxes);
609 rte_free(dp->tbl8);
610 rte_free(dp);
614 dir24_8_rcu_qsbr_add(struct dir24_8_tbl *dp, struct rte_fib_rcu_config *cfg,
620 if (dp == NULL || cfg == NULL)
623 if (dp->v != NULL)
642 params.p = dp;
644 dp->dq = rte_rcu_qsbr_dq_create(&params);
645 if (dp->dq == NULL) {
653 dp->rcu_mode = cfg->mode;
654 dp->v = cfg->v;