History

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-11-22 Shiraz Saleem says: Currently E800 devices come up as RoCEv2 devices by default. This series add supports for users to configure iWARP or RoCEv2 functionality per PCI function. devlink parameters is used to realize this and is keyed off similar work in [1]. [1] https://lore.kernel.org/linux-rdma/20210810132424.9129-1-parav@nvidia.com/ ====================

David S. Miller committed 4 years ago

Commit c384cee2 parents 5f11542 774a90c10 files · +180 −6Browse files

Unified · Split

10 files
  1. Documentation/networking/devlink/devlink-params.rst +3 −0
  2. drivers/infiniband/hw/irdma/main.c +2 −1
  3. drivers/net/ethernet/intel/ice/ice.h +1 −0
  4. drivers/net/ethernet/intel/ice/ice_devlink.c +144 −0
  5. drivers/net/ethernet/intel/ice/ice_devlink.h +6 −0
  6. drivers/net/ethernet/intel/ice/ice_idc.c +2 −2
  7. drivers/net/ethernet/intel/ice/ice_main.c +8 −1
  8. include/linux/net/intel/iidc.h +5 −2
  9. include/net/devlink.h +4 −0
  10. net/core/devlink.c +5 −0
Documentation/networking/devlink/devlink-params.rst+3−0
@@ -109,6 +109,9 @@ own name. · 108 unmodified lines
109 - Boolean109 - Boolean
110 - When enabled, the device driver will instantiate VDPA networking110 - When enabled, the device driver will instantiate VDPA networking
111 specific auxiliary device of the devlink device.111 specific auxiliary device of the devlink device.
112 * - ``enable_iwarp``
113 - Boolean
114 - Enable handling of iWARP traffic in the device.
112 * - ``internal_err_reset``115 * - ``internal_err_reset``
113 - Boolean116 - Boolean
114 - When enabled, the device driver will reset the device on internal117 - When enabled, the device driver will reset the device on internal
drivers/infiniband/hw/irdma/main.c+2−1
@@ -228,7 +228,8 @@ static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf · 227 unmodified lines
228 rf->msix_count = pf->num_rdma_msix;228 rf->msix_count = pf->num_rdma_msix;
229 rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector];229 rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector];
230 rf->default_vsi.vsi_idx = vsi->vsi_num;230 rf->default_vsi.vsi_idx = vsi->vsi_num;
231 rf->protocol_used = IRDMA_ROCE_PROTOCOL_ONLY;231 rf->protocol_used = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ?
232 IRDMA_ROCE_PROTOCOL_ONLY : IRDMA_IWARP_PROTOCOL_ONLY;
232 rf->rdma_ver = IRDMA_GEN_2;233 rf->rdma_ver = IRDMA_GEN_2;
233 rf->rsrc_profile = IRDMA_HMC_PROFILE_DEFAULT;234 rf->rsrc_profile = IRDMA_HMC_PROFILE_DEFAULT;
234 rf->rst_to = IRDMA_RST_TIMEOUT_HZ;235 rf->rst_to = IRDMA_RST_TIMEOUT_HZ;
drivers/net/ethernet/intel/ice/ice.h+1−0
@@ -576,6 +576,7 @@ struct ice_pf { · 575 unmodified lines
576 struct ice_hw_port_stats stats_prev;576 struct ice_hw_port_stats stats_prev;
577 struct ice_hw hw;577 struct ice_hw hw;
578 u8 stat_prev_loaded:1; /* has previous stats been loaded */578 u8 stat_prev_loaded:1; /* has previous stats been loaded */
579 u8 rdma_mode;
579 u16 dcbx_cap;580 u16 dcbx_cap;
580 u32 tx_timeout_count;581 u32 tx_timeout_count;
581 unsigned long tx_timeout_last_recovery;582 unsigned long tx_timeout_last_recovery;
drivers/net/ethernet/intel/ice/ice_devlink.c+144−0
@@ -430,6 +430,120 @@ static const struct devlink_ops ice_devlink_ops = { · 429 unmodified lines
430 .flash_update = ice_devlink_flash_update,430 .flash_update = ice_devlink_flash_update,
431};431};
432 432
433static int
434ice_devlink_enable_roce_get(struct devlink *devlink, u32 id,
435 struct devlink_param_gset_ctx *ctx)
436{
437 struct ice_pf *pf = devlink_priv(devlink);
438
439 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2;
440
441 return 0;
442}
443
444static int
445ice_devlink_enable_roce_set(struct devlink *devlink, u32 id,
446 struct devlink_param_gset_ctx *ctx)
447{
448 struct ice_pf *pf = devlink_priv(devlink);
449 bool roce_ena = ctx->val.vbool;
450 int ret;
451
452 if (!roce_ena) {
453 ice_unplug_aux_dev(pf);
454 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2;
455 return 0;
456 }
457
458 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2;
459 ret = ice_plug_aux_dev(pf);
460 if (ret)
461 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2;
462
463 return ret;
464}
465
466static int
467ice_devlink_enable_roce_validate(struct devlink *devlink, u32 id,
468 union devlink_param_value val,
469 struct netlink_ext_ack *extack)
470{
471 struct ice_pf *pf = devlink_priv(devlink);
472
473 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags))
474 return -EOPNOTSUPP;
475
476 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) {
477 NL_SET_ERR_MSG_MOD(extack, "iWARP is currently enabled. This device cannot enable iWARP and RoCEv2 simultaneously");
478 return -EOPNOTSUPP;
479 }
480
481 return 0;
482}
483
484static int
485ice_devlink_enable_iw_get(struct devlink *devlink, u32 id,
486 struct devlink_param_gset_ctx *ctx)
487{
488 struct ice_pf *pf = devlink_priv(devlink);
489
490 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP;
491
492 return 0;
493}
494
495static int
496ice_devlink_enable_iw_set(struct devlink *devlink, u32 id,
497 struct devlink_param_gset_ctx *ctx)
498{
499 struct ice_pf *pf = devlink_priv(devlink);
500 bool iw_ena = ctx->val.vbool;
501 int ret;
502
503 if (!iw_ena) {
504 ice_unplug_aux_dev(pf);
505 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP;
506 return 0;
507 }
508
509 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP;
510 ret = ice_plug_aux_dev(pf);
511 if (ret)
512 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP;
513
514 return ret;
515}
516
517static int
518ice_devlink_enable_iw_validate(struct devlink *devlink, u32 id,
519 union devlink_param_value val,
520 struct netlink_ext_ack *extack)
521{
522 struct ice_pf *pf = devlink_priv(devlink);
523
524 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags))
525 return -EOPNOTSUPP;
526
527 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) {
528 NL_SET_ERR_MSG_MOD(extack, "RoCEv2 is currently enabled. This device cannot enable iWARP and RoCEv2 simultaneously");
529 return -EOPNOTSUPP;
530 }
531
532 return 0;
533}
534
535static const struct devlink_param ice_devlink_params[] = {
536 DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
537 ice_devlink_enable_roce_get,
538 ice_devlink_enable_roce_set,
539 ice_devlink_enable_roce_validate),
540 DEVLINK_PARAM_GENERIC(ENABLE_IWARP, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
541 ice_devlink_enable_iw_get,
542 ice_devlink_enable_iw_set,
543 ice_devlink_enable_iw_validate),
544
545};
546
433static void ice_devlink_free(void *devlink_ptr)547static void ice_devlink_free(void *devlink_ptr)
434{548{
435 devlink_free((struct devlink *)devlink_ptr);549 devlink_free((struct devlink *)devlink_ptr);
@@ -484,6 +598,36 @@ void ice_devlink_unregister(struct ice_pf *pf) · 48 unmodified lines
484 devlink_unregister(priv_to_devlink(pf));598 devlink_unregister(priv_to_devlink(pf));
485}599}
486 600
601int ice_devlink_register_params(struct ice_pf *pf)
602{
603 struct devlink *devlink = priv_to_devlink(pf);
604 union devlink_param_value value;
605 int err;
606
607 err = devlink_params_register(devlink, ice_devlink_params,
608 ARRAY_SIZE(ice_devlink_params));
609 if (err)
610 return err;
611
612 value.vbool = false;
613 devlink_param_driverinit_value_set(devlink,
614 DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP,
615 value);
616
617 value.vbool = test_bit(ICE_FLAG_RDMA_ENA, pf->flags) ? true : false;
618 devlink_param_driverinit_value_set(devlink,
619 DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
620 value);
621
622 return 0;
623}
624
625void ice_devlink_unregister_params(struct ice_pf *pf)
626{
627 devlink_params_unregister(priv_to_devlink(pf), ice_devlink_params,
628 ARRAY_SIZE(ice_devlink_params));
629}
630
487/**631/**
488 * ice_devlink_create_pf_port - Create a devlink port for this PF632 * ice_devlink_create_pf_port - Create a devlink port for this PF
489 * @pf: the PF to create a devlink port for633 * @pf: the PF to create a devlink port for
drivers/net/ethernet/intel/ice/ice_devlink.h+6−0
@@ -4,10 +4,16 @@ · 3 unmodified lines
4#ifndef _ICE_DEVLINK_H_4#ifndef _ICE_DEVLINK_H_
5#define _ICE_DEVLINK_H_5#define _ICE_DEVLINK_H_
6 6
7enum ice_devlink_param_id {
8 ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
9};
10
7struct ice_pf *ice_allocate_pf(struct device *dev);11struct ice_pf *ice_allocate_pf(struct device *dev);
8 12
9void ice_devlink_register(struct ice_pf *pf);13void ice_devlink_register(struct ice_pf *pf);
10void ice_devlink_unregister(struct ice_pf *pf);14void ice_devlink_unregister(struct ice_pf *pf);
15int ice_devlink_register_params(struct ice_pf *pf);
16void ice_devlink_unregister_params(struct ice_pf *pf);
11int ice_devlink_create_pf_port(struct ice_pf *pf);17int ice_devlink_create_pf_port(struct ice_pf *pf);
12void ice_devlink_destroy_pf_port(struct ice_pf *pf);18void ice_devlink_destroy_pf_port(struct ice_pf *pf);
13int ice_devlink_create_vf_port(struct ice_vf *vf);19int ice_devlink_create_vf_port(struct ice_vf *vf);
drivers/net/ethernet/intel/ice/ice_idc.c+2−2
@@ -288,7 +288,7 @@ int ice_plug_aux_dev(struct ice_pf *pf) · 287 unmodified lines
288 adev->id = pf->aux_idx;288 adev->id = pf->aux_idx;
289 adev->dev.release = ice_adev_release;289 adev->dev.release = ice_adev_release;
290 adev->dev.parent = &pf->pdev->dev;290 adev->dev.parent = &pf->pdev->dev;
291 adev->name = IIDC_RDMA_ROCE_NAME;291 adev->name = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? "roce" : "iwarp";
292 292
293 ret = auxiliary_device_init(adev);293 ret = auxiliary_device_init(adev);
294 if (ret) {294 if (ret) {
@@ -335,6 +335,6 @@ int ice_init_rdma(struct ice_pf *pf) · 40 unmodified lines
335 dev_err(dev, "failed to reserve vectors for RDMA\n");335 dev_err(dev, "failed to reserve vectors for RDMA\n");
336 return ret;336 return ret;
337 }337 }
338 338 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2;
339 return ice_plug_aux_dev(pf);339 return ice_plug_aux_dev(pf);
340}340}
drivers/net/ethernet/intel/ice/ice_main.c+8−1
@@ -4705,6 +4705,10 @@ probe_done: · 4704 unmodified lines
4705 if (err)4705 if (err)
4706 goto err_netdev_reg;4706 goto err_netdev_reg;
4707 4707
4708 err = ice_devlink_register_params(pf);
4709 if (err)
4710 goto err_netdev_reg;
4711
4708 /* ready to go, so clear down state bit */4712 /* ready to go, so clear down state bit */
4709 clear_bit(ICE_DOWN, pf->state);4713 clear_bit(ICE_DOWN, pf->state);
4710 if (ice_is_aux_ena(pf)) {4714 if (ice_is_aux_ena(pf)) {
@@ -4712,7 +4716,7 @@ probe_done: · 1 unmodified line
4712 if (pf->aux_idx < 0) {4716 if (pf->aux_idx < 0) {
4713 dev_err(dev, "Failed to allocate device ID for AUX driver\n");4717 dev_err(dev, "Failed to allocate device ID for AUX driver\n");
4714 err = -ENOMEM;4718 err = -ENOMEM;
4715 goto err_netdev_reg;4719 goto err_devlink_reg_param;
4716 }4720 }
4717 4721
4718 err = ice_init_rdma(pf);4722 err = ice_init_rdma(pf);
@@ -4731,6 +4735,8 @@ probe_done: · 12 unmodified lines
4731err_init_aux_unroll:4735err_init_aux_unroll:
4732 pf->adev = NULL;4736 pf->adev = NULL;
4733 ida_free(&ice_aux_ida, pf->aux_idx);4737 ida_free(&ice_aux_ida, pf->aux_idx);
4738err_devlink_reg_param:
4739 ice_devlink_unregister_params(pf);
4734err_netdev_reg:4740err_netdev_reg:
4735err_send_version_unroll:4741err_send_version_unroll:
4736 ice_vsi_release_all(pf);4742 ice_vsi_release_all(pf);
@@ -4845,6 +4851,7 @@ static void ice_remove(struct pci_dev *pdev) · 108 unmodified lines
4845 ice_unplug_aux_dev(pf);4851 ice_unplug_aux_dev(pf);
4846 if (pf->aux_idx >= 0)4852 if (pf->aux_idx >= 0)
4847 ida_free(&ice_aux_ida, pf->aux_idx);4853 ida_free(&ice_aux_ida, pf->aux_idx);
4854 ice_devlink_unregister_params(pf);
4848 set_bit(ICE_DOWN, pf->state);4855 set_bit(ICE_DOWN, pf->state);
4849 4856
4850 mutex_destroy(&(&pf->hw)->fdir_fltr_lock);4857 mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
include/linux/net/intel/iidc.h+5−2
@@ -26,6 +26,11 @@ enum iidc_reset_type { · 25 unmodified lines
26 IIDC_GLOBR,26 IIDC_GLOBR,
27};27};
28 28
29enum iidc_rdma_protocol {
30 IIDC_RDMA_PROTOCOL_IWARP = BIT(0),
31 IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1),
32};
33
29#define IIDC_MAX_USER_PRIORITY 834#define IIDC_MAX_USER_PRIORITY 8
30 35
31/* Struct to hold per RDMA Qset info */36/* Struct to hold per RDMA Qset info */
@@ -70,8 +75,6 @@ int ice_rdma_request_reset(struct ice_pf *pf, enum iidc_reset_type reset_type); · 38 unmodified lines
70int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);75int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);
71void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);76void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);
72 77
73#define IIDC_RDMA_ROCE_NAME "roce"
74
75/* Structure representing auxiliary driver tailored information about the core78/* Structure representing auxiliary driver tailored information about the core
76 * PCI dev, each auxiliary driver using the IIDC interface will have an79 * PCI dev, each auxiliary driver using the IIDC interface will have an
77 * instance of this struct dedicated to it.80 * instance of this struct dedicated to it.
include/net/devlink.h+4−0
@@ -485,6 +485,7 @@ enum devlink_param_generic_id { · 484 unmodified lines
485 DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,485 DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
486 DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,486 DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
487 DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET,487 DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET,
488 DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP,
488 489
489 /* add new param generic ids above here*/490 /* add new param generic ids above here*/
490 __DEVLINK_PARAM_GENERIC_ID_MAX,491 __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -534,6 +535,9 @@ enum devlink_param_generic_id { · 43 unmodified lines
534#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME "enable_vnet"535#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME "enable_vnet"
535#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE DEVLINK_PARAM_TYPE_BOOL536#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE DEVLINK_PARAM_TYPE_BOOL
536 537
538#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME "enable_iwarp"
539#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE DEVLINK_PARAM_TYPE_BOOL
540
537#define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \541#define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
538{ \542{ \
539 .id = DEVLINK_PARAM_GENERIC_ID_##_id, \543 .id = DEVLINK_PARAM_GENERIC_ID_##_id, \
net/core/devlink.c+5−0
@@ -4432,6 +4432,11 @@ static const struct devlink_param devlink_param_generic[] = { · 4431 unmodified lines
4432 .name = DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME,4432 .name = DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME,
4433 .type = DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE,4433 .type = DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE,
4434 },4434 },
4435 {
4436 .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP,
4437 .name = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME,
4438 .type = DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE,
4439 },
4435};4440};
4436 4441
4437static int devlink_param_generic_verify(const struct devlink_param *param)4442static int devlink_param_generic_verify(const struct devlink_param *param)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t