Skip to contentSkip to conversation

ice: Enable configuration of number of qps per VF via devlink

PATCH New Sridhar Samudrala 2 participants 5 messages Apr 26, 2021 – Jun 23, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ice: Enable configuration of number of qps per VF via devlink

Introduce a devlink parameter 'num_qps_per_vf' to allow user to configure the maximum number of queue pairs given to SR-IOV VFs before they are created.

This is currently determined by the driver based on the number of SR-IOV VFs created. In order to keep this behavior by default the parameter is initialized to 0. To change the default behavior, user can set num_qps_per_vf parameter via devlink and this will be used as the preferred value to determine the queues and vectors assigned per VF.

USAGE:
On a 2 port NIC

 # devlink dev param show
 pci/0000:42:00.0:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 0
 pci/0000:42:00.1:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 0

/* Set num_qps_per_vf to 4 */

 # devlink dev param set pci/0000:42:00.0 name num_qps_per_vf value 4 cmode runtime
 # devlink dev param show pci/0000:42:00.0 name num_qps_per_vf
 pci/0000:42:00.0:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 4
 # echo 8 > /sys/class/net/enp66s0f0/device/sriov_numvfs

This will create 8 VFs with 4 queue pairs and 5 vectors per VF compared to the default behavior of 16 queue pairs and 17 vectors per VF.

v2:
Fixed kdoc for ice_devlink_num_qps_per_vf_validate()

---
 Documentation/networking/devlink/ice.rst      |  23 ++++
 drivers/net/ethernet/intel/ice/ice_devlink.c  | 110 +++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_main.c     |   3 +
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |   5 +-
 4 files changed, 139 insertions(+), 2 deletions(-)
Documentation/networking/devlink/ice.rst +23 -0
index a432dc419fa4..38bed190fa48 100644
@@ -193,3 +193,26 @@ Users can request an immediate capture of a snapshot via the
     0000000000000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
     $ devlink region delete pci/0000:01:00.0/device-caps snapshot 1
+
+Parameters
+==========
+
+The ``ice`` driver implements the following driver-specific
+parameters.
+
+.. list-table:: Driver-specific parameters implemented
+   :widths: 5 5 5 85
+
+   * - Name
+     - Type
+     - Mode
+     - Description
+   * - ``num_qps_per_vf``
+     - u16
+     - runtime
+     - Number of queue pairs assigned to SR-IOV VFs. The default
+       value is 0 indicating that the driver will determine based
+       on the number of SR-IOV VFs created and the available resources.
+       It can be set to a value between 1 to 16 and is used as a
+       preferred value in determining the queues and vectors assigned
+       per VF.
drivers/net/ethernet/intel/ice/ice_devlink.c +109 -1

134 lines not on this page · raw message

drivers/net/ethernet/intel/ice/ice_main.c +3 -0
index 4ee85a217c6f..89f30255b711 100644
@@ -4092,6 +4092,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	}
 
 	ice_devlink_init_regions(pf);
+	devlink_params_publish(priv_to_devlink(pf));
 
 	pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port;
 	pf->hw.udp_tunnel_nic.unset_port = ice_udp_tunnel_unset_port;
@@ -4285,6 +4286,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	devm_kfree(dev, pf->vsi);
 err_init_pf_unroll:
 	ice_deinit_pf(pf);
+	devlink_params_unpublish(priv_to_devlink(pf));
 	ice_devlink_destroy_regions(pf);
 	ice_deinit_hw(hw);
 err_exit_unroll:
@@ -4398,6 +4400,7 @@ static void ice_remove(struct pci_dev *pdev)
 		ice_vsi_free_q_vectors(pf->vsi[i]);
 	}
 	ice_deinit_pf(pf);
+	devlink_params_unpublish(priv_to_devlink(pf));
 	ice_devlink_destroy_regions(pf);
 	ice_deinit_hw(&pf->hw);
 	ice_devlink_unregister(pf);
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +4 -1
index a1d22d2aa0bd..18538b1c57c1 100644
@@ -637,6 +637,7 @@ void ice_free_vfs(struct ice_pf *pf)
 
 	tmp = pf->num_alloc_vfs;
 	pf->num_qps_per_vf = 0;
