Commit Graph

21 Commits

Author SHA1 Message Date
Maxim Levitsky 1201fa45ef net: mana: Allow variable size indirection table
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 7fc45cb68696c7213c484ec81892bc8a986fde52
Author: Shradha Gupta <shradhagupta@linux.microsoft.com>
Date:   Mon Jun 10 03:28:39 2024 -0700

    net: mana: Allow variable size indirection table

    Allow variable size indirection table allocation in MANA instead
    of using a constant value MANA_INDIRECT_TABLE_SIZE.
    The size is now derived from the MANA_QUERY_VPORT_CONFIG and the
    indirection table is allocated dynamically.

    Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
    Link: https://lore.kernel.org/r/1718015319-9609-1-git-send-email-shradhagupta@linux.microsoft.com
    Reviewed-by: Dexuan Cui <decui@microsoft.com>
    Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 11:32:03 +03:00
Maxim Levitsky 3ba4167410 RDMA/mana_ib: Process QP error events in mana_ib
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 2a1251e3dbb2995100b6f351c2452228895386a5
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Fri Jun 7 03:08:17 2024 -0700

    RDMA/mana_ib: Process QP error events in mana_ib

    Process QP fatal events from the error event queue.
    For that, find the QP, using QPN from the event, and then call its
    event_handler. To find the QPs, store created RC QPs in an xarray.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1717754897-19858-1-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Wei Hu <weh@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 11:32:03 +03:00
Maxim Levitsky 42169f49d7 RDMA/mana_ib: Modify QP state
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit e095405b45bbbdcf521c63b4207071e5b32df671
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed May 22 01:24:02 2024 -0700

    RDMA/mana_ib: Modify QP state

    Implement modify QP state for RC QPs.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1716366242-558-4-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 11:32:02 +03:00
Maxim Levitsky dc95de3177 RDMA/mana_ib: Implement uapi to create and destroy RC QP
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit fdefb918496235a11d6c5477c34c81aab2c1343b
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed May 22 01:24:01 2024 -0700

    RDMA/mana_ib: Implement uapi to create and destroy RC QP

    Implement user requests to create and destroy an RC QP.
    As the user does not have an FMR queue, it is skipped and NO_FMR flag
    is used.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1716366242-558-3-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 11:32:02 +03:00
Maxim Levitsky adbb1c3d0f RDMA/mana_ib: introduce a helper to remove cq callbacks
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 3e41105263d5d74840c0d117278894b428f02841
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Fri Apr 26 06:12:38 2024 -0700

    RDMA/mana_ib: introduce a helper to remove cq callbacks

    Intoduce the mana_ib_remove_cq_cb helper to remove cq callbacks.
    The helper removes code duplicates.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1714137160-5222-4-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 01:06:39 +03:00
Maxim Levitsky 5e5abb1d01 RDMA/mana_ib: Use num_comp_vectors of ib_device
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 23f59f4e837bba9db8d25ae85b8455d53b23665b
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Fri Apr 12 01:47:36 2024 -0700

    RDMA/mana_ib: Use num_comp_vectors of ib_device

    Use num_comp_vectors of struct ib_device instead of max_num_queues
    from gdma_context.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712911656-17352-1-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:07 +03:00
Maxim Levitsky db4da1109c RDMA/mana_ib: remove useless return values from dbg prints
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit c8fc935f4b198dc6e9871b29f4f3360631d90c8e
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Tue Apr 9 07:21:05 2024 -0700

    RDMA/mana_ib: remove useless return values from dbg prints

    Remove printing ret value on success as it was always 0.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712672465-29960-1-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:07 +03:00
Maxim Levitsky d238b4d893 RDMA/mana_ib: Prefer struct_size over open coded arithmetic
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 29b8e13a8b4c95ce629c8d4c84682f29af6f6bb5
Author: Erick Archer <erick.archer@outlook.com>
Date:   Sat Apr 6 16:23:36 2024 +0200

    RDMA/mana_ib: Prefer struct_size over open coded arithmetic

    This is an effort to get rid of all multiplications from allocation
    functions in order to prevent integer overflows [1][2].

    As the "req" variable is a pointer to "struct mana_cfg_rx_steer_req_v2"
    and this structure ends in a flexible array:

    struct mana_cfg_rx_steer_req_v2 {
            [...]
            mana_handle_t indir_tab[] __counted_by(num_indir_entries);
    };

    the preferred way in the kernel is to use the struct_size() helper to
    do the arithmetic instead of the calculation "size + size * count" in
    the kzalloc() function.

    Moreover, use the "offsetof" helper to get the indirect table offset
    instead of the "sizeof" operator and avoid the open-coded arithmetic in
    pointers using the new flex member. This new structure member also allow
    us to remove the "req_indir_tab" variable since it is no longer needed.

    This way, the code is more readable and safer.

    This code was detected with the help of Coccinelle, and audited and
    modified manually.

    Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
    Link: https://github.com/KSPP/linux/issues/160 [2]
    Signed-off-by: Erick Archer <erick.archer@outlook.com>
    Link: https://lore.kernel.org/r/AS8PR02MB72375EB06EE1A84A67BE722E8B022@AS8PR02MB7237.eurprd02.prod.outlook.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Reviewed-by: Justin Stitt <justinstitt@google.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:07 +03:00
Maxim Levitsky 5c7e052a3d RDMA/mana_ib: Use struct mana_ib_queue for RAW QPs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit f10242b3da908dc9d4bfa040e6511a5b86522499
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Tue Mar 26 13:08:08 2024 -0700

    RDMA/mana_ib: Use struct mana_ib_queue for RAW QPs

    Use struct mana_ib_queue and its helpers for RAW QPs

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1711483688-24358-5-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:06 +03:00
Maxim Levitsky f082d6bd3b RDMA/mana_ib: Use struct mana_ib_queue for WQs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 688bac28e3dc9eb795ae8ea5aa40cb637e289faa
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Tue Mar 26 13:08:07 2024 -0700

    RDMA/mana_ib: Use struct mana_ib_queue for WQs

    Use struct mana_ib_queue and its helpers for WQs

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1711483688-24358-4-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:06 +03:00
Maxim Levitsky 4a250e0ffc RDMA/mana_ib: Use struct mana_ib_queue for CQs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 60a7ac0b8bec5df9764b7460ffee91fc981e8a31
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Tue Mar 26 13:08:06 2024 -0700

    RDMA/mana_ib: Use struct mana_ib_queue for CQs

    Use struct mana_ib_queue and its helpers for CQs

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1711483688-24358-3-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:06 +03:00
Maxim Levitsky 6e0dc975a5 RDMA/mana_ib: Use virtual address in dma regions for MRs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 2d5c00815778ec4f4e0a84e405e3e157b7815db1
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Mon Mar 4 05:52:41 2024 -0800

    RDMA/mana_ib: Use virtual address in dma regions for MRs

    Introduce mana_ib_create_dma_region() to create dma regions with iova
    for MRs. It allows creating MRs with any page offset. Previously,
    only page-aligned addresses worked.

    For dma regions that must have a zero dma offset (e.g., for queues),
    mana_ib_create_zero_offset_dma_region() is added.
    To get the zero offset, ib_umem_find_best_pgoff() is used with zero
    pgoff_bitmask.

    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1709560361-26393-3-git-send-email-kotaranov@linux.microsoft.com
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 00:40:06 +03:00
Maxim Levitsky 90fd9f0d9b RDMA/mana_ib: Introduce mana_ib_install_cq_cb helper function
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 2a31c5a7e0d87959a03e846523013c75f4395a91
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Mon Jan 22 15:23:01 2024 -0800

    RDMA/mana_ib: Introduce mana_ib_install_cq_cb helper function

    Use a helper function to install callbacks to CQs.
    This patch removes code repetition.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1705965781-3235-4-git-send-email-kotaranov@linux.microsoft.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-14 21:04:39 +03:00
Maxim Levitsky 0a1b33959d RDMA/mana_ib: Introduce mana_ib_get_netdev helper function
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 3b73eb3a4acdf563de49d825968bb5f10300acd4
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Mon Jan 22 15:23:00 2024 -0800

    RDMA/mana_ib: Introduce mana_ib_get_netdev helper function

    Use a helper function to access netdevs using a port number.
    This patch removes code repetitions as well as removes the need
    to explicitly use gdma_dev, which was error-prone.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1705965781-3235-3-git-send-email-kotaranov@linux.microsoft.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-14 21:04:34 +03:00
Maxim Levitsky aedb3e6895 RDMA/mana_ib: Introduce mdev_to_gc helper function
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 71c8cbfcdc8f1dc651b976d4c12dc9b9fce675c1
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Mon Jan 22 15:22:59 2024 -0800

    RDMA/mana_ib: Introduce mdev_to_gc helper function

    Use a helper function to access gdma_context from mana_ib_dev.
    This patch removes code repetitions as well as removes the need
    to explicitly use gdma_dev, which was error-prone.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1705965781-3235-2-git-send-email-kotaranov@linux.microsoft.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-14 21:04:28 +03:00
