Skip to content

Commit

Permalink
net/mlx5: fix memory region cleanup
Browse files Browse the repository at this point in the history
[ upstream commit f8753ea ]

mlx5 driver has a global list of Memory Regions created by
device, and there is a ml5_mr_release() routine which makes
a memory cleanup at device closing. The head of device MR list
was fetched outside the rwlock protected section. Also some
noticed typos are fixed.

Fixes: 974f1e7 ("net/mlx5: add new memory region support")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
  • Loading branch information
viacheslavo authored and kevintraynor committed May 7, 2019
1 parent 03f418f commit a4d0145
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/mlx5/mlx5_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ mr_free(struct mlx5_mr *mr)
}

/**
* Releass resources of detached MR having no online entry.
* Release resources of detached MR having no online entry.
*
* @param dev
* Pointer to Ethernet device.
Expand Down Expand Up @@ -515,7 +515,7 @@ mr_find_contig_memsegs_cb(const struct rte_memseg_list *msl,
}

/**
* Create a new global Memroy Region (MR) for a missing virtual address.
* Create a new global Memory Region (MR) for a missing virtual address.
* Register entire virtually contiguous memory chunk around the address.
*
* @param dev
Expand Down Expand Up @@ -623,7 +623,7 @@ mlx5_mr_create(struct rte_eth_dev *dev, struct mlx5_mr_cache *entry,
bmp_mem = RTE_PTR_ALIGN_CEIL(mr + 1, RTE_CACHE_LINE_SIZE);
mr->ms_bmp = rte_bitmap_init(ms_n, bmp_mem, bmp_size);
if (mr->ms_bmp == NULL) {
DEBUG("port %u unable to initialize bitamp for a new MR of"
DEBUG("port %u unable to initialize bitmap for a new MR of"
" address (%p).",
dev->data->port_id, (void *)addr);
rte_errno = EINVAL;
Expand Down Expand Up @@ -1350,7 +1350,7 @@ void
mlx5_mr_release(struct rte_eth_dev *dev)
{
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_mr *mr_next = LIST_FIRST(&priv->mr.mr_list);
struct mlx5_mr *mr_next;

/* Remove from memory callback device list. */
rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock);
Expand All @@ -1360,6 +1360,7 @@ mlx5_mr_release(struct rte_eth_dev *dev)
mlx5_mr_dump_dev(dev);
rte_rwlock_write_lock(&priv->mr.rwlock);
/* Detach from MR list and move to free list. */
mr_next = LIST_FIRST(&priv->mr.mr_list);
while (mr_next != NULL) {
struct mlx5_mr *mr = mr_next;

Expand Down

0 comments on commit a4d0145

Please sign in to comment.