Skip to contentSkip to conversation

dev Digest, Vol 132, Issue 84

DISCUSSION Lin, Xueqin 1 participant 1 message Mar 9, 2017 1 message not in the archive Network drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Lin, Xueqin

author Acked-by Wenzhuo Lu
#1 lore raw

Test by: Lin Xueqin
[PATCH] net/i40e: enable statistic reset for VF (Qi Zhang)
NIC: 25G NIC
Steps:
1. Get the pci device id of DUT
./tools/dpdk-devbind.py --st
0000:81:00.0 'Device 158b' if=eth27 drv=i40e unused=igb_uio
2. Host PF in DPDK driver.

root@dpdk-test03:~/dpdk# ./tools/dpdk-devbind.py --bind=igb_uio 81:00.0
root@dpdk-test03:~/dpdk# echo 1 >/sys/bus/pci/devices/0000:81:00.0/max_vfs
3. Detach VF from the host
root@dpdk-test03:~/dpdk# rmmod i40evf
0000:81:02.0 'XL710 X710 Virtual Function' unused=igb_uio
4. Launch the VM1 with the VF PCI pass through.
 5. Bind port to igb_uio on the VM1
VM1: 
./tools/dpdk-devbind.py --bind=igb_uio 00:03.0
6. Setup host and VM1 testpmd 
host: 
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -- -i --port-topology=chained
VM1: 
./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 4 -- -i --port-topology=chained
Port 0: 1A:BD:C8:42:CA:35
 Checking link statuses...
 Port 0 Link Up - speed 10000 Mbps - full-duplex
 Done
7. Set mac forwarding and start testpmd
testpmd> set fwd mac
Set mac packet forwarding mode
testpmd> start
8. Send packet from tester
9. Find VF can receive packet, but clear stats can't work.
testpmd> show port stats all

######################## NIC statistics for port 0 ########################
RX-packets: 10 RX-missed: 0 RX-bytes: 1080
RX-errors: 0
RX-nombuf: 0
TX-packets: 10 TX-errors: 0 TX-bytes: 1040

Throughput (since last show)
Rx-pps: 0
Tx-pps: 0
############################################################################
testpmd> clear port stats all

NIC statistics for port 0 cleared
testpmd> show port stats all

######################## NIC statistics for port 0 ########################
RX-packets: 10 RX-missed: 0 RX-bytes: 1080
RX-errors: 0
RX-nombuf: 0
TX-packets: 10 TX-errors: 0 TX-bytes: 1040

Throughput (since last show)
Rx-pps: 0
Tx-pps: 0
############################################################################

Result: clear port stats can't work.

Check with Qi about this, change below code not to check version then run cmd can call i40evf_reset_statistics(dev) function. Repeat above test steps verify clear port stats cmd can work.

drivers/net/i40e/i40e_ethdev_vf.c
static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,

 {
        struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
        /* only DPDK PF support this */
-       if (vf->version_major == I40E_DPDK_VERSION_MAJOR) {
+       if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
                if (i40evf_reset_statistics(dev))
                        PMD_DRV_LOG(ERR, "Reset statistics failed");
        }

Best regards,
Xueqin

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of [email protected]
Sent: Friday, February 24, 2017 11:25 AM
To: [email protected]
Subject: dev Digest, Vol 132, Issue 84

Send dev mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
http://dpdk.org/ml/listinfo/dev
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of dev digest..."

Today's Topics:

1. Re: [PATCH v2] e1000/base: fix multicast setting in VF (Lu, Wenzhuo)
2. [PATCH] net/i40e: enable statistic reset for VF (Qi Zhang)
3. [PATCH 0/8] QoS features on i40e (Wenzhuo Lu)
4. [PATCH 1/8] net/i40e: set VF max bandwidth from PF (Wenzhuo Lu)
5. [PATCH 2/8] net/i40e: allocate VF TC bandwidth from PF (Wenzhuo Lu)
6. [PATCH 3/8] net/i40e: set VF TC max bandwidth from PF (Wenzhuo Lu)

----------------------------------------------------------------------

Message: 1
Date: Fri, 24 Feb 2017 00:32:49 +0000
From: "Lu, Wenzhuo" <[email protected]>
To: Yong Wang <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] e1000/base: fix multicast setting
in VF
Message-ID:

	<6A0DE07E22DDAD4C9103DF62FEBC09093B56802E@shsmsx102.ccr.corp.intel.com>

Content-Type: text/plain; charset="us-ascii"

Hi,

Quoted 12 lines