+	pf->num_msix_per_vf = 0;
 	pf->num_alloc_vfs = 0;
 	for (i = 0; i < tmp; i++) {
 		if (test_bit(ICE_VF_STATE_INIT, pf->vf[i].vf_states)) {
@@ -1228,7 +1229,9 @@ static int ice_set_per_vf_res(struct ice_pf *pf)
 	msix_avail_for_sriov = pf->hw.func_caps.common_cap.num_msix_vectors -
 		pf->irq_tracker->num_entries;
 	msix_avail_per_vf = msix_avail_for_sriov / pf->num_alloc_vfs;
-	if (msix_avail_per_vf >= ICE_NUM_VF_MSIX_MED) {
+	if (pf->num_msix_per_vf && msix_avail_per_vf >= pf->num_msix_per_vf) {
+		num_msix_per_vf = pf->num_msix_per_vf;
+	} else if (msix_avail_per_vf >= ICE_NUM_VF_MSIX_MED) {
 		num_msix_per_vf = ICE_NUM_VF_MSIX_MED;
 	} else if (msix_avail_per_vf >= ICE_NUM_VF_MSIX_SMALL) {
 		num_msix_per_vf = ICE_NUM_VF_MSIX_SMALL;
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/1 ice: Enable configuration of number of qps per VF via devlink

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Sridhar Samudrala
Sent: Monday, April 26, 2021 11:20 AM
To: intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>; Samudrala, Sridhar <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Introduce a devlink parameter 'num_qps_per_vf' to allow user to configure the maximum number of queue pairs given to SR-IOV VFs before they are created.

Quoted 6 lines

This is currently determined by the driver based on the number of SR-IOV VFs created. In order to keep this behavior by default the parameter is initialized to 0. To change the default behavior, user can set num_qps_per_vf parameter via devlink and this will be used as the preferred value to determine the queues and vectors assigned per VF.

What if the host administrator wants to give the VF a different number of vectors than queues? For example, if the admin knows the VF instance will be exercising VF RDMA and the VF needs more vectors for RDMA traffic.

Should we have 2 separate values, i.e. "num_qps_per_vf" and "num_msix_per_vf"?

Quoted 39 lines

USAGE:
On a 2 port NIC

 # devlink dev param show
 pci/0000:42:00.0:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 0
 pci/0000:42:00.1:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 0

/* Set num_qps_per_vf to 4 */

 # devlink dev param set pci/0000:42:00.0 name num_qps_per_vf value 4 cmode runtime
 # devlink dev param show pci/0000:42:00.0 name num_qps_per_vf
 pci/0000:42:00.0:
   name num_qps_per_vf type driver-specific
     values:
       cmode runtime value 4
 # echo 8 > /sys/class/net/enp66s0f0/device/sriov_numvfs

This will create 8 VFs with 4 queue pairs and 5 vectors per VF compared to the default behavior of 16 queue pairs and 17 vectors per VF.

v2:
Fixed kdoc for ice_devlink_num_qps_per_vf_validate()

---
 Documentation/networking/devlink/ice.rst      |  23 ++++
 drivers/net/ethernet/intel/ice/ice_devlink.c  | 110 +++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_main.c     |   3 +
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |   5 +-
 4 files changed, 139 insertions(+), 2 deletions(-)

<snip>

#2 lore raw

PATCH v2 1/1 ice: Enable configuration of number of qps per VF via devlink

Quoted 17 lines · Brett
Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Sridhar Samudrala
Sent: Monday, April 26, 2021 11:20 AM
To: intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>; Samudrala, Sridhar <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Introduce a devlink parameter 'num_qps_per_vf' to allow user to configure the maximum number of queue pairs given to SR-IOV VFs before they are created.

Quoted 6 lines

This is currently determined by the driver based on the number of SR-IOV VFs created. In order to keep this behavior by default the parameter is initialized to 0. To change the default behavior, user can set num_qps_per_vf parameter via devlink and this will be used as the preferred value to determine the queues and vectors assigned per VF.

Quoted 7 lines

What if the host administrator wants to give the VF a different number of vectors than queues? For example, if the admin knows the VF instance will be exercising VF RDMA and the VF needs more vectors for RDMA traffic.

Should we have 2 separate values, i.e. "num_qps_per_vf" and "num_msix_per_vf"?

I missed responding to this comment.
Sure. We can add num_msix_pr_vf as a later patch to enable additional vectors for RDMA.

Tony,
Can this patch be included in your series when you submit to netdev? OR do i need to rebase it based on the latest net-next?

Thanks
Sridhar

Quoted 41 lines
Quoted 39 lines

USAGE:
On a 2 port NIC

  # devlink dev param show
  pci/0000:42:00.0:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 0
  pci/0000:42:00.1:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 0

/* Set num_qps_per_vf to 4 */

  # devlink dev param set pci/0000:42:00.0 name num_qps_per_vf value 4 cmode runtime
  # devlink dev param show pci/0000:42:00.0 name num_qps_per_vf
  pci/0000:42:00.0:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 4
  # echo 8 > /sys/class/net/enp66s0f0/device/sriov_numvfs

This will create 8 VFs with 4 queue pairs and 5 vectors per VF compared to the default behavior of 16 queue pairs and 17 vectors per VF.

v2:
Fixed kdoc for ice_devlink_num_qps_per_vf_validate()

---
  Documentation/networking/devlink/ice.rst      |  23 ++++
  drivers/net/ethernet/intel/ice/ice_devlink.c  | 110 +++++++++++++++++-
  drivers/net/ethernet/intel/ice/ice_main.c     |   3 +
  .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |   5 +-
  4 files changed, 139 insertions(+), 2 deletions(-)

<snip>

#3 lore raw

PATCH v2 1/1 ice: Enable configuration of number of qps per VF via devlink

Sridhar, how do you do asymmetric number of queues and vectors to the VF using devlink? Or this ends up as a configuration on VF representors... I hope not.

So I am guessing you can either bulk set the number of queues for each of the VFs or you can set it per SRIOV VF ports?

Thanks
Anjali

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Samudrala, Sridhar
Sent: Wednesday, June 23, 2021 9:21 AM
To: Creeley, Brett <[email protected]>; intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>
Cc: Ismail, Mustafa <[email protected]>; Saleem, Shiraz <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Quoted 20 lines · Brett
Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Sridhar Samudrala
Sent: Monday, April 26, 2021 11:20 AM
To: intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>; Samudrala, Sridhar <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Introduce a devlink parameter 'num_qps_per_vf' to allow user to configure the maximum number of queue pairs given to SR-IOV VFs before they are created.

Quoted 6 lines

This is currently determined by the driver based on the number of SR-IOV VFs created. In order to keep this behavior by default the parameter is initialized to 0. To change the default behavior, user can set num_qps_per_vf parameter via devlink and this will be used as the preferred value to determine the queues and vectors assigned per VF.

Quoted 7 lines

What if the host administrator wants to give the VF a different number of vectors than queues? For example, if the admin knows the VF instance will be exercising VF RDMA and the VF needs more vectors for RDMA traffic.

Should we have 2 separate values, i.e. "num_qps_per_vf" and "num_msix_per_vf"?

I missed responding to this comment.
Sure. We can add num_msix_pr_vf as a later patch to enable additional vectors for RDMA.

Tony,
Can this patch be included in your series when you submit to netdev? OR do i need to rebase it based on the latest net-next?

Thanks
Sridhar

Quoted 40 lines
Quoted 32 lines

USAGE:
On a 2 port NIC

  # devlink dev param show
  pci/0000:42:00.0:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 0
  pci/0000:42:00.1:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 0

/* Set num_qps_per_vf to 4 */

  # devlink dev param set pci/0000:42:00.0 name num_qps_per_vf value 
4 cmode runtime
  # devlink dev param show pci/0000:42:00.0 name num_qps_per_vf
  pci/0000:42:00.0:
    name num_qps_per_vf type driver-specific
      values:
        cmode runtime value 4
  # echo 8 > /sys/class/net/enp66s0f0/device/sriov_numvfs

This will create 8 VFs with 4 queue pairs and 5 vectors per VF compared to the default behavior of 16 queue pairs and 17 vectors per VF.

v2:
Fixed kdoc for ice_devlink_num_qps_per_vf_validate()

Quoted 8 lines
---
  Documentation/networking/devlink/ice.rst      |  23 ++++
  drivers/net/ethernet/intel/ice/ice_devlink.c  | 110 +++++++++++++++++-
  drivers/net/ethernet/intel/ice/ice_main.c     |   3 +
  .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |   5 +-
  4 files changed, 139 insertions(+), 2 deletions(-)
Quoted 2 lines

<snip>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#4 lore raw

PATCH v2 1/1 ice: Enable configuration of number of qps per VF via devlink

Quoted 3 lines · Anjali

Sridhar, how do you do asymmetric number of queues and vectors to the VF using devlink? Or this ends up as a configuration on VF representors... I hope not.

So I am guessing you can either bulk set the number of queues for each of the VFs or you can set it per SRIOV VF ports?

This is first step in a series of patches to make VF resources configurable. The next step is to enable creating a devlink port for each VF and support port specific parameters
via the devlink port.
Then we can enable changing the queue pairs or msix-vectors for a specific instance of a VF
before it is activated rather? than all VFs having equal number of resources.

Quoted 93 lines

Thanks
Anjali

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Samudrala, Sridhar
Sent: Wednesday, June 23, 2021 9:21 AM
To: Creeley, Brett <[email protected]>; intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>
Cc: Ismail, Mustafa <[email protected]>; Saleem, Shiraz <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Quoted 20 lines · Brett
Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Sridhar Samudrala
Sent: Monday, April 26, 2021 11:20 AM
To: intel-wired-lan at lists.osuosl.org; Nguyen, Anthony L <[email protected]>; Samudrala, Sridhar <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] ice: Enable configuration of number of qps per VF via devlink

Introduce a devlink parameter 'num_qps_per_vf' to allow user to configure the maximum number of queue pairs given to SR-IOV VFs before they are created.

Quoted 6 lines

This is currently determined by the driver based on the number of SR-IOV VFs created. In order to keep this behavior by default the parameter is initialized to 0. To change the default behavior, user can set num_qps_per_vf parameter via devlink and this will be used as the preferred value to determine the queues and vectors assigned per VF.

Quoted 7 lines

What if the host administrator wants to give the VF a different number of vectors than queues? For example, if the admin knows the VF instance will be exercising VF RDMA and the VF needs more vectors for RDMA traffic.

Should we have 2 separate values, i.e. "num_qps_per_vf" and "num_msix_per_vf"?

I missed responding to this comment.
Sure. We can add num_msix_pr_vf as a later patch to enable additional vectors for RDMA.

Tony,
Can this patch be included in your series when you submit to netdev? OR do i need to rebase it based on the latest net-next?

Thanks
Sridhar

Quoted 39 lines
Quoted 31 lines

USAGE:
On a 2 port NIC

   # devlink dev param show
   pci/0000:42:00.0:
     name num_qps_per_vf type driver-specific
       values:
         cmode runtime value 0
   pci/0000:42:00.1:
     name num_qps_per_vf type driver-specific
       values:
         cmode runtime value 0

/* Set num_qps_per_vf to 4 */

   # devlink dev param set pci/0000:42:00.0 name num_qps_per_vf value
4 cmode runtime
   # devlink dev param show pci/0000:42:00.0 name num_qps_per_vf
   pci/0000:42:00.0:
     name num_qps_per_vf type driver-specific
       values:
         cmode runtime value 4
   # echo 8 > /sys/class/net/enp66s0f0/device/sriov_numvfs

This will create 8 VFs with 4 queue pairs and 5 vectors per VF compared to the default behavior of 16 queue pairs and 17 vectors per VF.

v2:
Fixed kdoc for ice_devlink_num_qps_per_vf_validate()

Quoted 8 lines
---
   Documentation/networking/devlink/ice.rst      |  23 ++++
   drivers/net/ethernet/intel/ice/ice_devlink.c  | 110 +++++++++++++++++-
   drivers/net/ethernet/intel/ice/ice_main.c     |   3 +
   .../net/ethernet/intel/ice/ice_virtchnl_pf.c  |   5 +-
   4 files changed, 139 insertions(+), 2 deletions(-)
Quoted 2 lines

<snip>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan