* Release all the created MRs and resources on global MR cache of a device * list. * * @param share_cache * Pointer to a global shared MR cache. */
| 1097 | * Pointer to a global shared MR cache. |
| 1098 | */ |
| 1099 | void |
| 1100 | mlx5_mr_release_cache(struct mlx5_mr_share_cache *share_cache) |
| 1101 | { |
| 1102 | struct mlx5_mr *mr_next; |
| 1103 | |
| 1104 | rte_rwlock_write_lock(&share_cache->rwlock); |
| 1105 | /* Detach from MR list and move to free list. */ |
| 1106 | mr_next = LIST_FIRST(&share_cache->mr_list); |
| 1107 | while (mr_next != NULL) { |
| 1108 | struct mlx5_mr *mr = mr_next; |
| 1109 | |
| 1110 | mr_next = LIST_NEXT(mr, mr); |
| 1111 | LIST_REMOVE(mr, mr); |
| 1112 | LIST_INSERT_HEAD(&share_cache->mr_free_list, mr, mr); |
| 1113 | } |
| 1114 | LIST_INIT(&share_cache->mr_list); |
| 1115 | /* Free global cache. */ |
| 1116 | mlx5_mr_btree_free(&share_cache->cache); |
| 1117 | rte_rwlock_write_unlock(&share_cache->rwlock); |
| 1118 | /* Free all remaining MRs. */ |
| 1119 | mlx5_mr_garbage_collect(share_cache); |
| 1120 | } |
| 1121 | |
| 1122 | /** |
| 1123 | * Initialize global MR cache of a device. |
no test coverage detected