Maxim Levitsky 8d4d5d2000 RDMA/mana_ib: Add CQ interrupt support for RAW QP
JIRA: https://issues.redhat.com/browse/RHEL-23420

commit c15d7802a42402a87880a17eee89ff023e49ecc0
Author: Long Li <longli@microsoft.com>
Date:   Fri Dec 15 18:04:15 2023 -0800

    RDMA/mana_ib: Add CQ interrupt support for RAW QP

    At probing time, the MANA core code allocates EQs for supporting interrupts
    on Ethernet queues. The same interrupt mechanisum is used by RAW QP.

    Use the same EQs for delivering interrupts on the CQ for the RAW QP.

    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://lore.kernel.org/r/1702692255-23640-4-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-01-31 18:38:08 -05:00
Maxim Levitsky bd3e849591 RDMA/mana_ib: query device capabilities
JIRA: https://issues.redhat.com/browse/RHEL-23420

commit 2c20e20b22d9fc64072e3445ae3ca244cbd523a2
Author: Long Li <longli@microsoft.com>
Date:   Fri Dec 15 18:04:14 2023 -0800

    RDMA/mana_ib: query device capabilities

    With RDMA device registered, use it to query on hardware capabilities and
    cache this information for future query requests to the driver.

    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://lore.kernel.org/r/1702692255-23640-3-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-01-31 18:38:02 -05:00
Maxim Levitsky 7b9f3e7e80 RDMA/mana_ib: register RDMA device with GDMA
JIRA: https://issues.redhat.com/browse/RHEL-23420

commit a7f0636d223ca9d074eb5b4ae71425e082c5c1e1
Author: Long Li <longli@microsoft.com>
Date:   Fri Dec 15 18:04:13 2023 -0800

    RDMA/mana_ib: register RDMA device with GDMA

    Software client needs to register with the RDMA management interface on
    the SoC to access more features, including querying device capabilities
    and RC queue pair.

    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://lore.kernel.org/r/1702692255-23640-2-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-01-30 20:38:24 -05:00
Maxim Levitsky 795137e1ab RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing
JIRA: https://issues.redhat.com/browse/RHEL-23420

commit 2145328515c8fa9b8a9f7889250bc6c032f2a0e6
Author: Long Li <longli@microsoft.com>
Date:   Sat May 13 23:18:15 2023 -0700

    RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing

    With RX coalescing, one CQE entry can be used to indicate multiple packets
    on the receive queue. This saves processing time and PCI bandwidth over
    the CQ.

    The MANA Ethernet driver also uses the v2 version of the protocol. It
    doesn't use RX coalescing and its behavior is not changed.

    Link: https://lore.kernel.org/r/1684045095-31228-1-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Long Li <longli@microsoft.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-01-30 20:37:56 -05:00
Kamal Heib 045ea404c9 RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()
Bugzilla: https://bugzilla.redhat.com/2189296

commit 563ca0e9eab8acc8a1309e8b440108ff8d23e951
Author: Dan Carpenter <error27@gmail.com>
Date:   Tue Jan 24 18:20:54 2023 +0300

    RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()

    The "port" comes from the user and if it is zero then the:

            ndev = mc->ports[port - 1];

    assignment does an out of bounds read.  I have changed the if
    statement to fix this and to mirror how it is done in
    mana_ib_create_qp_rss().

    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Link: https://lore.kernel.org/r/Y8/3Vn8qx00kE9Kk@kili
    Acked-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Kamal Heib <kheib@redhat.com>
2023-05-08 08:20:26 -04:00
Kamal Heib cba7f40b30 RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter
Bugzilla: https://bugzilla.redhat.com/2189296
Conflicts:
- ib_user_ioctl_verbs.h: Context diff due to the missing of erdma,
  Added reservations to keep UAPI compatible with upstream.
- MAINTAINERS: Context diff due to the unupdated file.

commit 0266a177631d4c6b963b5b12dd986a8c5abdbf06
Author: Long Li <longli@microsoft.com>
Date:   Thu Nov 3 12:16:30 2022 -0700

    RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

    Add a RDMA VF driver for Microsoft Azure Network Adapter (MANA).

    Co-developed-by: Ajay Sharma <sharmaajay@microsoft.com>
    Signed-off-by: Ajay Sharma <sharmaajay@microsoft.com>
    Reviewed-by: Dexuan Cui <decui@microsoft.com>
    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://lore.kernel.org/r/1667502990-2559-13-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Kamal Heib <kheib@redhat.com>
2023-05-08 08:20:25 -04:00