Commit Graph

45 Commits

Author SHA1 Message Date
Maxim Levitsky f445ac57f9 RDMA/mana_ib: Allocate PAGE aligned doorbell index
JIRA: https://issues.redhat.com/browse/RHEL-80098

commit 29b7bb98234cc287cebef9bccf638c2e3f39be71
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Feb 5 02:30:05 2025 -0800

    RDMA/mana_ib: Allocate PAGE aligned doorbell index

    Allocate a PAGE aligned doorbell index to ensure each process gets a
    separate PAGE sized doorbell area space remapped to it in mana_ib_mmap

    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Shiraz Saleem <shirazsaleem@microsoft.com>
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://patch.msgid.link/1738751405-15041-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>
2025-03-03 18:20:01 -05:00
Maxim Levitsky a0396af58c RDMA/mana_ib: use the correct page size for mapping user-mode doorbell page
JIRA: https://issues.redhat.com/browse/RHEL-80098

commit 4a3b99bc04e501b816db78f70064e26a01257910
Author: Long Li <longli@microsoft.com>
Date:   Fri Aug 30 08:16:33 2024 -0700

    RDMA/mana_ib: use the correct page size for mapping user-mode doorbell page

    When mapping doorbell page from user-mode, the driver should use the system
    page size as this memory is allocated via mmap() from user-mode.

    Cc: stable@vger.kernel.org
    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://patch.msgid.link/1725030993-16213-2-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2025-03-03 18:20:01 -05:00
Maxim Levitsky b3a1289e49 RDMA/mana_ib: use the correct page table index based on hardware page size
JIRA: https://issues.redhat.com/browse/RHEL-80098

commit 9e517a8e9d9a303bf9bde35e5c5374795544c152
Author: Long Li <longli@microsoft.com>
Date:   Fri Aug 30 08:16:32 2024 -0700

    RDMA/mana_ib: use the correct page table index based on hardware page size

    MANA hardware uses 4k page size. When calculating the page table index,
    it should use the hardware page size, not the system page size.

    Cc: stable@vger.kernel.org
    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://patch.msgid.link/1725030993-16213-1-git-send-email-longli@linuxonhyperv.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2025-03-03 18:20:01 -05:00
Kamal Heib 60620ca443 RDMA: Pass entire uverbs attr bundle to create cq function
JIRA: https://issues.redhat.com/browse/RHEL-56247
Conflicts:
Drop hunks for none existing drivers.

commit dd6d7f8574d7f8b6a0bf1aeef0b285d2706b8c2a
Author: Akiva Goldberger <agoldberger@nvidia.com>
Date:   Thu Jun 27 21:23:49 2024 +0300

    RDMA: Pass entire uverbs attr bundle to create cq function

    Changes the create_cq verb signature by sending the entire uverbs attr
    bundle as a parameter. This allows drivers to send driver specific attrs
    through ioctl for the create_cq verb and access them in their driver
    specific code.

    Also adds a new enum value for driver specific ioctl attributes for
    methods already supporting UHW.

    Link: https://lore.kernel.org/r/ed147343987c0d43fd391c1b2f85e2f425747387.1719512393.git.leon@kernel.org
    Signed-off-by: Akiva Goldberger <agoldberger@nvidia.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Signed-off-by: Kamal Heib <kheib@redhat.com>
2024-10-07 11:55:54 -04:00
Maxim Levitsky c65cfd5bec RDMA/mana_ib: Set correct device into ib
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 1df03a4b44146c4f720d793915747272c7773a3e
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Thu Jul 11 06:37:57 2024 -0700

    RDMA/mana_ib: Set correct device into ib

    Add mana_get_primary_netdev_rcu helper to get a primary
    netdevice for a given port. When mana is used with
    netvsc, the VF netdev is controlled by an upper netvsc
    device. In a baremetal case, the VF netdev is the
    primary device.

    Use the mana_get_primary_netdev_rcu() helper in the mana_ib
    to get the correct device for querying network states.

    Fixes: 8b184e4f1c32 ("RDMA/mana_ib: Enable RoCE on port 1")
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1720705077-322-1-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:04 +03:00
Maxim Levitsky 2b1f16b352 RDMA/mana_ib: Ignore optional access flags for MRs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 82a5cc783d49b86afd2f60e297ecd85223c39f88
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Jun 5 01:16:08 2024 -0700

    RDMA/mana_ib: Ignore optional access flags for MRs

    Ignore optional ib_access_flags when an MR is created.

    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/1717575368-14879-1-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-15 11:32:04 +03:00
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 8f5152914d RDMA/mana_ib: extend query device
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit c8683b995d8aba9d5b4e2368fedad83508882d84
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Thu May 30 04:55:17 2024 -0700

    RDMA/mana_ib: extend query device

    Fill in properties of the ib device.
    Order the assignment in the order of fields in the struct ib_device_attr.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1717070117-1234-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 11:32:03 +03:00
