The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cafc8b1c41b0898b8f9b01288736aaaa6dc5dddc

commit cafc8b1c41b0898b8f9b01288736aaaa6dc5dddc
Author:     Vag Singh <[email protected]>
AuthorDate: 2025-08-14 06:07:53 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-09-16 14:12:07 +0000

    mlx5ib: Avoid system crash when enabling many VFs
    
    [PATCH 12/31] FreeBSD OFED support for DPDK MLX5 PMD
    
    a) When enabling many VFs, the total amount of DMA mappings increase
    significantly. This causes DMA allocations to take a lot of time
    since they are serialized in the kernel.
    
    As a result the driver enters into fatal condition due to
    timeout and the system hangs. To recover from this we disable
    MR cache for VFs. This also resolves Rx-Error MLX5 PMD issue.
    
    PFs will still have a full cache and VFs cache can be manipulated
    as usual after driver load.
    
    b) The fast_registration length is used to convey length for memory
    registrations through UMR which can be of any size up to 2^64.
    Change the length type to be u64.
    
    Differential revision:  https://reviews.freebsd.org/D32186
    MFC after:      1 month
---
 sys/dev/mlx5/mlx5_ib/mlx5_ib.h    | 2 +-
 sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
index 1b4ace772c26..b869fcb96d49 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
@@ -465,7 +465,7 @@ struct mlx5_umr_wr {
        struct ib_pd                   *pd;
        unsigned int                    page_shift;
        unsigned int                    npages;
-       u32                             length;
+       u64                             length;
        int                             access_flags;
        u32                             mkey;
 };
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c 
b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c
index d28ecb4a1761..ae979d2fb7a2 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c
@@ -443,7 +443,8 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev)
                ent->order = i + 2;
                ent->dev = dev;
 
-               if (dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE)
+               if ((dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE) &&
+                   (mlx5_core_is_pf(dev->mdev)))
                        limit = dev->mdev->profile->mr_cache[i].limit;
                else
                        limit = 0;
@@ -682,7 +683,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct 
ib_umem *umem,
 
        for (i = 0; i < 1; i++) {
                mr = alloc_cached_mr(dev, order);
-               if (mr)
+               if (mr || !mlx5_core_is_pf(dev->mdev))
                        break;
 
                err = add_keys(dev, order2idx(dev, order), 1);

Reply via email to