Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/irdma: Introduce GEN3 vPort driver support

In the IPU model, a function can host one or more logical network
endpoints called vPorts. Each vPort may be associated with either a
physical or an internal communication port, and can be RDMA capable. A
vPort features a netdev and, if RDMA capable, must have an associated
ib_dev.

This change introduces a GEN3 auxiliary vPort driver responsible for
registering a verbs device for every RDMA-capable vPort. Additionally,
the UAPI is updated to prevent the binding of GEN3 devices to older
user-space providers.

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Link: https://patch.msgid.link/20250827152545.2056-8-tatyana.e.nikolova@intel.com
Tested-by: Jacob Moroni <jmoroni@google.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Mustafa Ismail and committed by
Leon Romanovsky
2ad49ae7 da278cb2

+132 -1
+120
drivers/infiniband/hw/irdma/main.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB 2 2 /* Copyright (c) 2015 - 2021 Intel Corporation */ 3 3 #include "main.h" 4 + #include <linux/net/intel/iidc_rdma_idpf.h> 4 5 5 6 MODULE_ALIAS("i40iw"); 6 7 MODULE_DESCRIPTION("Intel(R) Ethernet Protocol Driver for RDMA"); ··· 47 46 ibdev_warn(to_ibdev(dev), "MTU setting [%d] too low for RDMA traffic. Minimum MTU is 1280 for IPv6\\n", mtu); 48 47 } 49 48 49 + static void ig3rdma_idc_vport_event_handler(struct iidc_rdma_vport_dev_info *cdev_info, 50 + struct iidc_rdma_event *event) 51 + { 52 + struct irdma_device *iwdev = auxiliary_get_drvdata(cdev_info->adev); 53 + struct irdma_l2params l2params = {}; 54 + 55 + if (*event->type & BIT(IIDC_RDMA_EVENT_AFTER_MTU_CHANGE)) { 56 + ibdev_dbg(&iwdev->ibdev, "CLNT: new MTU = %d\n", iwdev->netdev->mtu); 57 + if (iwdev->vsi.mtu != iwdev->netdev->mtu) { 58 + l2params.mtu = iwdev->netdev->mtu; 59 + l2params.mtu_changed = true; 60 + irdma_log_invalid_mtu(l2params.mtu, &iwdev->rf->sc_dev); 61 + irdma_change_l2params(&iwdev->vsi, &l2params); 62 + } 63 + } 64 + } 65 + 66 + static int ig3rdma_vport_probe(struct auxiliary_device *aux_dev, 67 + const struct auxiliary_device_id *id) 68 + { 69 + struct iidc_rdma_vport_auxiliary_dev *idc_adev = 70 + container_of(aux_dev, struct iidc_rdma_vport_auxiliary_dev, adev); 71 + struct auxiliary_device *aux_core_dev = idc_adev->vdev_info->core_adev; 72 + struct irdma_pci_f *rf = auxiliary_get_drvdata(aux_core_dev); 73 + struct irdma_l2params l2params = {}; 74 + struct irdma_device *iwdev; 75 + int err; 76 + 77 + if (!rf) { 78 + WARN_ON_ONCE(1); 79 + return -ENOMEM; 80 + } 81 + iwdev = ib_alloc_device(irdma_device, ibdev); 82 + /* Fill iwdev info */ 83 + iwdev->is_vport = true; 84 + iwdev->rf = rf; 85 + iwdev->vport_id = idc_adev->vdev_info->vport_id; 86 + iwdev->netdev = idc_adev->vdev_info->netdev; 87 + iwdev->init_state = INITIAL_STATE; 88 + iwdev->roce_cwnd = IRDMA_ROCE_CWND_DEFAULT; 89 + iwdev->roce_ackcreds = IRDMA_ROCE_ACKCREDS_DEFAULT; 90 + iwdev->rcv_wnd = IRDMA_CM_DEFAULT_RCV_WND_SCALED; 91 + iwdev->rcv_wscale = IRDMA_CM_DEFAULT_RCV_WND_SCALE; 92 + iwdev->roce_mode = true; 93 + iwdev->push_mode = false; 94 + 95 + l2params.mtu = iwdev->netdev->mtu; 96 + 97 + err = irdma_rt_init_hw(iwdev, &l2params); 98 + if (err) 99 + goto err_rt_init; 100 + 101 + err = irdma_ib_register_device(iwdev); 102 + if (err) 103 + goto err_ibreg; 104 + 105 + auxiliary_set_drvdata(aux_dev, iwdev); 106 + 107 + ibdev_dbg(&iwdev->ibdev, 108 + "INIT: Gen[%d] vport[%d] probe success. dev_name = %s, core_dev_name = %s, netdev=%s\n", 109 + rf->rdma_ver, idc_adev->vdev_info->vport_id, 110 + dev_name(&aux_dev->dev), 111 + dev_name(&idc_adev->vdev_info->core_adev->dev), 112 + netdev_name(idc_adev->vdev_info->netdev)); 113 + 114 + return 0; 115 + err_ibreg: 116 + irdma_rt_deinit_hw(iwdev); 117 + err_rt_init: 118 + ib_dealloc_device(&iwdev->ibdev); 119 + 120 + return err; 121 + } 122 + 123 + static void ig3rdma_vport_remove(struct auxiliary_device *aux_dev) 124 + { 125 + struct iidc_rdma_vport_auxiliary_dev *idc_adev = 126 + container_of(aux_dev, struct iidc_rdma_vport_auxiliary_dev, adev); 127 + struct irdma_device *iwdev = auxiliary_get_drvdata(aux_dev); 128 + 129 + ibdev_dbg(&iwdev->ibdev, 130 + "INIT: Gen[%d] dev_name = %s, core_dev_name = %s, netdev=%s\n", 131 + iwdev->rf->rdma_ver, dev_name(&aux_dev->dev), 132 + dev_name(&idc_adev->vdev_info->core_adev->dev), 133 + netdev_name(idc_adev->vdev_info->netdev)); 134 + 135 + irdma_ib_unregister_device(iwdev); 136 + } 137 + 138 + static const struct auxiliary_device_id ig3rdma_vport_auxiliary_id_table[] = { 139 + {.name = "idpf.8086.rdma.vdev", }, 140 + {}, 141 + }; 142 + 143 + MODULE_DEVICE_TABLE(auxiliary, ig3rdma_vport_auxiliary_id_table); 144 + 145 + static struct iidc_rdma_vport_auxiliary_drv ig3rdma_vport_auxiliary_drv = { 146 + .adrv = { 147 + .name = "vdev", 148 + .id_table = ig3rdma_vport_auxiliary_id_table, 149 + .probe = ig3rdma_vport_probe, 150 + .remove = ig3rdma_vport_remove, 151 + }, 152 + .event_handler = ig3rdma_idc_vport_event_handler, 153 + }; 154 + 155 + 50 156 static int __init irdma_init_module(void) 51 157 { 52 158 int ret; ··· 182 74 183 75 return ret; 184 76 } 77 + 78 + ret = auxiliary_driver_register(&ig3rdma_vport_auxiliary_drv.adrv); 79 + if (ret) { 80 + auxiliary_driver_unregister(&ig3rdma_core_auxiliary_drv.adrv); 81 + auxiliary_driver_unregister(&icrdma_core_auxiliary_drv.adrv); 82 + auxiliary_driver_unregister(&i40iw_auxiliary_drv); 83 + pr_err("Failed ig3rdma vport auxiliary_driver_register() ret=%d\n", 84 + ret); 85 + 86 + return ret; 87 + } 185 88 irdma_register_notifiers(); 186 89 187 90 return 0; ··· 204 85 auxiliary_driver_unregister(&icrdma_core_auxiliary_drv.adrv); 205 86 auxiliary_driver_unregister(&i40iw_auxiliary_drv); 206 87 auxiliary_driver_unregister(&ig3rdma_core_auxiliary_drv.adrv); 88 + auxiliary_driver_unregister(&ig3rdma_vport_auxiliary_drv.adrv); 207 89 } 208 90 209 91 module_init(irdma_init_module);
+2
drivers/infiniband/hw/irdma/main.h
··· 354 354 u32 rcv_wnd; 355 355 u16 mac_ip_table_idx; 356 356 u16 vsi_num; 357 + u16 vport_id; 357 358 u8 rcv_wscale; 358 359 u8 iw_status; 359 360 bool roce_mode:1; 360 361 bool roce_dcqcn_en:1; 361 362 bool dcb_vlan_mode:1; 362 363 bool iw_ooo:1; 364 + bool is_vport:1; 363 365 enum init_completion_state init_state; 364 366 365 367 wait_queue_head_t suspend_wq;
+9 -1
drivers/infiniband/hw/irdma/verbs.c
··· 292 292 ucontext->iwdev = iwdev; 293 293 ucontext->abi_ver = req.userspace_ver; 294 294 295 + if (!(req.comp_mask & IRDMA_SUPPORT_WQE_FORMAT_V2) && 296 + uk_attrs->hw_rev >= IRDMA_GEN_3) 297 + return -EOPNOTSUPP; 298 + 295 299 if (req.comp_mask & IRDMA_ALLOC_UCTX_USE_RAW_ATTR) 296 300 ucontext->use_raw_attrs = true; 297 301 ··· 4895 4891 struct irdma_device *iwdev = to_iwdev(ibdev); 4896 4892 4897 4893 irdma_rt_deinit_hw(iwdev); 4898 - irdma_ctrl_deinit_hw(iwdev->rf); 4894 + if (!iwdev->is_vport) { 4895 + irdma_ctrl_deinit_hw(iwdev->rf); 4896 + if (iwdev->rf->vchnl_wq) 4897 + destroy_workqueue(iwdev->rf->vchnl_wq); 4898 + } 4899 4899 }
+1
include/uapi/rdma/irdma-abi.h
··· 25 25 enum { 26 26 IRDMA_ALLOC_UCTX_USE_RAW_ATTR = 1 << 0, 27 27 IRDMA_ALLOC_UCTX_MIN_HW_WQ_SIZE = 1 << 1, 28 + IRDMA_SUPPORT_WQE_FORMAT_V2 = 1 << 3, 28 29 }; 29 30 30 31 struct irdma_alloc_ucontext_req {