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

Function mlx5_mr_insert_cache

dpdk/drivers/common/mlx5/mlx5_common_mr.c:393–413  ·  view source on GitHub ↗

* Insert a MR to the global B-tree cache. It may fail due to low-on-memory. * Then, this entry will have to be searched by mr_lookup_list() in * mlx5_mr_create() on miss. * * @param share_cache * Pointer to a global shared MR cache. * @param mr * Pointer to MR to insert. * * @return * 0 on success, -1 on failure. */

Source from the content-addressed store, hash-verified

391 * 0 on success, -1 on failure.
392 */
393int
394mlx5_mr_insert_cache(struct mlx5_mr_share_cache *share_cache,
395 struct mlx5_mr *mr)
396{
397 unsigned int n;
398
399 DRV_LOG(DEBUG, "Inserting MR(%p) to global cache(%p)",
400 (void *)mr, (void *)share_cache);
401 for (n = 0; n < mr->ms_bmp_n; ) {
402 struct mr_cache_entry entry;
403
404 memset(&entry, 0, sizeof(entry));
405 /* Find a contiguous chunk and advance the index. */
406 n = mr_find_next_chunk(mr, &entry, n);
407 if (!entry.end)
408 break;
409 if (mr_btree_insert(&share_cache->cache, &entry) < 0)
410 return -1;
411 }
412 return 0;
413}
414
415/**
416 * Look up address in the original global MR list.

Callers 3

mlx5_common_dev_dma_mapFunction · 0.85
mlx5_mr_rebuild_cacheFunction · 0.85
mlx5_mr_create_primaryFunction · 0.85

Calls 3

memsetFunction · 0.85
mr_find_next_chunkFunction · 0.70
mr_btree_insertFunction · 0.70

Tested by

no test coverage detected