-----Original Message-----
From: Yong Wang [mailto:[email protected]]
Sent: Tuesday, February 21, 2017 5:33 PM
To: Lu, Wenzhuo
Cc: [email protected]; Yong Wang
Subject: [PATCH v2] e1000/base: fix multicast setting in VF

In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW". And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST". Fix it by moving the second line prior to the first one that mentioned above.

Quoted 5 lines

---
v2:
* According to Thomas's suggestion, modify the title.

------------------------------

Message: 2
Date: Thu, 23 Feb 2017 13:27:01 -0500
From: Qi Zhang <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], Qi Zhang <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: enable statistic reset for VF
Message-ID: <[email protected]>

The patch implements the dev_ops "stats_reset" for VF.

---
 drivers/net/i40e/i40e_ethdev_vf.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_pf.c        | 25 +++++++++++++++++++++++++
 drivers/net/i40e/i40e_pf.h        |  1 +
 3 files changed, 60 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index 55fd344..5155b25 100644
@@ -110,6 +110,7 @@ static int i40evf_dev_link_update(struct rte_eth_dev *dev,
 				  __rte_unused int wait_to_complete);  static void i40evf_dev_stats_get(struct rte_eth_dev *dev,
 				struct rte_eth_stats *stats);
+static void i40evf_dev_stats_reset(struct rte_eth_dev *dev);
 static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
 				 struct rte_eth_xstat *xstats, unsigned n);  static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev, @@ -199,6 +200,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.allmulticast_disable = i40evf_dev_allmulticast_disable,
 	.link_update          = i40evf_dev_link_update,
 	.stats_get            = i40evf_dev_stats_get,
+	.stats_reset          = i40evf_dev_stats_reset,
 	.xstats_get           = i40evf_dev_xstats_get,
 	.xstats_get_names     = i40evf_dev_xstats_get_names,
 	.xstats_reset         = i40evf_dev_xstats_reset,

@@ -988,6 +990,27 @@ i40evf_get_statistics(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0;
}

+static int
+i40evf_reset_statistics(struct rte_eth_dev *dev) {
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ int err;
+ struct vf_cmd_info args;
+ u16 vsi_id = vf->vsi_res->vsi_id;
+
+ args.ops = (enum i40e_virtchnl_ops)I40E_VIRTCHNL_OP_RESET_STATS;
+ args.in_args = (uint8_t *)&vsi_id;
+ args.in_args_size = sizeof(vsi_id);
+ args.out_buffer = vf->aq_resp;
+ args.out_size = I40E_AQ_BUF_SZ;
+
+ err = i40evf_execute_vf_cmd(dev, &args);
+ if (err)
+ PMD_DRV_LOG(ERR, "fail to execute command CFG_VLAN_OFFLOAD");
+
+ return err;
+}
+
static void
i40evf_dev_xstats_reset(struct rte_eth_dev *dev) { @@ -2310,6 +2333,17 @@ i40evf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) }

static void
+i40evf_dev_stats_reset(struct rte_eth_dev *dev) {
+ struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ /* only DPDK PF support this */
+ if (vf->version_major == I40E_DPDK_VERSION_MAJOR) {
+ if (i40evf_reset_statistics(dev))
+ PMD_DRV_LOG(ERR, "Reset statistics failed");
+ }
+}
+
+static void
i40evf_dev_close(struct rte_eth_dev *dev) {
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);

drivers/net/i40e/i40e_pf.c +21 -0
@@ -1155,6 +1155,27 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 	return ret;
 }
 
+static int
+i40e_pf_host_process_cmd_reset_stats(struct i40e_pf_vf *vf,
+					bool b_op)
+{
+	vf->vsi->offset_loaded = false;
+	i40e_update_vsi_stats(vf->vsi);
+
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_RESET_STATS,
+					    I40E_SUCCESS,
+					    NULL,
+					    0);
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_RESET_STATS,
+					    I40E_NOT_SUPPORTED,
+					    NULL,
+					    0);
+
+	return I40E_SUCCESS;
+}
+
 void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)  { @@ -1300,6 +1321,10 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received");

i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen, b_op); break;
+ case I40E_VIRTCHNL_OP_RESET_STATS:
+ PMD_DRV_LOG(INFO, "OP_RESET_STATS received");
+ i40e_pf_host_process_cmd_reset_stats(vf, b_op);
+ break;
/* Don't add command supported below, which will
* return an error code.
*/

drivers/net/i40e/i40e_pf.h +1 -0
@@ -58,6 +58,7 @@ enum i40e_virtchnl_ops_dpdk {
 						I40E_DPDK_OFFSET,
 	I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
 	I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT,
+	I40E_VIRTCHNL_OP_RESET_STATS,
 };
 
 /* A structure to support extended info of a receive queue. */

