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
109109 - Boolean
110110 - When enabled, the device driver will instantiate VDPA networking
111111 specific auxiliary device of the devlink device.
112+ * - ``enable_iwarp``
113+ - Boolean
114+ - Enable handling of iWARP traffic in the device.
112115 * - ``internal_err_reset``
113116 - Boolean
114117 - 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
228228 rf->msix_count = pf->num_rdma_msix;
229229 rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector];
230230 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;
232233 rf->rdma_ver = IRDMA_GEN_2;
233234 rf->rsrc_profile = IRDMA_HMC_PROFILE_DEFAULT;
234235 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
576576 struct ice_hw_port_stats stats_prev;
577577 struct ice_hw hw;
578578 u8 stat_prev_loaded:1; /* has previous stats been loaded */
579+ u8 rdma_mode;
579580 u16 dcbx_cap;
580581 u32 tx_timeout_count;
581582 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
430430 .flash_update = ice_devlink_flash_update,
431431 };
432432
433+static int
434+ice_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+
444+static int
445+ice_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+
466+static int
467+ice_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+
484+static int
485+ice_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+
495+static int
496+ice_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+
517+static int
518+ice_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+
535+static 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+
433547 static void ice_devlink_free(void *devlink_ptr)
434548 {
435549 devlink_free((struct devlink *)devlink_ptr);
@@ -484,6 +598,36 @@ void ice_devlink_unregister(struct ice_pf *pf) · 48 unmodified lines
484598 devlink_unregister(priv_to_devlink(pf));
485599 }
486600
601+int 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+
625+void 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+
487631 /**
488632 * ice_devlink_create_pf_port - Create a devlink port for this PF
489633 * @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
44 #ifndef _ICE_DEVLINK_H_
55 #define _ICE_DEVLINK_H_
66
7+enum ice_devlink_param_id {
8+ ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
9+};
10+
711 struct ice_pf *ice_allocate_pf(struct device *dev);
812
913 void ice_devlink_register(struct ice_pf *pf);
1014 void ice_devlink_unregister(struct ice_pf *pf);
15+int ice_devlink_register_params(struct ice_pf *pf);
16+void ice_devlink_unregister_params(struct ice_pf *pf);
1117 int ice_devlink_create_pf_port(struct ice_pf *pf);
1218 void ice_devlink_destroy_pf_port(struct ice_pf *pf);
1319 int 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
288288 adev->id = pf->aux_idx;
289289 adev->dev.release = ice_adev_release;
290290 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";
292292
293293 ret = auxiliary_device_init(adev);
294294 if (ret) {
@@ -335,6 +335,6 @@ int ice_init_rdma(struct ice_pf *pf) · 40 unmodified lines
335335 dev_err(dev, "failed to reserve vectors for RDMA\n");
336336 return ret;
337337 }
338−
338+ pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2;
339339 return ice_plug_aux_dev(pf);
340340 }
drivers/net/ethernet/intel/ice/ice_main.c+8−1
@@ -4705,6 +4705,10 @@ probe_done: · 4704 unmodified lines
47054705 if (err)
47064706 goto err_netdev_reg;
47074707
4708+ err = ice_devlink_register_params(pf);
4709+ if (err)
4710+ goto err_netdev_reg;
4711+
47084712 /* ready to go, so clear down state bit */
47094713 clear_bit(ICE_DOWN, pf->state);
47104714 if (ice_is_aux_ena(pf)) {
@@ -4712,7 +4716,7 @@ probe_done: · 1 unmodified line
47124716 if (pf->aux_idx < 0) {
47134717 dev_err(dev, "Failed to allocate device ID for AUX driver\n");
47144718 err = -ENOMEM;
4715− goto err_netdev_reg;
4719+ goto err_devlink_reg_param;
47164720 }
47174721
47184722 err = ice_init_rdma(pf);
@@ -4731,6 +4735,8 @@ probe_done: · 12 unmodified lines
47314735 err_init_aux_unroll:
47324736 pf->adev = NULL;
47334737 ida_free(&ice_aux_ida, pf->aux_idx);
4738+err_devlink_reg_param:
4739+ ice_devlink_unregister_params(pf);
47344740 err_netdev_reg:
47354741 err_send_version_unroll:
47364742 ice_vsi_release_all(pf);
@@ -4845,6 +4851,7 @@ static void ice_remove(struct pci_dev *pdev) · 108 unmodified lines
48454851 ice_unplug_aux_dev(pf);
48464852 if (pf->aux_idx >= 0)
48474853 ida_free(&ice_aux_ida, pf->aux_idx);
4854+ ice_devlink_unregister_params(pf);
48484855 set_bit(ICE_DOWN, pf->state);
48494856
48504857 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
2626 IIDC_GLOBR,
2727 };
2828
29+enum iidc_rdma_protocol {
30+ IIDC_RDMA_PROTOCOL_IWARP = BIT(0),
31+ IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1),
32+};
33+
2934 #define IIDC_MAX_USER_PRIORITY 8
3035
3136 /* 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
7075 int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);
7176 void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);
7277
73−#define IIDC_RDMA_ROCE_NAME "roce"
74−
7578 /* Structure representing auxiliary driver tailored information about the core
7679 * PCI dev, each auxiliary driver using the IIDC interface will have an
7780 * 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
485485 DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
486486 DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
487487 DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET,
488+ DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP,
488489
489490 /* add new param generic ids above here*/
490491 __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -534,6 +535,9 @@ enum devlink_param_generic_id { · 43 unmodified lines
534535 #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME "enable_vnet"
535536 #define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE DEVLINK_PARAM_TYPE_BOOL
536537
538+#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME "enable_iwarp"
539+#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE DEVLINK_PARAM_TYPE_BOOL
540+
537541 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
538542 { \
539543 .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
44324432 .name = DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME,
44334433 .type = DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE,
44344434 },
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+ },
44354440 };
44364441
44374442 static 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