Maxim Levitsky bcafbf20e9 RDMA/mana_ib: set node_guid
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 65357e2c164a08bf20849dd55f46aa71e00334fa
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Thu May 30 04:55:16 2024 -0700

    RDMA/mana_ib: set node_guid

    Use the mac address for the node_guid of the IB device.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1717070117-1234-2-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 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 4fa733cdb0 RDMA/mana_ib: Create and destroy RC QP
JIRA: https://issues.redhat.com/browse/RHEL-54330

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

    RDMA/mana_ib: Create and destroy RC QP

    Implement HW requests to create and destroy an RC QP.
    An RC QP may have 5 queues.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1716366242-558-2-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 5ba19ee82c RDMA/mana_ib: implement uapi for creation of rnic cq
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 44b607ad4cdf23ae8f796b95bd14709fa06f7728
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Fri Apr 26 06:12:40 2024 -0700

    RDMA/mana_ib: implement uapi for creation of rnic cq

    Enable users to create RNIC CQs using a corresponding flag.
    With the previous request size, an ethernet CQ is created.
    As a response, return ID of the created CQ.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1714137160-5222-6-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:08:09 +03:00
Maxim Levitsky 6501addc59 RDMA/mana_ib: boundary check before installing cq callbacks
JIRA: https://issues.redhat.com/browse/RHEL-54330

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

    RDMA/mana_ib: boundary check before installing cq callbacks

    Add a boundary check inside mana_ib_install_cq_cb to prevent index overflow.

    Fixes: 2a31c5a7e0d8 ("RDMA/mana_ib: Introduce mana_ib_install_cq_cb helper function")
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1714137160-5222-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 01:06:40 +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 74dd9d3383 RDMA/mana_ib: create and destroy RNIC cqs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 5843415916852983d3aaddc87b57630af9b0adad
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Fri Apr 26 06:12:37 2024 -0700

    RDMA/mana_ib: create and destroy RNIC cqs

    Implement RNIC requests for creation and destruction of RNIC CQs.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1714137160-5222-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 01:06:39 +03:00
Maxim Levitsky c944a99b76 RDMA/mana_ib: create EQs for RNIC CQs
JIRA: https://issues.redhat.com/browse/RHEL-54330

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

    RDMA/mana_ib: create EQs for RNIC CQs

    Create EQs within mana_ib device. Such EQs are required
    for creation of RNIC CQs.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1714137160-5222-2-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 7fdd36ea29 RDMA/mana_ib: Fix missing ret value
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit f88320b698ad099a2f742adfb9f87177bfffe0c5
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Tue Apr 23 07:15:51 2024 -0700

    RDMA/mana_ib: Fix missing ret value

    Set ret to -ENODEV when netdev_master_upper_dev_get_rcu returns NULL.

    Fixes: 8b184e4f1c32 ("RDMA/mana_ib: Enable RoCE on port 1")
    Link: https://lore.kernel.org/r/1713881751-21621-1-git-send-email-kotaranov@linux.microsoft.com
    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 01:06:39 +03:00
Maxim Levitsky e7ccf6d3e0 RDMA/mana_ib: Configure mac address in RNIC
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 8859f009ace237ffc165c95edcc113d3824b9bf3
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:31 2024 -0700

    RDMA/mana_ib: Configure mac address in RNIC

    Set local mac address in RNIC, which is required by the HW.

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

Conflicts:
    include the etherdevice.h explicitly

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
2024-08-15 01:06:04 +03:00
Maxim Levitsky 65f627d265 RDMA/mana_ib: Adding and deleting GIDs
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit faafb8b126ad6043663a77e6b234bca932f60694
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:30 2024 -0700

    RDMA/mana_ib: Adding and deleting GIDs

    Implement add_gid and del_gid for RNIC.
    IPv4 and IPv6 addresses are supported.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712738551-22075-6-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-15 00:40:08 +03:00
