44b607ad | 26-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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 o
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>
show more ...
|
f79edef7 | 26-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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_instal
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>
show more ...
|
3e411052 | 26-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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 <kotar
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>
show more ...
|
58434159 | 26-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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
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>
show more ...
|
8859f009 | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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/1
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>
show more ...
|
faafb8b1 | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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.
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>
show more ...
|
8b184e4f | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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
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>
show more ...
|
4bda1d53 | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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
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>
show more ...
|
1a79c2b9 | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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.
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>
show more ...
|
98b889c4 | 10-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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-
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>
show more ...
|
23f59f4e | 12-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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> Lin
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>
show more ...
|
c8fc935f | 09-Apr-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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.ke
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>
show more ...
|
e537deec | 11-Apr-2024 |
Leon Romanovsky <leon@kernel.org> |
RDMA/mana_ib: Add flex array to struct mana_cfg_rx_steer_req_v2
The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of trailing elements. Specifically, it uses a "mana_handle_t" array
RDMA/mana_ib: Add flex array to struct mana_cfg_rx_steer_req_v2
The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of trailing elements. Specifically, it uses a "mana_handle_t" array. So, use the preferred way in the kernel declaring a flexible array [1].
At the same time, prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions).
Also, avoid the open-coded arithmetic in the memory allocator functions [2] using the "struct_size" macro.
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.
Now, it is also possible to use the "flex_array_size" helper to compute the size of these trailing elements in the "memcpy" function.
Specifically, the first commit adds the flex member and the patches 2 and 3 refactor the consumers of the "struct mana_cfg_rx_steer_req_v2".
This code was detected with the help of Coccinelle, and audited and modified manually. The Coccinelle script used to detect this code pattern is the following:
virtual report
@rule1@ type t1; type t2; identifier i0; identifier i1; identifier i2; identifier ALLOC =~ "kmalloc|kzalloc|kmalloc_node|kzalloc_node|vmalloc|vzalloc|kvmalloc|kvzalloc"; position p1; @@
i0 = sizeof(t1) + sizeof(t2) * i1; ... i2 = ALLOC@p1(..., i0, ...);
@script:python depends on report@ p1 << rule1.p1; @@
msg = "WARNING: verify allocation on line %s" % (p1[0].line) coccilib.report.print_report(p1[0],msg)
[1] https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays [2] https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Link: https://lore.kernel.org/all/AS8PR02MB72374BD1B23728F2E3C3B1A18B022@AS8PR02MB7237.eurprd02.prod.outlook.com Signed-off-by: Erick Archer <erick.archer@outlook.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
* mana-ib-flex: net: mana: Avoid open coded arithmetic RDMA/mana_ib: Prefer struct_size over open coded arithmetic net: mana: Add flex array to struct mana_cfg_rx_steer_req_v2
show more ...
|
f10242b3 | 26-Mar-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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/1
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>
show more ...
|
688bac28 | 26-Mar-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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/171148368
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>
show more ...
|
60a7ac0b | 26-Mar-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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/171148368
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>
show more ...
|
2d5c0081 | 04-Mar-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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
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>
show more ...
|
2a31c5a7 | 23-Jan-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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@mic
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>
show more ...
|
3b73eb3a | 23-Jan-2024 |
Konstantin Taranov <kotaranov@microsoft.com> |
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
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>
show more ...
|