--
2.7.4

------------------------------

Message: 3
Date: Fri, 24 Feb 2017 11:24:27 +0800
From: Wenzhuo Lu <[email protected]>
To: [email protected]
Cc: Wenzhuo Lu <[email protected]>
Subject: [dpdk-dev] [PATCH 0/8] QoS features on i40e
Message-ID: <[email protected]>

This patch set enables several QoS features on i40e.
1, VF max bandwidth setting.
2, TC min bandwidth setting on a VF.
3, TC max bandwidth setting on a VF.
4, TC TX scheduling mode setting.
As there're no new interface between PF and VF defined, all the settings for VF are done on PF. PF acts as a controller for the VFs.

Wenzhuo Lu (8):
net/i40e: set VF max bandwidth from PF
net/i40e: allocate VF TC bandwidth from PF
net/i40e: set VF TC max bandwidth from PF
net/i40e: set TC strict priority mode
app/testpmd: set VF TX max bandwidth
app/testpmd: set VF TC TX min bandwidth
app/testpmd: set VF TC TX max bandwidth
app/testpmd: set TC strict link priority mode

 app/test-pmd/cmdline.c                      | 343 +++++++++++++++++++++
 doc/guides/nics/i40e.rst                    |  21 ++
 doc/guides/rel_notes/release_17_05.rst      |  20 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  28 ++
 drivers/net/i40e/i40e_ethdev.c              | 449 ++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.h              |   1 +
 drivers/net/i40e/rte_pmd_i40e.h             |  86 ++++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |  10 +
 8 files changed, 958 insertions(+)
Signature · 25 lines
1.9.3



------------------------------

Message: 4
Date: Fri, 24 Feb 2017 11:24:28 +0800
From: Wenzhuo Lu <[email protected]>
To: [email protected]
Cc: Wenzhuo Lu <[email protected]>
Subject: [dpdk-dev] [PATCH 1/8] net/i40e: set VF max bandwidth from PF
Message-ID: <[email protected]>

Support setting VF max bandwidth from PF.
User can call the API on PF to set a specific VF's
max bandwidth.

Signed-off-by: Wenzhuo Lu <[email protected]>
---
 doc/guides/rel_notes/release_17_05.rst    |  3 +
 drivers/net/i40e/i40e_ethdev.c            | 94 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 23 ++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  7 +++
 4 files changed, 127 insertions(+)
doc/guides/rel_notes/release_17_05.rst +3 -0
index e25ea9f..f41a839 100644
@@ -41,6 +41,9 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added VF max bandwidth setting on i40e.**
+
+  i40e HW supports to set the max bandwidth for a VF. Enable this capability.
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +94 -0

103 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +23 -0
index a0ad88c..224ec4f 100644
@@ -332,4 +332,27 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,
 int rte_pmd_i40e_reset_vf_stats(uint8_t port,
 				uint16_t vf_id);
 