Maxim Levitsky 14b7db4020 RDMA/mana_ib: Enable RoCE on port 1
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 8b184e4f1c328d9b37994f66224550befdefe49b
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:29 2024 -0700

    RDMA/mana_ib: Enable RoCE on port 1

    Set netdev and RoCEv2 flag to enable GID population on port 1.
    Use GIDs of the master netdev. As mc->ports[] stores slave devices,
    use a helper to get the master netdev.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712738551-22075-5-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-15 00:40:08 +03:00
Maxim Levitsky 82f5c55cd3 RDMA/mana_ib: Implement port parameters
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 4bda1d5332ec1b00262ad53f6a4cfa88190a048d
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:28 2024 -0700

    RDMA/mana_ib: Implement port parameters

    Implement port parameters for RNIC:
    1) extend query_port() method
    2) implement get_link_layer()
    3) implement query_pkey()

    Only port 1 can store GIDs.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712738551-22075-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-15 00:40:08 +03:00
Maxim Levitsky 4d2d230764 RDMA/mana_ib: Create and destroy rnic adapter
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 1a79c2b9d4a08788cf1554981f10d23fbad77d11
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:27 2024 -0700

    RDMA/mana_ib: Create and destroy rnic adapter

    Add functions for RNIC creation and destruction.
    If creation fails, the ib_probe fails as well.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712738551-22075-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-15 00:40:08 +03:00
Maxim Levitsky b402d36f58 RDMA/mana_ib: Add EQ creation for rnic adapter
JIRA: https://issues.redhat.com/browse/RHEL-54330

commit 98b889c43935c43ad15783dbfb1e59b4ee7f4a56
Author: Konstantin Taranov <kotaranov@microsoft.com>
Date:   Wed Apr 10 01:42:26 2024 -0700

    RDMA/mana_ib: Add EQ creation for rnic adapter

    Create an error EQ for the RNIC adapter.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1712738551-22075-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-15 00:40:08 +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 0b6cf8d492 RDMA/mana_ib: Introduce helpers to create and destroy mana queues
JIRA: https://issues.redhat.com/browse/RHEL-54330

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

    RDMA/mana_ib: Introduce helpers to create and destroy mana queues

    Intoduce helpers to work with mana ib queues (struct mana_ib_queue).
    A queue always consists of umem, gdma_region, and id.
    A queue can become a WQ or a CQ.

    Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
    Link: https://lore.kernel.org/r/1711483688-24358-2-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 da068a8ef1 RDMA/mana_ib: Fix bug in creation of dma regions
JIRA: https://issues.redhat.com/browse/RHEL-54330

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

    RDMA/mana_ib: Fix bug in creation of dma regions

    Use ib_umem_dma_offset() helper to calculate correct dma offset.

    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-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-15 00:40:05 +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 7b017271c1 RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet
Bugzilla: https://bugzilla.redhat.com/2189296

commit 89d42b8c85b4c67d310c5ccaf491acbf71a260c3
Author: Long Li <longli@microsoft.com>
Date:   Wed Feb 15 16:32:02 2023 -0800

    RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet

    When registering memory in a large chunk that doesn't fit into a single PF
    message, the PF may return GDMA_STATUS_MORE_ENTRIES on the first message if
    there are more messages needed for registering more chunks.

    Fix the VF to make it process the correct return code.

    Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter")
    Link: https://lore.kernel.org/r/1676507522-21018-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: Kamal Heib <kheib@redhat.com>
2023-05-08 08:20:26 -04: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 877207401e RDMA/mana: Remove redefinition of basic u64 type
Bugzilla: https://bugzilla.redhat.com/2189296

commit 3574cfdca28543e2e8db649297cd6659ea8e4bb8
Author: Leon Romanovsky <leon@kernel.org>
Date:   Fri Nov 11 11:55:29 2022 +0200

    RDMA/mana: Remove redefinition of basic u64 type

    gdma_obj_handle_t is no more than redefinition of basic
    u64 type. Remove such obfuscation.

    Link: https://lore.kernel.org/r/3c1e821279e6a165d058655d2343722d6650e776.1668160486.git.leonro@nvidia.com
    Acked-by: Long Li <longli@microsoft.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

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