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.

iidc/ice/irdma: Update IDC to support multiple consumers

In preparation of supporting more than a single core PCI driver
for RDMA, move ice specific structs like qset_params, qos_info
and qos_params from iidc_rdma.h to iidc_rdma_ice.h.

Previously, the ice driver was just exporting its entire PF struct
to the auxiliary driver, but since each core driver will have its own
different PF struct, implement a universal struct that all core drivers
can provide to the auxiliary driver through the probe call.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Co-developed-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Co-developed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Co-developed-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

authored by

Dave Ertman and committed by
Tony Nguyen
c24a65b6 8239b771

+353 -205
+53 -49
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 "../../../net/ethernet/intel/ice/ice.h" 5 4 6 5 MODULE_ALIAS("i40iw"); 7 - MODULE_AUTHOR("Intel Corporation, <e1000-rdma@lists.sourceforge.net>"); 8 6 MODULE_DESCRIPTION("Intel(R) Ethernet Protocol Driver for RDMA"); 9 7 MODULE_LICENSE("Dual BSD/GPL"); 10 8 ··· 83 85 } 84 86 } 85 87 86 - static void irdma_iidc_event_handler(struct ice_pf *pf, struct iidc_rdma_event *event) 88 + static void irdma_iidc_event_handler(struct iidc_rdma_core_dev_info *cdev_info, 89 + struct iidc_rdma_event *event) 87 90 { 88 - struct irdma_device *iwdev = dev_get_drvdata(&pf->adev->dev); 91 + struct irdma_device *iwdev = dev_get_drvdata(&cdev_info->adev->dev); 89 92 struct irdma_l2params l2params = {}; 90 93 91 94 if (*event->type & BIT(IIDC_RDMA_EVENT_AFTER_MTU_CHANGE)) { ··· 103 104 104 105 irdma_prep_tc_change(iwdev); 105 106 } else if (*event->type & BIT(IIDC_RDMA_EVENT_AFTER_TC_CHANGE)) { 106 - struct iidc_rdma_qos_params qos_info = {}; 107 + struct iidc_rdma_priv_dev_info *iidc_priv = cdev_info->iidc_priv; 107 108 108 109 if (!iwdev->vsi.tc_change_pending) 109 110 return; 110 111 111 112 l2params.tc_changed = true; 112 113 ibdev_dbg(&iwdev->ibdev, "CLNT: TC Change\n"); 113 - ice_get_qos_params(pf, &qos_info); 114 - irdma_fill_qos_info(&l2params, &qos_info); 114 + 115 + irdma_fill_qos_info(&l2params, &iidc_priv->qos_info); 115 116 if (iwdev->rf->protocol_used != IRDMA_IWARP_PROTOCOL_ONLY) 116 - iwdev->dcb_vlan_mode = qos_info.num_tc > 1 && !l2params.dscp_mode; 117 + iwdev->dcb_vlan_mode = 118 + l2params.num_tc > 1 && !l2params.dscp_mode; 117 119 irdma_change_l2params(&iwdev->vsi, &l2params); 118 120 } else if (*event->type & BIT(IIDC_RDMA_EVENT_CRIT_ERR)) { 119 121 ibdev_warn(&iwdev->ibdev, "ICE OICR event notification: oicr = 0x%08x\n", ··· 151 151 */ 152 152 static void irdma_request_reset(struct irdma_pci_f *rf) 153 153 { 154 - struct ice_pf *pf = rf->cdev; 155 - 156 154 ibdev_warn(&rf->iwdev->ibdev, "Requesting a reset\n"); 157 - ice_rdma_request_reset(pf, IIDC_PFR); 155 + ice_rdma_request_reset(rf->cdev, IIDC_FUNC_RESET); 158 156 } 159 157 160 158 /** ··· 164 166 struct irdma_ws_node *tc_node) 165 167 { 166 168 struct irdma_device *iwdev = vsi->back_vsi; 167 - struct ice_pf *pf = iwdev->rf->cdev; 169 + struct iidc_rdma_core_dev_info *cdev_info; 168 170 struct iidc_rdma_qset_params qset = {}; 169 171 int ret; 170 172 173 + cdev_info = iwdev->rf->cdev; 171 174 qset.qs_handle = tc_node->qs_handle; 172 175 qset.tc = tc_node->traffic_class; 173 176 qset.vport_id = vsi->vsi_idx; 174 - ret = ice_add_rdma_qset(pf, &qset); 177 + ret = ice_add_rdma_qset(cdev_info, &qset); 175 178 if (ret) { 176 179 ibdev_dbg(&iwdev->ibdev, "WS: LAN alloc_res for rdma qset failed.\n"); 177 180 return ret; ··· 193 194 struct irdma_ws_node *tc_node) 194 195 { 195 196 struct irdma_device *iwdev = vsi->back_vsi; 196 - struct ice_pf *pf = iwdev->rf->cdev; 197 + struct iidc_rdma_core_dev_info *cdev_info; 197 198 struct iidc_rdma_qset_params qset = {}; 198 199 200 + cdev_info = iwdev->rf->cdev; 199 201 qset.qs_handle = tc_node->qs_handle; 200 202 qset.tc = tc_node->traffic_class; 201 203 qset.vport_id = vsi->vsi_idx; 202 204 qset.teid = tc_node->l2_sched_node_id; 203 205 204 - if (ice_del_rdma_qset(pf, &qset)) 206 + if (ice_del_rdma_qset(cdev_info, &qset)) 205 207 ibdev_dbg(&iwdev->ibdev, "WS: LAN free_res for rdma qset failed.\n"); 206 208 } 207 209 208 - static int irdma_init_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf) 210 + static int irdma_init_interrupts(struct irdma_pci_f *rf, struct iidc_rdma_core_dev_info *cdev) 209 211 { 210 212 int i; 211 213 ··· 217 217 return -ENOMEM; 218 218 219 219 for (i = 0; i < rf->msix_count; i++) 220 - if (ice_alloc_rdma_qvector(pf, &rf->msix_entries[i])) 220 + if (ice_alloc_rdma_qvector(cdev, &rf->msix_entries[i])) 221 221 break; 222 222 223 223 if (i < IRDMA_MIN_MSIX) { 224 224 for (; i > 0; i--) 225 - ice_free_rdma_qvector(pf, &rf->msix_entries[i]); 225 + ice_free_rdma_qvector(cdev, &rf->msix_entries[i]); 226 226 227 227 kfree(rf->msix_entries); 228 228 return -ENOMEM; ··· 233 233 return 0; 234 234 } 235 235 236 - static void irdma_deinit_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf) 236 + static void irdma_deinit_interrupts(struct irdma_pci_f *rf, struct iidc_rdma_core_dev_info *cdev) 237 237 { 238 238 int i; 239 239 240 240 for (i = 0; i < rf->msix_count; i++) 241 - ice_free_rdma_qvector(pf, &rf->msix_entries[i]); 241 + ice_free_rdma_qvector(cdev, &rf->msix_entries[i]); 242 242 243 243 kfree(rf->msix_entries); 244 244 } ··· 247 247 { 248 248 struct irdma_device *iwdev = auxiliary_get_drvdata(aux_dev); 249 249 struct iidc_rdma_core_auxiliary_dev *iidc_adev; 250 - struct ice_pf *pf; 250 + struct iidc_rdma_core_dev_info *cdev_info; 251 251 252 252 iidc_adev = container_of(aux_dev, struct iidc_rdma_core_auxiliary_dev, adev); 253 - pf = iidc_adev->pf; 253 + cdev_info = iidc_adev->cdev_info; 254 254 255 + ice_rdma_update_vsi_filter(cdev_info, iwdev->vsi_num, false); 255 256 irdma_ib_unregister_device(iwdev); 256 - ice_rdma_update_vsi_filter(pf, iwdev->vsi_num, false); 257 - irdma_deinit_interrupts(iwdev->rf, pf); 257 + irdma_deinit_interrupts(iwdev->rf, cdev_info); 258 258 259 - pr_debug("INIT: Gen2 PF[%d] device remove success\n", PCI_FUNC(pf->pdev->devfn)); 259 + pr_debug("INIT: Gen2 PF[%d] device remove success\n", PCI_FUNC(cdev_info->pdev->devfn)); 260 260 } 261 261 262 - static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf, 263 - struct ice_vsi *vsi) 262 + static void irdma_fill_device_info(struct irdma_device *iwdev, 263 + struct iidc_rdma_core_dev_info *cdev_info) 264 264 { 265 + struct iidc_rdma_priv_dev_info *iidc_priv = cdev_info->iidc_priv; 265 266 struct irdma_pci_f *rf = iwdev->rf; 266 267 267 - rf->cdev = pf; 268 + rf->sc_dev.hw = &rf->hw; 269 + rf->iwdev = iwdev; 270 + rf->cdev = cdev_info; 271 + rf->hw.hw_addr = iidc_priv->hw_addr; 272 + rf->pcidev = cdev_info->pdev; 273 + rf->hw.device = &rf->pcidev->dev; 274 + rf->pf_id = iidc_priv->pf_id; 268 275 rf->gen_ops.register_qset = irdma_lan_register_qset; 269 276 rf->gen_ops.unregister_qset = irdma_lan_unregister_qset; 270 - rf->hw.hw_addr = pf->hw.hw_addr; 271 - rf->pcidev = pf->pdev; 272 - rf->pf_id = pf->hw.pf_id; 273 - rf->default_vsi.vsi_idx = vsi->vsi_num; 274 - rf->protocol_used = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? 275 - IRDMA_ROCE_PROTOCOL_ONLY : IRDMA_IWARP_PROTOCOL_ONLY; 277 + 278 + rf->default_vsi.vsi_idx = iidc_priv->vport_id; 279 + rf->protocol_used = 280 + cdev_info->rdma_protocol == IIDC_RDMA_PROTOCOL_ROCEV2 ? 281 + IRDMA_ROCE_PROTOCOL_ONLY : IRDMA_IWARP_PROTOCOL_ONLY; 276 282 rf->rdma_ver = IRDMA_GEN_2; 277 283 rf->rsrc_profile = IRDMA_HMC_PROFILE_DEFAULT; 278 284 rf->rst_to = IRDMA_RST_TIMEOUT_HZ; 279 285 rf->gen_ops.request_reset = irdma_request_reset; 280 286 rf->limits_sel = 7; 281 287 rf->iwdev = iwdev; 288 + 282 289 mutex_init(&iwdev->ah_tbl_lock); 283 - iwdev->netdev = vsi->netdev; 284 - iwdev->vsi_num = vsi->vsi_num; 290 + 291 + iwdev->netdev = iidc_priv->netdev; 292 + iwdev->vsi_num = iidc_priv->vport_id; 285 293 iwdev->init_state = INITIAL_STATE; 286 294 iwdev->roce_cwnd = IRDMA_ROCE_CWND_DEFAULT; 287 295 iwdev->roce_ackcreds = IRDMA_ROCE_ACKCREDS_DEFAULT; ··· 302 294 static int irdma_probe(struct auxiliary_device *aux_dev, const struct auxiliary_device_id *id) 303 295 { 304 296 struct iidc_rdma_core_auxiliary_dev *iidc_adev; 305 - struct iidc_rdma_qos_params qos_info = {}; 297 + struct iidc_rdma_core_dev_info *cdev_info; 298 + struct iidc_rdma_priv_dev_info *iidc_priv; 306 299 struct irdma_l2params l2params = {}; 307 300 struct irdma_device *iwdev; 308 301 struct irdma_pci_f *rf; 309 - struct ice_vsi *vsi; 310 - struct ice_pf *pf; 311 302 int err; 312 303 313 304 iidc_adev = container_of(aux_dev, struct iidc_rdma_core_auxiliary_dev, adev); 314 - pf = iidc_adev->pf; 315 - vsi = ice_get_main_vsi(pf); 305 + cdev_info = iidc_adev->cdev_info; 306 + iidc_priv = cdev_info->iidc_priv; 316 307 317 - if (!vsi) 318 - return -EIO; 319 308 iwdev = ib_alloc_device(irdma_device, ibdev); 320 309 if (!iwdev) 321 310 return -ENOMEM; ··· 322 317 return -ENOMEM; 323 318 } 324 319 325 - irdma_fill_device_info(iwdev, pf, vsi); 320 + irdma_fill_device_info(iwdev, cdev_info); 326 321 rf = iwdev->rf; 327 322 328 - err = irdma_init_interrupts(rf, pf); 323 + err = irdma_init_interrupts(rf, cdev_info); 329 324 if (err) 330 325 goto err_init_interrupts; 331 326 ··· 334 329 goto err_ctrl_init; 335 330 336 331 l2params.mtu = iwdev->netdev->mtu; 337 - ice_get_qos_params(pf, &qos_info); 338 - irdma_fill_qos_info(&l2params, &qos_info); 332 + irdma_fill_qos_info(&l2params, &iidc_priv->qos_info); 339 333 if (iwdev->rf->protocol_used != IRDMA_IWARP_PROTOCOL_ONLY) 340 334 iwdev->dcb_vlan_mode = l2params.num_tc > 1 && !l2params.dscp_mode; 341 335 ··· 346 342 if (err) 347 343 goto err_ibreg; 348 344 349 - ice_rdma_update_vsi_filter(pf, iwdev->vsi_num, true); 345 + ice_rdma_update_vsi_filter(cdev_info, iwdev->vsi_num, true); 350 346 351 347 ibdev_dbg(&iwdev->ibdev, "INIT: Gen2 PF[%d] device probe success\n", PCI_FUNC(rf->pcidev->devfn)); 352 348 auxiliary_set_drvdata(aux_dev, iwdev); ··· 358 354 err_rt_init: 359 355 irdma_ctrl_deinit_hw(rf); 360 356 err_ctrl_init: 361 - irdma_deinit_interrupts(rf, pf); 357 + irdma_deinit_interrupts(rf, cdev_info); 362 358 err_init_interrupts: 363 359 kfree(iwdev->rf); 364 360 ib_dealloc_device(&iwdev->ibdev);
+1
drivers/infiniband/hw/irdma/main.h
··· 30 30 #endif 31 31 #include <linux/auxiliary_bus.h> 32 32 #include <linux/net/intel/iidc_rdma.h> 33 + #include <linux/net/intel/iidc_rdma_ice.h> 33 34 #include <rdma/ib_smi.h> 34 35 #include <rdma/ib_verbs.h> 35 36 #include <rdma/ib_pack.h>
+35 -10
drivers/net/ethernet/intel/ice/devlink/devlink.c
··· 1339 1339 struct devlink_param_gset_ctx *ctx) 1340 1340 { 1341 1341 struct ice_pf *pf = devlink_priv(devlink); 1342 + struct iidc_rdma_core_dev_info *cdev; 1342 1343 1343 - ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; 1344 + cdev = pf->cdev_info; 1345 + if (!cdev) 1346 + return -ENODEV; 1347 + 1348 + ctx->val.vbool = !!(cdev->rdma_protocol & IIDC_RDMA_PROTOCOL_ROCEV2); 1344 1349 1345 1350 return 0; 1346 1351 } ··· 1355 1350 struct netlink_ext_ack *extack) 1356 1351 { 1357 1352 struct ice_pf *pf = devlink_priv(devlink); 1353 + struct iidc_rdma_core_dev_info *cdev; 1358 1354 bool roce_ena = ctx->val.vbool; 1359 1355 int ret; 1360 1356 1357 + cdev = pf->cdev_info; 1358 + if (!cdev) 1359 + return -ENODEV; 1360 + 1361 1361 if (!roce_ena) { 1362 1362 ice_unplug_aux_dev(pf); 1363 - pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; 1363 + cdev->rdma_protocol &= ~IIDC_RDMA_PROTOCOL_ROCEV2; 1364 1364 return 0; 1365 1365 } 1366 1366 1367 - pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; 1367 + cdev->rdma_protocol |= IIDC_RDMA_PROTOCOL_ROCEV2; 1368 1368 ret = ice_plug_aux_dev(pf); 1369 1369 if (ret) 1370 - pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; 1370 + cdev->rdma_protocol &= ~IIDC_RDMA_PROTOCOL_ROCEV2; 1371 1371 1372 1372 return ret; 1373 1373 } ··· 1383 1373 struct netlink_ext_ack *extack) 1384 1374 { 1385 1375 struct ice_pf *pf = devlink_priv(devlink); 1376 + struct iidc_rdma_core_dev_info *cdev; 1377 + 1378 + cdev = pf->cdev_info; 1379 + if (!cdev) 1380 + return -ENODEV; 1386 1381 1387 1382 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) 1388 1383 return -EOPNOTSUPP; 1389 1384 1390 - if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { 1385 + if (cdev->rdma_protocol & IIDC_RDMA_PROTOCOL_IWARP) { 1391 1386 NL_SET_ERR_MSG_MOD(extack, "iWARP is currently enabled. This device cannot enable iWARP and RoCEv2 simultaneously"); 1392 1387 return -EOPNOTSUPP; 1393 1388 } ··· 1405 1390 struct devlink_param_gset_ctx *ctx) 1406 1391 { 1407 1392 struct ice_pf *pf = devlink_priv(devlink); 1393 + struct iidc_rdma_core_dev_info *cdev; 1408 1394 1409 - ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; 1395 + cdev = pf->cdev_info; 1396 + if (!cdev) 1397 + return -ENODEV; 1398 + 1399 + ctx->val.vbool = !!(cdev->rdma_protocol & IIDC_RDMA_PROTOCOL_IWARP); 1410 1400 1411 1401 return 0; 1412 1402 } ··· 1421 1401 struct netlink_ext_ack *extack) 1422 1402 { 1423 1403 struct ice_pf *pf = devlink_priv(devlink); 1404 + struct iidc_rdma_core_dev_info *cdev; 1424 1405 bool iw_ena = ctx->val.vbool; 1425 1406 int ret; 1426 1407 1408 + cdev = pf->cdev_info; 1409 + if (!cdev) 1410 + return -ENODEV; 1411 + 1427 1412 if (!iw_ena) { 1428 1413 ice_unplug_aux_dev(pf); 1429 - pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; 1414 + cdev->rdma_protocol &= ~IIDC_RDMA_PROTOCOL_IWARP; 1430 1415 return 0; 1431 1416 } 1432 1417 1433 - pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; 1418 + cdev->rdma_protocol |= IIDC_RDMA_PROTOCOL_IWARP; 1434 1419 ret = ice_plug_aux_dev(pf); 1435 1420 if (ret) 1436 - pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; 1421 + cdev->rdma_protocol &= ~IIDC_RDMA_PROTOCOL_IWARP; 1437 1422 1438 1423 return ret; 1439 1424 } ··· 1453 1428 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) 1454 1429 return -EOPNOTSUPP; 1455 1430 1456 - if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { 1431 + if (pf->cdev_info->rdma_protocol & IIDC_RDMA_PROTOCOL_ROCEV2) { 1457 1432 NL_SET_ERR_MSG_MOD(extack, "RoCEv2 is currently enabled. This device cannot enable iWARP and RoCEv2 simultaneously"); 1458 1433 return -EOPNOTSUPP; 1459 1434 }
+1 -5
drivers/net/ethernet/intel/ice/ice.h
··· 401 401 u16 req_rxq; /* User requested Rx queues */ 402 402 u16 num_rx_desc; 403 403 u16 num_tx_desc; 404 - u16 qset_handle[ICE_MAX_TRAFFIC_CLASS]; 405 404 struct ice_tc_cfg tc_cfg; 406 405 struct bpf_prog *xdp_prog; 407 406 struct ice_tx_ring **xdp_rings; /* XDP ring array */ ··· 556 557 struct devlink_port devlink_port; 557 558 558 559 /* OS reserved IRQ details */ 559 - struct msix_entry *msix_entries; 560 560 struct ice_irq_tracker irq_tracker; 561 561 struct ice_virt_irq_tracker virt_irq_tracker; 562 562 ··· 590 592 struct gnss_serial *gnss_serial; 591 593 struct gnss_device *gnss_dev; 592 594 u16 num_rdma_msix; /* Total MSIX vectors for RDMA driver */ 593 - u16 rdma_base_vector; 594 595 595 596 /* spinlock to protect the AdminQ wait list */ 596 597 spinlock_t aq_wait_lock; ··· 622 625 struct ice_hw_port_stats stats_prev; 623 626 struct ice_hw hw; 624 627 u8 stat_prev_loaded:1; /* has previous stats been loaded */ 625 - u8 rdma_mode; 626 628 u16 dcbx_cap; 627 629 u32 tx_timeout_count; 628 630 unsigned long tx_timeout_last_recovery; 629 631 u32 tx_timeout_recovery_level; 630 632 char int_name[ICE_INT_NAME_STR_LEN]; 631 633 char int_name_ll_ts[ICE_INT_NAME_STR_LEN]; 632 - struct auxiliary_device *adev; 633 634 int aux_idx; 634 635 u32 sw_int_count; 635 636 /* count of tc_flower filters specific to channel (aka where filter ··· 659 664 struct ice_dplls dplls; 660 665 struct device *hwmon_dev; 661 666 struct ice_health health_reporters; 667 + struct iidc_rdma_core_dev_info *cdev_info; 662 668 663 669 u8 num_quanta_prof_used; 664 670 };
+38 -1
drivers/net/ethernet/intel/ice/ice_dcb_lib.c
··· 740 740 void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked) 741 741 { 742 742 struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; 743 + struct iidc_rdma_priv_dev_info *privd; 744 + struct iidc_rdma_core_dev_info *cdev; 743 745 struct iidc_rdma_event *event; 744 746 u8 tc_map = 0; 745 747 int v, ret; ··· 785 783 if (vsi->type == ICE_VSI_PF) 786 784 ice_dcbnl_set_all(vsi); 787 785 } 788 - if (!locked) { 786 + 787 + cdev = pf->cdev_info; 788 + if (cdev && !locked) { 789 + privd = cdev->iidc_priv; 790 + ice_setup_dcb_qos_info(pf, &privd->qos_info); 789 791 /* Notify the AUX drivers that TC change is finished */ 790 792 event = kzalloc(sizeof(*event), GFP_KERNEL); 791 793 if (!event) ··· 948 942 else 949 943 first->tx_flags |= ICE_TX_FLAGS_HW_VLAN; 950 944 } 945 + } 946 + 947 + /** 948 + * ice_setup_dcb_qos_info - Setup DCB QoS information 949 + * @pf: ptr to ice_pf 950 + * @qos_info: QoS param instance 951 + */ 952 + void ice_setup_dcb_qos_info(struct ice_pf *pf, struct iidc_rdma_qos_params *qos_info) 953 + { 954 + struct ice_dcbx_cfg *dcbx_cfg; 955 + unsigned int i; 956 + u32 up2tc; 957 + 958 + if (!pf || !qos_info) 959 + return; 960 + 961 + dcbx_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; 962 + up2tc = rd32(&pf->hw, PRTDCB_TUP2TC); 963 + 964 + qos_info->num_tc = ice_dcb_get_num_tc(dcbx_cfg); 965 + 966 + for (i = 0; i < IIDC_MAX_USER_PRIORITY; i++) 967 + qos_info->up2tc[i] = (up2tc >> (i * 3)) & 0x7; 968 + 969 + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) 970 + qos_info->tc_info[i].rel_bw = dcbx_cfg->etscfg.tcbwtable[i]; 971 + 972 + qos_info->pfc_mode = dcbx_cfg->pfc_mode; 973 + if (qos_info->pfc_mode == IIDC_DSCP_PFC_MODE) 974 + for (i = 0; i < DSCP_MAX; i++) 975 + qos_info->dscp_map[i] = dcbx_cfg->dscp_map[i]; 951 976 } 952 977 953 978 /**
+9
drivers/net/ethernet/intel/ice/ice_dcb_lib.h
··· 31 31 ice_tx_prepare_vlan_flags_dcb(struct ice_tx_ring *tx_ring, 32 32 struct ice_tx_buf *first); 33 33 void 34 + ice_setup_dcb_qos_info(struct ice_pf *pf, 35 + struct iidc_rdma_qos_params *qos_info); 36 + void 34 37 ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, 35 38 struct ice_rq_event_info *event); 36 39 /** ··· 137 134 static inline void 138 135 ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, struct ice_rq_event_info *event) { } 139 136 static inline void ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, u8 dcb_tc) { } 137 + static inline void 138 + ice_setup_dcb_qos_info(struct ice_pf *pf, struct iidc_rdma_qos_params *qos_info) 139 + { 140 + qos_info->num_tc = 1; 141 + qos_info->tc_info[0].rel_bw = 100; 142 + } 140 143 #endif /* CONFIG_DCB */ 141 144 #endif /* _ICE_DCB_LIB_H_ */
+4 -4
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 3964 3964 return -EINVAL; 3965 3965 } 3966 3966 3967 - if (pf->adev) { 3967 + if (pf->cdev_info && pf->cdev_info->adev) { 3968 3968 mutex_lock(&pf->adev_mutex); 3969 - device_lock(&pf->adev->dev); 3969 + device_lock(&pf->cdev_info->adev->dev); 3970 3970 locked = true; 3971 - if (pf->adev->dev.driver) { 3971 + if (pf->cdev_info->adev->dev.driver) { 3972 3972 netdev_err(dev, "Cannot change channels when RDMA is active\n"); 3973 3973 ret = -EBUSY; 3974 3974 goto adev_unlock; ··· 3987 3987 3988 3988 adev_unlock: 3989 3989 if (locked) { 3990 - device_unlock(&pf->adev->dev); 3990 + device_unlock(&pf->cdev_info->adev->dev); 3991 3991 mutex_unlock(&pf->adev_mutex); 3992 3992 } 3993 3993 return ret;
+123 -69
drivers/net/ethernet/intel/ice/ice_idc.c
··· 9 9 static DEFINE_XARRAY_ALLOC1(ice_aux_id); 10 10 11 11 /** 12 - * ice_get_auxiliary_drv - retrieve iidc_auxiliary_drv struct 13 - * @pf: pointer to PF struct 12 + * ice_get_auxiliary_drv - retrieve iidc_rdma_core_auxiliary_drv struct 13 + * @cdev: pointer to iidc_rdma_core_dev_info struct 14 14 * 15 15 * This function has to be called with a device_lock on the 16 - * pf->adev.dev to avoid race conditions. 16 + * cdev->adev.dev to avoid race conditions. 17 + * 18 + * Return: pointer to the matched auxiliary driver struct 17 19 */ 18 - static 19 - struct iidc_rdma_core_auxiliary_drv *ice_get_auxiliary_drv(struct ice_pf *pf) 20 + static struct iidc_rdma_core_auxiliary_drv * 21 + ice_get_auxiliary_drv(struct iidc_rdma_core_dev_info *cdev) 20 22 { 21 23 struct auxiliary_device *adev; 22 24 23 - adev = pf->adev; 25 + adev = cdev->adev; 24 26 if (!adev || !adev->dev.driver) 25 27 return NULL; 26 28 ··· 38 36 void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event) 39 37 { 40 38 struct iidc_rdma_core_auxiliary_drv *iadrv; 39 + struct iidc_rdma_core_dev_info *cdev; 41 40 42 41 if (WARN_ON_ONCE(!in_task())) 43 42 return; 44 43 44 + cdev = pf->cdev_info; 45 + if (!cdev) 46 + return; 47 + 45 48 mutex_lock(&pf->adev_mutex); 46 - if (!pf->adev) 49 + if (!cdev->adev) 47 50 goto finish; 48 51 49 - device_lock(&pf->adev->dev); 50 - iadrv = ice_get_auxiliary_drv(pf); 52 + device_lock(&cdev->adev->dev); 53 + iadrv = ice_get_auxiliary_drv(cdev); 51 54 if (iadrv && iadrv->event_handler) 52 - iadrv->event_handler(pf, event); 53 - device_unlock(&pf->adev->dev); 55 + iadrv->event_handler(cdev, event); 56 + device_unlock(&cdev->adev->dev); 54 57 finish: 55 58 mutex_unlock(&pf->adev_mutex); 56 59 } 57 60 58 61 /** 59 62 * ice_add_rdma_qset - Add Leaf Node for RDMA Qset 60 - * @pf: PF struct 63 + * @cdev: pointer to iidc_rdma_core_dev_info struct 61 64 * @qset: Resource to be allocated 65 + * 66 + * Return: Zero on success or error code encountered 62 67 */ 63 - int ice_add_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset) 68 + int ice_add_rdma_qset(struct iidc_rdma_core_dev_info *cdev, 69 + struct iidc_rdma_qset_params *qset) 64 70 { 65 71 u16 max_rdmaqs[ICE_MAX_TRAFFIC_CLASS]; 66 72 struct ice_vsi *vsi; 67 73 struct device *dev; 74 + struct ice_pf *pf; 68 75 u32 qset_teid; 69 76 u16 qs_handle; 70 77 int status; 71 78 int i; 72 79 73 - if (WARN_ON(!pf || !qset)) 80 + if (WARN_ON(!cdev || !qset)) 74 81 return -EINVAL; 75 82 83 + pf = pci_get_drvdata(cdev->pdev); 76 84 dev = ice_pf_to_dev(pf); 77 85 78 86 if (!ice_is_rdma_ena(pf)) ··· 113 101 dev_err(dev, "Failed VSI RDMA Qset enable\n"); 114 102 return status; 115 103 } 116 - vsi->qset_handle[qset->tc] = qset->qs_handle; 117 104 qset->teid = qset_teid; 118 105 119 106 return 0; ··· 121 110 122 111 /** 123 112 * ice_del_rdma_qset - Delete leaf node for RDMA Qset 124 - * @pf: PF struct 113 + * @cdev: pointer to iidc_rdma_core_dev_info struct 125 114 * @qset: Resource to be freed 115 + * 116 + * Return: Zero on success, error code on failure 126 117 */ 127 - int ice_del_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset) 118 + int ice_del_rdma_qset(struct iidc_rdma_core_dev_info *cdev, 119 + struct iidc_rdma_qset_params *qset) 128 120 { 129 121 struct ice_vsi *vsi; 122 + struct ice_pf *pf; 130 123 u32 teid; 131 124 u16 q_id; 132 125 133 - if (WARN_ON(!pf || !qset)) 126 + if (WARN_ON(!cdev || !qset)) 134 127 return -EINVAL; 135 128 129 + pf = pci_get_drvdata(cdev->pdev); 136 130 vsi = ice_find_vsi(pf, qset->vport_id); 137 131 if (!vsi) { 138 132 dev_err(ice_pf_to_dev(pf), "RDMA Invalid VSI\n"); ··· 147 131 q_id = qset->qs_handle; 148 132 teid = qset->teid; 149 133 150 - vsi->qset_handle[qset->tc] = 0; 151 - 152 134 return ice_dis_vsi_rdma_qset(vsi->port_info, 1, &teid, &q_id); 153 135 } 154 136 EXPORT_SYMBOL_GPL(ice_del_rdma_qset); 155 137 156 138 /** 157 139 * ice_rdma_request_reset - accept request from RDMA to perform a reset 158 - * @pf: struct for PF 140 + * @cdev: pointer to iidc_rdma_core_dev_info struct 159 141 * @reset_type: type of reset 142 + * 143 + * Return: Zero on success, error code on failure 160 144 */ 161 - int ice_rdma_request_reset(struct ice_pf *pf, 145 + int ice_rdma_request_reset(struct iidc_rdma_core_dev_info *cdev, 162 146 enum iidc_rdma_reset_type reset_type) 163 147 { 164 148 enum ice_reset_req reset; 149 + struct ice_pf *pf; 165 150 166 - if (WARN_ON(!pf)) 151 + if (WARN_ON(!cdev)) 167 152 return -EINVAL; 168 153 154 + pf = pci_get_drvdata(cdev->pdev); 155 + 169 156 switch (reset_type) { 170 - case IIDC_PFR: 157 + case IIDC_FUNC_RESET: 171 158 reset = ICE_RESET_PFR; 172 159 break; 173 - case IIDC_CORER: 160 + case IIDC_DEV_RESET: 174 161 reset = ICE_RESET_CORER; 175 162 break; 176 - case IIDC_GLOBR: 177 - reset = ICE_RESET_GLOBR; 178 - break; 179 163 default: 180 - dev_err(ice_pf_to_dev(pf), "incorrect reset request\n"); 181 164 return -EINVAL; 182 165 } 183 166 ··· 186 171 187 172 /** 188 173 * ice_rdma_update_vsi_filter - update main VSI filters for RDMA 189 - * @pf: pointer to struct for PF 174 + * @cdev: pointer to iidc_rdma_core_dev_info struct 190 175 * @vsi_id: VSI HW idx to update filter on 191 176 * @enable: bool whether to enable or disable filters 177 + * 178 + * Return: Zero on success, error code on failure 192 179 */ 193 - int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable) 180 + int ice_rdma_update_vsi_filter(struct iidc_rdma_core_dev_info *cdev, 181 + u16 vsi_id, bool enable) 194 182 { 195 183 struct ice_vsi *vsi; 184 + struct ice_pf *pf; 196 185 int status; 197 186 198 - if (WARN_ON(!pf)) 187 + if (WARN_ON(!cdev)) 199 188 return -EINVAL; 200 189 190 + pf = pci_get_drvdata(cdev->pdev); 201 191 vsi = ice_find_vsi(pf, vsi_id); 202 192 if (!vsi) 203 193 return -EINVAL; ··· 223 203 EXPORT_SYMBOL_GPL(ice_rdma_update_vsi_filter); 224 204 225 205 /** 226 - * ice_get_qos_params - parse QoS params for RDMA consumption 227 - * @pf: pointer to PF struct 228 - * @qos: set of QoS values 206 + * ice_alloc_rdma_qvector - alloc vector resources reserved for RDMA driver 207 + * @cdev: pointer to iidc_rdma_core_dev_info struct 208 + * @entry: MSI-X entry to be removed 209 + * 210 + * Return: Zero on success, error code on failure 229 211 */ 230 - void ice_get_qos_params(struct ice_pf *pf, struct iidc_rdma_qos_params *qos) 212 + int ice_alloc_rdma_qvector(struct iidc_rdma_core_dev_info *cdev, 213 + struct msix_entry *entry) 231 214 { 232 - struct ice_dcbx_cfg *dcbx_cfg; 233 - unsigned int i; 234 - u32 up2tc; 215 + struct msi_map map; 216 + struct ice_pf *pf; 235 217 236 - dcbx_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; 237 - up2tc = rd32(&pf->hw, PRTDCB_TUP2TC); 218 + if (WARN_ON(!cdev)) 219 + return -EINVAL; 238 220 239 - qos->num_tc = ice_dcb_get_num_tc(dcbx_cfg); 240 - for (i = 0; i < IIDC_MAX_USER_PRIORITY; i++) 241 - qos->up2tc[i] = (up2tc >> (i * 3)) & 0x7; 242 - 243 - for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) 244 - qos->tc_info[i].rel_bw = dcbx_cfg->etscfg.tcbwtable[i]; 245 - 246 - qos->pfc_mode = dcbx_cfg->pfc_mode; 247 - if (qos->pfc_mode == IIDC_DSCP_PFC_MODE) 248 - for (i = 0; i < DSCP_MAX; i++) 249 - qos->dscp_map[i] = dcbx_cfg->dscp_map[i]; 250 - } 251 - EXPORT_SYMBOL_GPL(ice_get_qos_params); 252 - 253 - int ice_alloc_rdma_qvector(struct ice_pf *pf, struct msix_entry *entry) 254 - { 255 - struct msi_map map = ice_alloc_irq(pf, true); 256 - 221 + pf = pci_get_drvdata(cdev->pdev); 222 + map = ice_alloc_irq(pf, true); 257 223 if (map.index < 0) 258 224 return -ENOMEM; 259 225 ··· 252 246 253 247 /** 254 248 * ice_free_rdma_qvector - free vector resources reserved for RDMA driver 255 - * @pf: board private structure to initialize 249 + * @cdev: pointer to iidc_rdma_core_dev_info struct 256 250 * @entry: MSI-X entry to be removed 257 251 */ 258 - void ice_free_rdma_qvector(struct ice_pf *pf, struct msix_entry *entry) 252 + void ice_free_rdma_qvector(struct iidc_rdma_core_dev_info *cdev, 253 + struct msix_entry *entry) 259 254 { 260 255 struct msi_map map; 256 + struct ice_pf *pf; 257 + 258 + if (WARN_ON(!cdev || !entry)) 259 + return; 260 + 261 + pf = pci_get_drvdata(cdev->pdev); 261 262 262 263 map.index = entry->entry; 263 264 map.virq = entry->vector; ··· 288 275 /** 289 276 * ice_plug_aux_dev - allocate and register AUX device 290 277 * @pf: pointer to pf struct 278 + * 279 + * Return: Zero on success, error code on failure 291 280 */ 292 281 int ice_plug_aux_dev(struct ice_pf *pf) 293 282 { 294 283 struct iidc_rdma_core_auxiliary_dev *iadev; 284 + struct iidc_rdma_core_dev_info *cdev; 295 285 struct auxiliary_device *adev; 296 286 int ret; 297 287 ··· 304 288 if (!ice_is_rdma_ena(pf)) 305 289 return 0; 306 290 291 + cdev = pf->cdev_info; 292 + if (!cdev) 293 + return -ENODEV; 294 + 307 295 iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); 308 296 if (!iadev) 309 297 return -ENOMEM; 310 298 311 299 adev = &iadev->adev; 312 - iadev->pf = pf; 300 + iadev->cdev_info = cdev; 313 301 314 302 adev->id = pf->aux_idx; 315 303 adev->dev.release = ice_adev_release; 316 304 adev->dev.parent = &pf->pdev->dev; 317 - adev->name = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? "roce" : "iwarp"; 305 + adev->name = cdev->rdma_protocol & IIDC_RDMA_PROTOCOL_ROCEV2 ? 306 + "roce" : "iwarp"; 318 307 319 308 ret = auxiliary_device_init(adev); 320 309 if (ret) { ··· 334 313 } 335 314 336 315 mutex_lock(&pf->adev_mutex); 337 - pf->adev = adev; 316 + cdev->adev = adev; 338 317 mutex_unlock(&pf->adev_mutex); 339 318 340 319 return 0; ··· 348 327 struct auxiliary_device *adev; 349 328 350 329 mutex_lock(&pf->adev_mutex); 351 - adev = pf->adev; 352 - pf->adev = NULL; 330 + adev = pf->cdev_info->adev; 331 + pf->cdev_info->adev = NULL; 353 332 mutex_unlock(&pf->adev_mutex); 354 333 355 334 if (adev) { ··· 364 343 */ 365 344 int ice_init_rdma(struct ice_pf *pf) 366 345 { 346 + struct iidc_rdma_priv_dev_info *privd; 367 347 struct device *dev = &pf->pdev->dev; 348 + struct iidc_rdma_core_dev_info *cdev; 368 349 int ret; 369 350 370 351 if (!ice_is_rdma_ena(pf)) { ··· 374 351 return 0; 375 352 } 376 353 354 + cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); 355 + if (!cdev) 356 + return -ENOMEM; 357 + 358 + pf->cdev_info = cdev; 359 + 360 + privd = kzalloc(sizeof(*privd), GFP_KERNEL); 361 + if (!privd) { 362 + ret = -ENOMEM; 363 + goto err_privd_alloc; 364 + } 365 + 366 + privd->pf_id = pf->hw.pf_id; 377 367 ret = xa_alloc(&ice_aux_id, &pf->aux_idx, NULL, XA_LIMIT(1, INT_MAX), 378 368 GFP_KERNEL); 379 369 if (ret) { 380 370 dev_err(dev, "Failed to allocate device ID for AUX driver\n"); 381 - return -ENOMEM; 371 + ret = -ENOMEM; 372 + goto err_alloc_xa; 382 373 } 383 374 384 - pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; 375 + cdev->iidc_priv = privd; 376 + privd->netdev = pf->vsi[0]->netdev; 377 + 378 + privd->hw_addr = (u8 __iomem *)pf->hw.hw_addr; 379 + cdev->pdev = pf->pdev; 380 + privd->vport_id = pf->vsi[0]->vsi_num; 381 + 382 + pf->cdev_info->rdma_protocol |= IIDC_RDMA_PROTOCOL_ROCEV2; 383 + ice_setup_dcb_qos_info(pf, &privd->qos_info); 385 384 ret = ice_plug_aux_dev(pf); 386 385 if (ret) 387 386 goto err_plug_aux_dev; 388 387 return 0; 389 388 390 389 err_plug_aux_dev: 391 - pf->adev = NULL; 390 + pf->cdev_info->adev = NULL; 392 391 xa_erase(&ice_aux_id, pf->aux_idx); 392 + err_alloc_xa: 393 + kfree(privd); 394 + err_privd_alloc: 395 + kfree(cdev); 396 + pf->cdev_info = NULL; 397 + 393 398 return ret; 394 399 } 395 400 ··· 432 381 433 382 ice_unplug_aux_dev(pf); 434 383 xa_erase(&ice_aux_id, pf->aux_idx); 384 + kfree(pf->cdev_info->iidc_priv); 385 + kfree(pf->cdev_info); 386 + pf->cdev_info = NULL; 435 387 }
+6 -4
drivers/net/ethernet/intel/ice/ice_main.c
··· 9310 9310 void *type_data) 9311 9311 { 9312 9312 struct ice_netdev_priv *np = netdev_priv(netdev); 9313 + struct iidc_rdma_core_dev_info *cdev; 9313 9314 struct ice_pf *pf = np->vsi->back; 9314 9315 bool locked = false; 9315 9316 int err; ··· 9327 9326 return -EOPNOTSUPP; 9328 9327 } 9329 9328 9330 - if (pf->adev) { 9329 + cdev = pf->cdev_info; 9330 + if (cdev && cdev->adev) { 9331 9331 mutex_lock(&pf->adev_mutex); 9332 - device_lock(&pf->adev->dev); 9332 + device_lock(&cdev->adev->dev); 9333 9333 locked = true; 9334 - if (pf->adev->dev.driver) { 9334 + if (cdev->adev->dev.driver) { 9335 9335 netdev_err(netdev, "Cannot change qdisc when RDMA is active\n"); 9336 9336 err = -EBUSY; 9337 9337 goto adev_unlock; ··· 9346 9344 9347 9345 adev_unlock: 9348 9346 if (locked) { 9349 - device_unlock(&pf->adev->dev); 9347 + device_unlock(&cdev->adev->dev); 9350 9348 mutex_unlock(&pf->adev_mutex); 9351 9349 } 9352 9350 return err;
+23 -54
include/linux/net/intel/iidc_rdma.h
··· 5 5 #define _IIDC_RDMA_H_ 6 6 7 7 #include <linux/auxiliary_bus.h> 8 - #include <linux/dcbnl.h> 9 8 #include <linux/device.h> 10 9 #include <linux/if_ether.h> 11 10 #include <linux/kernel.h> ··· 16 17 IIDC_RDMA_EVENT_AFTER_MTU_CHANGE, 17 18 IIDC_RDMA_EVENT_BEFORE_TC_CHANGE, 18 19 IIDC_RDMA_EVENT_AFTER_TC_CHANGE, 20 + IIDC_RDMA_EVENT_WARN_RESET, 19 21 IIDC_RDMA_EVENT_CRIT_ERR, 20 22 IIDC_RDMA_EVENT_NBITS /* must be last */ 21 - }; 22 - 23 - enum iidc_rdma_reset_type { 24 - IIDC_PFR, 25 - IIDC_CORER, 26 - IIDC_GLOBR, 27 - }; 28 - 29 - enum iidc_rdma_protocol { 30 - IIDC_RDMA_PROTOCOL_IWARP = BIT(0), 31 - IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1), 32 - }; 33 - 34 - #define IIDC_MAX_USER_PRIORITY 8 35 - #define IIDC_DSCP_PFC_MODE 0x1 36 - 37 - /* Struct to hold per RDMA Qset info */ 38 - struct iidc_rdma_qset_params { 39 - /* Qset TEID returned to the RDMA driver in 40 - * ice_add_rdma_qset and used by RDMA driver 41 - * for calls to ice_del_rdma_qset 42 - */ 43 - u32 teid; /* Qset TEID */ 44 - u16 qs_handle; /* RDMA driver provides this */ 45 - u16 vport_id; /* VSI index */ 46 - u8 tc; /* TC branch the Qset should belong to */ 47 - }; 48 - 49 - struct iidc_rdma_qos_info { 50 - u64 tc_ctx; 51 - u8 rel_bw; 52 - u8 prio_type; 53 - u8 egress_virt_up; 54 - u8 ingress_virt_up; 55 - }; 56 - 57 - /* Struct to pass QoS info */ 58 - struct iidc_rdma_qos_params { 59 - struct iidc_rdma_qos_info tc_info[IEEE_8021QAZ_MAX_TCS]; 60 - u8 up2tc[IIDC_MAX_USER_PRIORITY]; 61 - u8 vport_relative_bw; 62 - u8 vport_priority_type; 63 - u8 num_tc; 64 - u8 pfc_mode; 65 - u8 dscp_map[DSCP_MAX]; 66 23 }; 67 24 68 25 struct iidc_rdma_event { ··· 26 71 u32 reg; 27 72 }; 28 73 74 + enum iidc_rdma_reset_type { 75 + IIDC_FUNC_RESET, 76 + IIDC_DEV_RESET, 77 + }; 78 + 79 + enum iidc_rdma_protocol { 80 + IIDC_RDMA_PROTOCOL_IWARP = BIT(0), 81 + IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1), 82 + }; 83 + 84 + /* Structure to be populated by core LAN PCI driver */ 85 + struct iidc_rdma_core_dev_info { 86 + struct pci_dev *pdev; /* PCI device of corresponding to main function */ 87 + struct auxiliary_device *adev; 88 + /* Current active RDMA protocol */ 89 + enum iidc_rdma_protocol rdma_protocol; 90 + void *iidc_priv; /* elements unique to each driver */ 91 + }; 92 + 29 93 /* Structure representing auxiliary driver tailored information about the core 30 94 * PCI dev, each auxiliary driver using the IIDC interface will have an 31 95 * instance of this struct dedicated to it. 32 96 */ 33 - 34 97 struct iidc_rdma_core_auxiliary_dev { 35 98 struct auxiliary_device adev; 36 - struct ice_pf *pf; 99 + struct iidc_rdma_core_dev_info *cdev_info; 37 100 }; 38 101 39 102 /* structure representing the auxiliary driver. This struct is to be ··· 61 88 */ 62 89 struct iidc_rdma_core_auxiliary_drv { 63 90 struct auxiliary_driver adrv; 64 - /* This event_handler is meant to be a blocking call. For instance, 65 - * when a BEFORE_MTU_CHANGE event comes in, the event_handler will not 66 - * return until the auxiliary driver is ready for the MTU change to 67 - * happen. 68 - */ 69 - void (*event_handler)(struct ice_pf *pf, struct iidc_rdma_event *event); 91 + void (*event_handler)(struct iidc_rdma_core_dev_info *cdev, 92 + struct iidc_rdma_event *event); 70 93 }; 71 94 72 95 #endif /* _IIDC_RDMA_H_*/
+60 -9
include/linux/net/intel/iidc_rdma_ice.h
··· 4 4 #ifndef _IIDC_RDMA_ICE_H_ 5 5 #define _IIDC_RDMA_ICE_H_ 6 6 7 - struct ice_pf; 7 + #include <linux/dcbnl.h> 8 8 9 - int ice_add_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset); 10 - int ice_del_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset); 11 - int ice_rdma_request_reset(struct ice_pf *pf, 9 + #define IIDC_MAX_USER_PRIORITY 8 10 + #define IIDC_DSCP_PFC_MODE 0x1 11 + 12 + /** 13 + * struct iidc_rdma_qset_params - Struct to hold per RDMA Qset info 14 + * @teid: TEID of the Qset node 15 + * @qs_handle: SW index of the Qset, RDMA provides this 16 + * @vport_id: VSI index 17 + * @tc: Traffic Class branch the QSet should belong to 18 + */ 19 + struct iidc_rdma_qset_params { 20 + /* Qset TEID returned to the RDMA driver in 21 + * ice_add_rdma_qset and used by RDMA driver 22 + * for calls to ice_del_rdma_qset 23 + */ 24 + u32 teid; 25 + u16 qs_handle; 26 + u16 vport_id; 27 + u8 tc; 28 + }; 29 + 30 + struct iidc_rdma_qos_info { 31 + u64 tc_ctx; 32 + u8 rel_bw; 33 + u8 prio_type; 34 + u8 egress_virt_up; 35 + u8 ingress_virt_up; 36 + }; 37 + 38 + /* Struct to pass QoS info */ 39 + struct iidc_rdma_qos_params { 40 + struct iidc_rdma_qos_info tc_info[IEEE_8021QAZ_MAX_TCS]; 41 + u8 up2tc[IIDC_MAX_USER_PRIORITY]; 42 + u8 vport_relative_bw; 43 + u8 vport_priority_type; 44 + u8 num_tc; 45 + u8 pfc_mode; 46 + u8 dscp_map[DSCP_MAX]; 47 + }; 48 + 49 + struct iidc_rdma_priv_dev_info { 50 + u8 pf_id; 51 + u16 vport_id; 52 + struct net_device *netdev; 53 + struct iidc_rdma_qos_params qos_info; 54 + u8 __iomem *hw_addr; 55 + }; 56 + 57 + int ice_add_rdma_qset(struct iidc_rdma_core_dev_info *cdev, 58 + struct iidc_rdma_qset_params *qset); 59 + int ice_del_rdma_qset(struct iidc_rdma_core_dev_info *cdev, 60 + struct iidc_rdma_qset_params *qset); 61 + int ice_rdma_request_reset(struct iidc_rdma_core_dev_info *cdev, 12 62 enum iidc_rdma_reset_type reset_type); 13 - int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable); 14 - void ice_get_qos_params(struct ice_pf *pf, 15 - struct iidc_rdma_qos_params *qos); 16 - int ice_alloc_rdma_qvector(struct ice_pf *pf, struct msix_entry *entry); 17 - void ice_free_rdma_qvector(struct ice_pf *pf, struct msix_entry *entry); 63 + int ice_rdma_update_vsi_filter(struct iidc_rdma_core_dev_info *cdev, u16 vsi_id, 64 + bool enable); 65 + int ice_alloc_rdma_qvector(struct iidc_rdma_core_dev_info *cdev, 66 + struct msix_entry *entry); 67 + void ice_free_rdma_qvector(struct iidc_rdma_core_dev_info *cdev, 68 + struct msix_entry *entry); 18 69 19 70 #endif /* _IIDC_RDMA_ICE_H_*/