Date: Thu, 14 Jan 2021 10:47:15 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e47a6525e71d - main - Add missing init of new fields after new UAR API was introduced by f8f5b459d21e in mlx5ib. Message-ID: <202101141047.10EAlF2u056481@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e47a6525e71d48fd3dd49aac61cbe211ceec34f2 commit e47a6525e71d48fd3dd49aac61cbe211ceec34f2 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2021-01-14 10:42:31 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2021-01-14 10:44:54 +0000 Add missing init of new fields after new UAR API was introduced by f8f5b459d21e in mlx5ib. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 42 +++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 58f9379e867b..f2485d13d791 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -3226,6 +3226,36 @@ free: return ARRAY_SIZE(names); } +static int mlx5_ib_stage_bfreg_init(struct mlx5_ib_dev *dev) +{ + int err; + + err = mlx5_alloc_bfreg(dev->mdev, &dev->bfreg, false, false); + if (err) + return err; + + err = mlx5_alloc_bfreg(dev->mdev, &dev->fp_bfreg, false, true); + if (err) { + mlx5_free_bfreg(dev->mdev, &dev->bfreg); + return err; + } + + err = mlx5_alloc_bfreg(dev->mdev, &dev->wc_bfreg, true, false); + if (err) { + mlx5_free_bfreg(dev->mdev, &dev->fp_bfreg); + mlx5_free_bfreg(dev->mdev, &dev->bfreg); + } + + return err; +} + +static void mlx5_ib_stage_bfreg_cleanup(struct mlx5_ib_dev *dev) +{ + mlx5_free_bfreg(dev->mdev, &dev->wc_bfreg); + mlx5_free_bfreg(dev->mdev, &dev->fp_bfreg); + mlx5_free_bfreg(dev->mdev, &dev->bfreg); +} + static void *mlx5_ib_add(struct mlx5_core_dev *mdev) { struct mlx5_ib_dev *dev; @@ -3430,10 +3460,14 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if (err) goto err_odp; - err = ib_register_device(&dev->ib_dev, NULL); + err = mlx5_ib_stage_bfreg_init(dev); if (err) goto err_q_cnt; + err = ib_register_device(&dev->ib_dev, NULL); + if (err) + goto err_bfreg; + err = create_umr_res(dev); if (err) goto err_dev; @@ -3459,6 +3493,9 @@ err_umrc: err_dev: ib_unregister_device(&dev->ib_dev); +err_bfreg: + mlx5_ib_stage_bfreg_cleanup(dev); + err_q_cnt: mlx5_ib_dealloc_q_counters(dev); @@ -3491,6 +3528,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context) mlx5_ib_cleanup_congestion(dev); mlx5_remove_roce_notifier(dev); ib_unregister_device(&dev->ib_dev); + mlx5_ib_stage_bfreg_cleanup(dev); mlx5_ib_dealloc_q_counters(dev); destroy_umrc_res(dev); mlx5_ib_odp_remove_one(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101141047.10EAlF2u056481>