diff options
author | hselasky <hselasky@FreeBSD.org> | 2016-11-15 08:51:29 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2016-11-15 08:51:29 +0000 |
commit | 90b8e755586156e89f1c3b9db9634173f16ff030 (patch) | |
tree | 161db1382a8fd24c9db0999c732a79d396571973 /sys/dev/mlx5 | |
parent | 5730ca3c80055f9dd7f86a7d971c22fed8820c14 (diff) | |
download | FreeBSD-src-90b8e755586156e89f1c3b9db9634173f16ff030.zip FreeBSD-src-90b8e755586156e89f1c3b9db9634173f16ff030.tar.gz |
MFC r308411:
Ensure the firmware is notified of any host memory allocation
failures. Else firmware commands may time out waiting for host
memory.
Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/dev/mlx5')
-rw-r--r-- | sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c b/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c index 91904d7..85ff815 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c @@ -246,13 +246,14 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, int inlen; u64 addr; int err; - int i; + int i = 0; inlen = sizeof(*in) + npages * sizeof(in->pas[0]); in = mlx5_vzalloc(inlen); if (!in) { mlx5_core_warn(dev, "vzalloc failed %d\n", inlen); - return -ENOMEM; + err = -ENOMEM; + goto out_alloc; } memset(&out, 0, sizeof(out)); @@ -263,7 +264,7 @@ retry: if (err == -ENOMEM) err = alloc_system_page(dev, func_id); if (err) - goto out_4k; + goto out_alloc; goto retry; } @@ -301,12 +302,11 @@ out_alloc: memset(&out, 0, sizeof(out)); nin->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); nin->hdr.opmod = cpu_to_be16(MLX5_PAGES_CANT_GIVE); + nin->func_id = cpu_to_be16(func_id); if (mlx5_cmd_exec(dev, nin, sizeof(*nin), &out, sizeof(out))) mlx5_core_warn(dev, "page notify failed\n"); kfree(nin); } - -out_4k: for (i--; i >= 0; i--) free_4k(dev, be64_to_cpu(in->pas[i])); out_free: |