+/**
+ * Set VF's max bandwidth.
+ *
+ * Per VF bandwidth limitation and per TC bandwidth limitation cannot
+ * be enabled in parallel. If per TC bandwidth is enabled, this function
+ * will disable it.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf_id
+ *    ID specifying VF.
+ * @param bw
+ *    Bandwidth for this VF.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
+			       uint16_t vf_id,
+			       uint32_t bw);
+
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +7 -0
index 7a5d211..1d9dcf8 100644
@@ -22,3 +22,10 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_tag;
 
 } DPDK_2.0;
+
+DPDK_17.05 {
+	global:
+
+	rte_pmd_i40e_set_vf_max_bw;
+
+} DPDK_17.02;
Signature · 28 lines
1.9.3



------------------------------

Message: 5
Date: Fri, 24 Feb 2017 11:24:29 +0800
From: Wenzhuo Lu <[email protected]>
To: [email protected]
Cc: Wenzhuo Lu <[email protected]>
Subject: [dpdk-dev] [PATCH 2/8] net/i40e: allocate VF TC bandwidth
	from PF
Message-ID: <[email protected]>

Allocate all TCs' relative bandwidth (percentage) on
a specific VF.
It can be taken as relative min bandwidth setting.
User can call the API to set VF TC's min bandwidth
from PF.

Signed-off-by: Wenzhuo Lu <[email protected]>
---
 doc/guides/rel_notes/release_17_05.rst    |   5 ++
 drivers/net/i40e/i40e_ethdev.c            | 118 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  26 +++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 4 files changed, 150 insertions(+)
doc/guides/rel_notes/release_17_05.rst +5 -0
index f41a839..a726138 100644
@@ -45,6 +45,11 @@ New Features
 
   i40e HW supports to set the max bandwidth for a VF. Enable this capability.
 
+* **Added VF TC min bandwidth setting on i40e.**
+
+  i40e HW supports to set the allocated bandwidth for a TC on a VF. Enable this
+  capability.
+
 Resolved Issues
 ---------------
 
drivers/net/i40e/i40e_ethdev.c +118 -0

127 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +26 -0
index 224ec4f..9fdb447 100644
@@ -355,4 +355,30 @@ int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
 			       uint16_t vf_id,
 			       uint32_t bw);
 
+/**
+ * Set all the TCs' bandwidth weight on a specific VF.
+ *
+ * The bw_weight means the percentage occupied by the TC.
+ * It can be taken as the relative min bandwidth setting.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf_id
+ *    ID specifying VF.
+ * @param tc_num
+ *    Number of TCs.
+ * @param bw_weight
+ *    An array of relative bandwidth weight for all the TCs.
+ *    The summary of the bw_weight should be 100.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
+				    uint16_t vf_id,
+				    uint8_t tc_num,
+				    uint8_t *bw_weight);
+
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index 1d9dcf8..85bc41d 100644
@@ -27,5 +27,6 @@ DPDK_17.05 {
 	global:
 
 	rte_pmd_i40e_set_vf_max_bw;
+	rte_pmd_i40e_set_vf_tc_bw_alloc;
 
 } DPDK_17.02;
Signature · 27 lines
1.9.3



------------------------------

Message: 6
Date: Fri, 24 Feb 2017 11:24:30 +0800
From: Wenzhuo Lu <[email protected]>
To: [email protected]
Cc: Wenzhuo Lu <[email protected]>
Subject: [dpdk-dev] [PATCH 3/8] net/i40e: set VF TC max bandwidth from
	PF
Message-ID: <[email protected]>

Set a specific TC's max bandwidth on a VF.
User can call the API to set VF TC's max bandwidth
from PF.

Signed-off-by: Wenzhuo Lu <[email protected]>
---
 doc/guides/nics/i40e.rst                  |  11 +++
 doc/guides/rel_notes/release_17_05.rst    |   5 ++
 drivers/net/i40e/i40e_ethdev.c            | 118 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  22 ++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 157 insertions(+)
doc/guides/nics/i40e.rst +11 -0
index b890613..260287e 100644
@@ -467,3 +467,14 @@ Incorrect Rx statistics when packet is oversize
 When a packet is over maximum frame size, the packet is dropped.
 However the Rx statistics, when calling `rte_eth_stats_get` incorrectly
 shows it as received.
+
+VF & TC max bandwidth setting
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The per VF max bandwidth and per TC max bandwidth cannot be enabled in parallel.
+The dehavior is different when handling per VF and per TC max bandwidth setting.
+When enabling per VF max bandwidth, SW will check if per TC max bandwidth is
+enabled. If so, return failure.
+When enabling per TC max bandwidth, SW will check if per VF max bandwidth
+is enabled. If so, disable per VF max bandwidth and continue with per TC max
+bandwidth setting.
doc/guides/rel_notes/release_17_05.rst +5 -0
index a726138..d31435c 100644
@@ -50,6 +50,11 @@ New Features
   i40e HW supports to set the allocated bandwidth for a TC on a VF. Enable this
   capability.
 
+* **Added VF TC max bandwidth setting on i40e.**
+
+  i40e HW supports to set the max bandwidth for a TC on a VF. Enable this
+  capability.
+
 Resolved Issues
 ---------------
 
drivers/net/i40e/i40e_ethdev.c +118 -0

121 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +22 -0
index 9fdb447..08ee2b0 100644
@@ -381,4 +381,26 @@ int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
 				    uint8_t tc_num,
 				    uint8_t *bw_weight);
 
+/**
+ * Set a specific TC's max bandwidth on a specific VF.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf_id
+ *    ID specifying VF.
+ * @param tc_no
+ *    Number specifying TC.
+ * @param bw
+ *    Max bandwidth for this TC.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,
+				  uint16_t vf_id,
+				  uint8_t tc_no,
+				  uint32_t bw);
+
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index 85bc41d..bd657ab 100644
@@ -28,5 +28,6 @@ DPDK_17.05 {
 
 	rte_pmd_i40e_set_vf_max_bw;
 	rte_pmd_i40e_set_vf_tc_bw_alloc;
+	rte_pmd_i40e_set_vf_tc_max_bw;
 
 } DPDK_17.02;
Signature · 6 lines
1.9.3



End of dev Digest, Vol 132, Issue 84
************************************