mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
mlx5: Fix cleanup flow when DMA mapping fails
If DMA mapping fails, the driver cleared the object that holds the previously DMA mapped pages. Fix this by allocating a new object for the command that reports back to firmware that pages can't be supplied. Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
cfd8f1d49b
commit
952f5f6e80
@ -181,6 +181,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
|
|||||||
{
|
{
|
||||||
struct mlx5_manage_pages_inbox *in;
|
struct mlx5_manage_pages_inbox *in;
|
||||||
struct mlx5_manage_pages_outbox out;
|
struct mlx5_manage_pages_outbox out;
|
||||||
|
struct mlx5_manage_pages_inbox *nin;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
int inlen;
|
int inlen;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
@ -247,13 +248,20 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
|
|||||||
|
|
||||||
out_alloc:
|
out_alloc:
|
||||||
if (notify_fail) {
|
if (notify_fail) {
|
||||||
memset(in, 0, inlen);
|
nin = kzalloc(sizeof(*nin), GFP_KERNEL);
|
||||||
|
if (!nin) {
|
||||||
|
mlx5_core_warn(dev, "allocation failed\n");
|
||||||
|
goto unmap;
|
||||||
|
}
|
||||||
memset(&out, 0, sizeof(out));
|
memset(&out, 0, sizeof(out));
|
||||||
in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES);
|
nin->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES);
|
||||||
in->hdr.opmod = cpu_to_be16(MLX5_PAGES_CANT_GIVE);
|
nin->hdr.opmod = cpu_to_be16(MLX5_PAGES_CANT_GIVE);
|
||||||
if (mlx5_cmd_exec(dev, in, sizeof(*in), &out, sizeof(out)))
|
if (mlx5_cmd_exec(dev, nin, sizeof(*nin), &out, sizeof(out)))
|
||||||
mlx5_core_warn(dev, "\n");
|
mlx5_core_warn(dev, "page notify failed\n");
|
||||||
|
kfree(nin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unmap:
|
||||||
for (i--; i >= 0; i--) {
|
for (i--; i >= 0; i--) {
|
||||||
addr = be64_to_cpu(in->pas[i]);
|
addr = be64_to_cpu(in->pas[i]);
|
||||||
page = remove_page(dev, addr);
|
page = remove_page(dev, addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user