* Initialize global MR cache of a device. * * @param share_cache * Pointer to a global shared MR cache. * @param socket * NUMA socket on which memory must be allocated. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 1131 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 1132 | */ |
| 1133 | int |
| 1134 | mlx5_mr_create_cache(struct mlx5_mr_share_cache *share_cache, int socket) |
| 1135 | { |
| 1136 | /* Set the reg_mr and dereg_mr callback functions */ |
| 1137 | mlx5_os_set_reg_mr_cb(&share_cache->reg_mr_cb, |
| 1138 | &share_cache->dereg_mr_cb); |
| 1139 | rte_rwlock_init(&share_cache->rwlock); |
| 1140 | rte_rwlock_init(&share_cache->mprwlock); |
| 1141 | /* Initialize B-tree and allocate memory for global MR cache table. */ |
| 1142 | return mlx5_mr_btree_init(&share_cache->cache, |
| 1143 | MLX5_MR_BTREE_CACHE_N * 2, socket); |
| 1144 | } |
| 1145 | |
| 1146 | /** |
| 1147 | * Flush all of the local cache entries. |
no test coverage detected