Skip to contentSkip to conversation

net/i40e: API to configure queue regions for RSS

PATCH In review Wei Zhao 5 participants 87 messages Aug 24, 2017 – Oct 19, 2017 Network drivers Page 1 of 2

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

cover net/i40e: API to configure queue regions for RSS

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                    | 319 ++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.h            |   6 +
 drivers/net/i40e/rte_pmd_i40e.c           | 287 +++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  39 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   7 +
 5 files changed, 658 insertions(+)
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.h            |   6 +
 drivers/net/i40e/rte_pmd_i40e.c           | 287 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  39 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   7 +
 4 files changed, 339 insertions(+)
drivers/net/i40e/i40e_ethdev.h +6 -0
index 48abc05..1d6e9b2 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_TCREGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
 
 /**
  * The overhead from MTU to max frame size.
drivers/net/i40e/rte_pmd_i40e.c +287 -0

290 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +39 -0
index 356fa89..e85997a 100644
@@ -91,6 +91,19 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set*/
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region pctype set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region pctype set */
+	RTE_PMD_I40E_UP_TC_SET,   /**< add queue region pctype set */
+	RTE_PMD_I40E_REGION_ALL_FLUSH,   /**< flush all configuration */
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +159,19 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t flowtype;
+	uint8_t queue_startIndex;
+	uint8_t queue_num;
+	uint8_t UserPriority;
+	uint8_t TrafficClasses;
+	enum rte_pmd_i40e_queue_region_op  op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -637,4 +663,17 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 				       uint8_t mask,
 				       uint32_t pkt_type);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);
+
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +7 -0
index 20cc980..77ac385 100644
@@ -45,3 +45,10 @@ DPDK_17.08 {
 	rte_pmd_i40e_get_ddp_info;
 
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_pmd_i40e_queue_region_conf;
+
+} DPDK_17.08;
Signature · 1 line
2.9.3
#2 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Thanks,
ferruh

author
#3 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

HI, Ferruh

Quoted 17 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 10 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Quoted 8 lines
Quoted 1 line

Hi Wei,

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Yes, at first I have plan to use rte_flow to implement this feature.
But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC. So, private API is selected.

Quoted 3 lines

Thanks,
ferruh

#4 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Quoted 23 lines · Wei

HI, Ferruh

Quoted 21 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

Quoted 8 lines
Quoted 4 lines

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Yes, at first I have plan to use rte_flow to implement this feature.
But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC. So, private API is selected.

I guess rte_flow headers needs to be updated for this support, how big that update, what is missing in rte_flow for this?

Even this is only for i40e, rte_flow can be an option. I believe this increases the usability of the feature for the driver.

Quoted 4 lines
Quoted 4 lines

Thanks,
ferruh

#5 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Quoted 27 lines · Ferruh Yigit
Quoted 26 lines · Wei

HI, Ferruh

Quoted 24 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

And if not, what is missing in rte_flow for this?

Yes, at first I have plan to use rte_flow to implement this feature.
But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC. So, private API is selected.

I guess rte_flow headers needs to be updated for this support, how big that update, what is missing in rte_flow for this?

Hi Wei,

Would you mind answering this?

Thanks,
ferruh

Quoted 9 lines

Even this is only for i40e, rte_flow can be an option. I believe this increases the usability of the feature for the driver.

Quoted 4 lines
Quoted 4 lines

Thanks,
ferruh

author
#6 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Hi, Ferruh

Quoted 40 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 15, 2017 7:01 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 25 lines · Ferruh Yigit
Quoted 24 lines · Wei

HI, Ferruh

Quoted 22 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Yes, at first I have plan to use rte_flow to implement this feature. But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC.

Quoted 8 lines

So, private API is selected.

Quoted 3 lines

I guess rte_flow headers needs to be updated for this support, how big that update, what is missing in rte_flow for this?

Hi Wei,

Would you mind answering this?

If we want rte_flow also to support this feature,
although there will be many new CLI command need to be Add to testpmd app,
and some code change in ethdev, for example add new member in enum rte_filter_type and so on.
But the biggest problem is to get recognize and support from expert and authority in DPDK community for this new change. By now, rte_flow has no support for rss config application, but only filter configuration. But maybe this can be a work in next release.

Quoted 13 lines

Thanks,
ferruh

Quoted 9 lines

Even this is only for i40e, rte_flow can be an option. I believe this increases the usability of the feature for the driver.

Quoted 4 lines
Quoted 4 lines

Thanks,
ferruh

#7 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Quoted 47 lines · Wei

Hi, Ferruh

Quoted 45 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 15, 2017 7:01 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 25 lines · Ferruh Yigit
Quoted 24 lines · Wei

HI, Ferruh

Quoted 22 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Yes, at first I have plan to use rte_flow to implement this feature. But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC.

So, private API is selected.

Quoted 3 lines

I guess rte_flow headers needs to be updated for this support, how big that update, what is missing in rte_flow for this?

Quoted 7 lines
Quoted 3 lines

Hi Wei,

Would you mind answering this?

If we want rte_flow also to support this feature,
although there will be many new CLI command need to be Add to testpmd app,
and some code change in ethdev, for example add new member in enum rte_filter_type and so on.

new CLI part is side effect of the rte_flow, to demonstrate how to use flow modes. I was more interested in how much change required in rte_flow header.

Quoted 1 line

But the biggest problem is to get recognize and support from expert and authority in DPDK community for this new change.

Is this is referring previous push back for rte_filter_type update, I think this can be evaluated case by case. As far as I remember previously it is rejected in favor of improving rte_flow, this time update is required to be able to use rte_flow, so I assume can be OK. I believe this can be discussed out of this patch scope.

Quoted 1 line

By now, rte_flow has no support for rss config application, but only filter configuration. But maybe this can be a work in next release.

At least it is good that this effort can be re-used later for rte_flow, I still believe this option worth investigating for further releases.

Quoted 16 lines
Quoted 15 lines

Thanks,
ferruh

Quoted 9 lines

Even this is only for i40e, rte_flow can be an option. I believe this increases the usability of the feature for the driver.

Quoted 4 lines
Quoted 4 lines

Thanks,
ferruh

author
#8 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

In reply to Ferruh Yigit

Hi, Ferruh

Quoted 36 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 6, 2017 5:11 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 29 lines · Wei

HI, Ferruh

Quoted 26 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, September 1, 2017 12:18 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 11 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

Hi Wei,

I wonder if this can be implemented using rte_flow, instead of PMD specific API?

And if not, what is missing in rte_flow for this?

Quoted 8 lines
Quoted 3 lines

Yes, at first I have plan to use rte_flow to implement this feature. But there are many opposition for this, for example, this feature is only support by i40e but not igb/ixgbe From hardware capacity, not all NIC.

So, private API is selected.

I guess rte_flow headers needs to be updated for this support, how big that update, what is missing in rte_flow for this?

If we want rte_flow also to support this feature, although there will be many new CLI command need to be
Add to testpmd app, and some code change in ethdev, for example add new member in enum rte_filter_type and so on. But the biggest problem is to get recognize and support from expert and authority in DPDK community for this new change. By now, rte_flow has no support for rss config application, but only filter configuration. But maybe this can be a work in next release.

Quoted 7 lines

Even this is only for i40e, rte_flow can be an option. I believe this increases the usability of the feature for the driver.

Quoted 4 lines
Quoted 4 lines

Thanks,
ferruh

#9 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

In reply to Wei Zhao
Quoted 52 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, August 23, 2017 8:26 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.h            |   6 +
 drivers/net/i40e/rte_pmd_i40e.c           | 287
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  39 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   7 +
 4 files changed, 339 insertions(+)
drivers/net/i40e/i40e_ethdev.h +6 -0
index 48abc05..1d6e9b2 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_TCREGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
 
 /**
  * The overhead from MTU to max frame size.
drivers/net/i40e/rte_pmd_i40e.c +0 -0
index 950a0d6..5d1e1d4 100644

drivers/net/i40e/rte_pmd_i40e.c int · line 2125

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
@@ -2117,3 +2117,290 @@ int
 rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 
 	return 0;
 }
+
+static int
+i40e_set_queue_region(struct i40e_hw *hw, struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint32_t TCREGION, TC_OFFSET, TC_SIZE;

Please follow DPDK coding style guide and use only low case for variables names.

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	uint16_t TC_SIZE_TB[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i, index;
+	uint16_t main_vsi_seid = pf->main_vsi_seid;

<snip>

drivers/net/i40e/rte_pmd_i40e.c struct rte_pmd_i40e_ptype_mapping { · line 166

Quoted 11 lines

/**

drivers/net/i40e/rte_pmd_i40e.c +5 -0
@@ -146,6 +159,19 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t flowtype;

As this is internal i40e flow type (PCTYPE), it is better name it hw_flowtype. As an option - use RTE level sw_flowtype and map it to internal hw_flowtype using corresponding i40e API.

drivers/net/i40e/rte_pmd_i40e.c struct rte_pmd_i40e_ptype_mapping { · line 169

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	uint8_t queue_startIndex;
+	uint8_t queue_num;
+	uint8_t UserPriority;

Low case for naming.

Quoted 45 lines
drivers/net/i40e/rte_pmd_i40e.c +18 -0
+	uint8_t TrafficClasses;
+	enum rte_pmd_i40e_queue_region_op  op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -637,4 +663,17 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t
 port,
 				       uint8_t mask,
 				       uint32_t pkt_type);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);
+

#endif /* _PMD_I40E_H_ */

drivers/net/i40e/rte_pmd_i40e_version.map +7 -1
index 20cc980..77ac385 100644
@@ -45,3 +45,10 @@ DPDK_17.08 {
 	rte_pmd_i40e_get_ddp_info;
 
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_pmd_i40e_queue_region_conf;
+
+} DPDK_17.08;
--

2.9.3

author
#10 lore raw

Re: [PATCH 1/2] net/i40e: queue region set and flush

Hi, Andrey

Quoted 80 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Wednesday, September 6, 2017 7:52 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

Quoted 48 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, August 23, 2017 8:26 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.h            |   6 +
 drivers/net/i40e/rte_pmd_i40e.c           | 287
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  39 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   7 +
 4 files changed, 339 insertions(+)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index 48abc05..1d6e9b2 100644

drivers/net/i40e/i40e_ethdev.h +0 -0
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {  #define

I40E_QOS_BW_WEIGHT_MIN 1
/* The max bandwidth weight is 127. */ #define
I40E_QOS_BW_WEIGHT_MAX 127

drivers/net/i40e/i40e_ethdev.h +6 -0
+/* The max queue region index is 7. */ #define
+I40E_TCREGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */ #define
+I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
 
 /**
  * The overhead from MTU to max frame size.
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index 950a0d6..5d1e1d4 100644

drivers/net/i40e/rte_pmd_i40e.c int · line 2125

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
@@ -2117,3 +2117,290 @@ int
 rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 
 	return 0;
 }
+
+static int
+i40e_set_queue_region(struct i40e_hw *hw, struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint32_t TCREGION, TC_OFFSET, TC_SIZE;

Please follow DPDK coding style guide and use only low case for variables names.

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	uint16_t TC_SIZE_TB[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i, index;
+	uint16_t main_vsi_seid = pf->main_vsi_seid;

<snip>

Quoted 4 lines

/**

drivers/net/i40e/rte_pmd_i40e.c +0 -0
@@ -146,6 +159,19 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
Quoted 9 lines

drivers/net/i40e/rte_pmd_i40e.c struct rte_pmd_i40e_ptype_mapping { }; · line 165

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t flowtype;

As this is internal i40e flow type (PCTYPE), it is better name it hw_flowtype. As an option - use RTE level sw_flowtype and map it to internal hw_flowtype using corresponding i40e API.

Ok, I will change that name to " hw_flowtype " in v2 patch set.

Quoted 5 lines

drivers/net/i40e/rte_pmd_i40e.c struct rte_pmd_i40e_ptype_mapping { }; · line 168

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	uint8_t queue_startIndex;
+	uint8_t queue_num;
+	uint8_t UserPriority;

Low case for naming.

Ok, I will change code style in v2 patch set.

Quoted 46 lines

drivers/net/i40e/rte_pmd_i40e.c int

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	uint8_t TrafficClasses;
+	enum rte_pmd_i40e_queue_region_op  op; };
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -637,4 +663,17 @@ int

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Quoted 36 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
 port,
 				       uint8_t mask,
 				       uint32_t pkt_type);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);
+

#endif /* _PMD_I40E_H_ */

drivers/net/i40e/rte_pmd_i40e_version.map +7 -1
index 20cc980..77ac385 100644
@@ -45,3 +45,10 @@ DPDK_17.08 {
 	rte_pmd_i40e_get_ddp_info;
 
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_pmd_i40e_queue_region_conf;
+
+} DPDK_17.08;
--

2.9.3

author
#11 lore raw

PATCH 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 319 insertions(+)
app/test-pmd/cmdline.c +319 -0
index cd8c358..a49e6c5 100644
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_startIndex (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) TCs (value)\n"
+			"    Set the mapping of User Priority to "
+			"Traffic Classes on a port\n\n"
+
+			"queue-region flush port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8213,6 +8228,306 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_startIndex;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_id;
+	region_conf.queue_startIndex = res->queue_num_value;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_startIndex =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_startIndex, "queue_startIndex");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_startIndex <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_startIndex,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "pf") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_what =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				what, "pf#vf");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set pf|vf port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_what,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to Traffic Classes (TC) set *** */
+struct cmd_UserPriority_TrafficClasses_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t UserPriority;
+	uint8_t  UserPriority_id;
+	cmdline_fixed_string_t TrafficClasses;
+	uint8_t  TrafficClasses_id;
+};
+
+static void
+cmd_UserPriority_TrafficClasses_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_UserPriority_TrafficClasses_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_UP_TC_SET;
+	region_conf.UserPriority = res->UserPriority_id;
+	region_conf.TrafficClasses = res->TrafficClasses_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("UserPriority TrafficClasses config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_UserPriority_TrafficClasses_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_UserPriority_TrafficClasses_set =
+TOKEN_STRING_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_UserPriority_TrafficClasses_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_UserPriority_TrafficClasses_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_UserPriority_TrafficClasses_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				UserPriority, "UP");
+cmdline_parse_token_num_t cmd_UserPriority_TrafficClasses_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				UserPriority_id, UINT8);
+cmdline_parse_token_string_t cmd_UserPriority_TrafficClasses_TCs =
+	TOKEN_STRING_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				TrafficClasses, "TC");
+cmdline_parse_token_num_t cmd_UserPriority_TrafficClasses_TCs_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_UserPriority_TrafficClasses_result,
+				TrafficClasses_id, UINT8);
+
+cmdline_parse_inst_t cmd_UserPriority_TrafficClasses = {
+	.f = cmd_UserPriority_TrafficClasses_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"TCs <value>: Set the mapping of User Priority (UP) "
+		"to Traffic Classes (TC) ",
+	.tokens = {
+		(void *)&cmd_UserPriority_TrafficClasses_cmd,
+		(void *)&cmd_UserPriority_TrafficClasses_set,
+		(void *)&cmd_UserPriority_TrafficClasses_port,
+		(void *)&cmd_UserPriority_TrafficClasses_port_index,
+		(void *)&cmd_UserPriority_TrafficClasses_UP,
+		(void *)&cmd_UserPriority_TrafficClasses_UP_id,
+		(void *)&cmd_UserPriority_TrafficClasses_TCs,
+		(void *)&cmd_UserPriority_TrafficClasses_TCs_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14376,6 +14691,10 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_UserPriority_TrafficClasses,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
 	NULL,
 };
 
Signature · 1 line
2.9.3
author
#12 lore raw

v2 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                    | 324 ++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 484 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 6 files changed, 892 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.3
author
#13 lore raw

PATCH v2 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 484 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 568 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +15 -4
index 8e0580c..1663fc0 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1309,6 +1314,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
drivers/net/i40e/i40e_ethdev.h +30 -0
index ad80f0f..d612886 100644
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +484 -0

493 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +38 -0
index 155b7e8..a1329f4 100644
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set*/
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region pctype set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region pctype set */
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype set */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all configuration */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all configuration */
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.9.3
author
#14 lore raw

PATCH v2 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 324 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 324 insertions(+)
app/test-pmd/cmdline.c +324 -0
index 0144191..2350e75 100644
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "pf") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_what =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				what, "pf#vf");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set pf|vf port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_what,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_UP_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
Signature · 1 line
2.9.3
author
#15 lore raw

v3 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

root (2):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region

 app/test-pmd/cmdline.c                    | 328 ++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 6 files changed, 894 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.3
author
#16 lore raw

PATCH v3 1/2 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +15 -4
index 8e0580c..1663fc0 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1309,6 +1314,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
drivers/net/i40e/i40e_ethdev.h +30 -0
index ad80f0f..d612886 100644
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +482 -0

491 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +38 -0
index 155b7e8..a1329f4 100644
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set*/
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region pctype set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region pctype set */
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype set */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all configuration */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all configuration */
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.9.3
#17 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 5 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will distribute packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 13 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2180

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");

Can you please re-check the log message.

Quoted 40 lines
drivers/net/i40e/rte_pmd_i40e.c +40 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset << I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |
+				(bsf << I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged */
+	if (vsi->type == I40E_VSI_SRIOV) {
+		vsi_info->mapping_flags |=
+			rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+			rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi->base_queue);
+	}
+	vsi_info->valid_sections |=
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);
+
+	/* Update the VSI after updating the VSI queue-mapping information */
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2238

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));

Please keep line allignment same with above line.

Quoted 36 lines
drivers/net/i40e/rte_pmd_i40e.c +36 -0
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI range");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {

Please use one more level indentaion here, and pharantesis looks extra can you please double check?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr->queue_num;
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");

please don't split log message.

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2310

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf *conf_ptr)

What do you think starting all functions, even they are static, with "i40e_queue_region_" prefix?

Quoted 32 lines
drivers/net/i40e/rte_pmd_i40e.c +32 -0
+{
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index is 63");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2352

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+					info->region[i].hw_flowtype[j]) {
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");

Please don't split log messages.

Quoted 46 lines
drivers/net/i40e/rte_pmd_i40e.c +46 -0
+			return ret;
+		}
+		flowtype_index = info->region[region_index].flowtype_num;
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2408

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)

The API name looks like "setup" but that up part is user_priority, can you please long form against "up"?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2412

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;

Same abrevation comment for "upset", please use long form.

Quoted 16 lines
drivers/net/i40e/rte_pmd_i40e.c +16 -0
+
+	if (conf_ptr->user_priority > I40E_REGION_USERPRIORITY_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2438

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {

Please break line after ";"

Quoted 25 lines
drivers/net/i40e/rte_pmd_i40e.c +25 -0
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	return 0;
+}

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2473

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;

Please use signed variable, there are more above.

Quoted 43 lines
drivers/net/i40e/rte_pmd_i40e.c +43 -0
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2526

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed, err"
+			" %s aq_err %s",

Please don't split the log message.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2539

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw)
+{
+	uint16_t i;
+	uint32_t ret = -EINVAL;

Please use signed variable here.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2542

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));

Wrong indentation.

Quoted 54 lines
drivers/net/i40e/rte_pmd_i40e.c +54 -0
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2606

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check other APIs in this file.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2610

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;

This should be signed variable, since you are using it for return and assigning negative values.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2618

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;

Does it make sense to add another type to get the current queue region config?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2623

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;

Will this be implemented later, or not a valid case at all?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2632

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		break;
+	case RTE_PMD_I40E_UP_REGION_SET:> +		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);

Can you please describe what flush_on and flush_off are, you can comment to code if also.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2637

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);

Line break not required.

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
drivers/net/i40e/rte_pmd_i40e.h +0 -0
index 155b7e8..a1329f4 100644

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 98

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,

No need to set to zero, it is default value.

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 99

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set*/

I would suggest using same namespace for the enum ites, there are "RTE_PMD_I40E_REGION" and "RTE_PMD_I40E_QUEUE_REGION". "RTE_PMD_I40E_QUEUE_REGION" looks better. Or if it makes sense, perhaps "RTE_PMD_I40E_RSS_QUEUE_REGION"? But please stick with one.

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 102

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region pctype set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region pctype set */
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype set */

is this comment correct, this type should be for user priority

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 163

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all configuration */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all configuration */
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.

It doesn't need to be from CLI, can drop that part

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 165

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+ */
+struct rte_i40e_rss_region_conf {

This is now public struct, can you please comment items.

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 171

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;

Extra space before "op"

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 687

Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for

Again now this is an API, not just for testpmd, please drop CLI

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 688

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+ * that port as the command otion type

s/otion/options

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 691

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+ *
+ * @param port
+ *    pointer to port identifier of the device

Not pointer.
Also this will conflict with patch that updates port storage to uint16_t. Can you please follow the status of the patch, and if this merged after that one, please ping to remind to update the storage.

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 696

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,

Can you please use port_id as variable name to be consistent.

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 697

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+		struct rte_i40e_rss_region_conf *conf_ptr);

conf_ptr variable name doesn't say much, although it is OK in this context. I would suggest something like rss_region_conf

drivers/net/i40e/rte_pmd_i40e_version.map DPDK_17.11 { · line 53

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +0 -0
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;

The feature has been mention as "rss queue region" above a few places, do you think rte_pmd_i40e_rss_queue_region_conf() or rte_pmd_i40e_queue_region_conf() is better for API name?

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0 -0
 } DPDK_17.08;
 
author
#18 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi, Ferruh

Quoted 117 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 5 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will distribute packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 9 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482

++++++++++++++++++++++++++++++

Quoted 4 lines
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Can you please re-check the log message.

Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +17 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

Review

Quoted 1 line
(quoted diff) +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/i40e_ethdev.c i40e_init_fdir_filter_list(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	if (vsi->type == I40E_VSI_SRIOV) {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 5 lines
(quoted diff) +1 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+	vsi_info->valid_sections |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	/* Update the VSI after updating the VSI queue-mapping

information */

Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

If I do not spli it , the line will has more 80 character, there will be warning in patch check log! So, which way do you think will be better? Split or warning log?

Quoted 63 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2238

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));

Please keep line allignment same with above line.

Quoted 25 lines
drivers/net/i40e/rte_pmd_i40e.c +25 -0
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");
+		return ret;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {

Please use one more level indentaion here, and pharantesis looks extra can you please double check?

Quoted 12 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr->queue_num;
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");

please don't split log message.

If I do not spli it , the line will has more 80 character, there will be warning in patch check log!

Quoted 542 lines
Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf

*conf_ptr)

What do you think starting all functions, even they are static, with "i40e_queue_region_" prefix?

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+{
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +18 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2352

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+					info->region[i].hw_flowtype[j]) {
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");

Please don't split log messages.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+			return ret;
+		}
+		flowtype_index = info->region[region_index].flowtype_num;
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2408

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)

The API name looks like "setup" but that up part is user_priority, can you please long form against "up"?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2412

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;

Same abrevation comment for "upset", please use long form.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+	if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

Quoted 14 lines
drivers/net/i40e/rte_pmd_i40e.c +14 -0
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2438

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {

Please break line after ";"

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+		return ret;
+	}
+
+	return 0;
+}

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2473

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;

Please use signed variable, there are more above.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +37 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,

err"

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2526

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+			" %s aq_err %s",

Please don't split the log message.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2539

Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.c +12 -0
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw) {
+	uint16_t i;
+	uint32_t ret = -EINVAL;

Please use signed variable here.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2542

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));

Wrong indentation.

Quoted 53 lines
drivers/net/i40e/rte_pmd_i40e.c +53 -0
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2606

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check other APIs in this file.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2610

Quoted 6 lines
(quoted diff) +1 -0
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

(quoted diff) +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +2 -0
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;

This should be signed variable, since you are using it for return and assigning negative values.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2618

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;

Does it make sense to add another type to get the current queue region config?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2623

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;

Will this be implemented later, or not a valid case at all?

Review

Quoted 2 lines
(quoted diff) +2 -0
+		break;
+	case RTE_PMD_I40E_UP_REGION_SET:> +		ret =

i40e_set_up_region(pf, conf_ptr);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2632

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);

Can you please describe what flush_on and flush_off are, you can comment to code if also.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2637

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);

Line break not required.

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..a1329f4 100644

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 97

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,

No need to set to zero, it is default value.

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 98

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region

set*/

I would suggest using same namespace for the enum ites, there are "RTE_PMD_I40E_REGION" and "RTE_PMD_I40E_QUEUE_REGION". "RTE_PMD_I40E_QUEUE_REGION" looks better. Or if it makes sense, perhaps "RTE_PMD_I40E_RSS_QUEUE_REGION"? But please stick with one.

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 99

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 100

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype

set */

is this comment correct, this type should be for user priority

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 102

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all

configuration */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 103

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all

configuration */

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { }; · line 162

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +4 -0
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
 /**
+ * Queue region information get from CLI.

It doesn't need to be from CLI, can drop that part

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 165

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+ */
+struct rte_i40e_rss_region_conf {

This is now public struct, can you please comment items.

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 171

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;

Extra space before "op"

drivers/net/i40e/rte_pmd_i40e.h int

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int

rte_pmd_i40e_ptype_mapping_replace(uint8_t

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 687

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
 port,  int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for

Again now this is an API, not just for testpmd, please drop CLI

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 688

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+ * that port as the command otion type

s/otion/options

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 691

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+ *
+ * @param port
+ *    pointer to port identifier of the device

Not pointer.
Also this will conflict with patch that updates port storage to uint16_t. Can you please follow the status of the patch, and if this merged after that one, please ping to remind to update the storage.

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 696

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.h +5 -0
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,

Can you please use port_id as variable name to be consistent.

drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, · line 697

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+		struct rte_i40e_rss_region_conf *conf_ptr);

conf_ptr variable name doesn't say much, although it is OK in this context. I would suggest something like rss_region_conf

drivers/net/i40e/rte_pmd_i40e_version.map DPDK_17.11 { · line 53

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.h +0 -0
 #endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;

The feature has been mention as "rss queue region" above a few places, do you think rte_pmd_i40e_rss_queue_region_conf() or rte_pmd_i40e_queue_region_conf() is better for API name?

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0 -0
 } DPDK_17.08;
 
#19 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 34 lines · Wei

Hi, Ferruh

Quoted 32 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 5 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will distribute packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 5 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

<...>

Quoted 9 lines
Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

If I do not spli it , the line will has more 80 character, there will be warning in patch check log! So, which way do you think will be better? Split or warning log?

Checkpatch detects log lines and shouldn't complain about them.

Even it does I thinks checkpatch warning is better, assuming reasonable length.

And you can do as following to reduce the line length:

PMD_INIT_LOG(ERR,

	"Failed to configure queue region mapping = %d ", 	
	hw->aq.asq_last_status);

<...>

author
#20 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 64 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, September 21, 2017 3:10 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 19 lines · Wei

Hi, Ferruh

Quoted 17 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 5 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will distribute packets into queue reqions which may consists of multiple

queues.

Quoted 16 lines
Quoted 16 lines

If so, is there a way to control how packets distributed within same queue region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 5 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

<...>

Quoted 8 lines
Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

If I do not spli it , the line will has more 80 character, there will be warning in

patch check log!

Quoted 1 line

So, which way do you think will be better? Split or warning log?

Checkpatch detects log lines and shouldn't complain about them.

Even it does I thinks checkpatch warning is better, assuming reasonable length.

Quoted 7 lines

And you can do as following to reduce the line length:

PMD_INIT_LOG(ERR,

	"Failed to configure queue region mapping = %d ",
	hw->aq.asq_last_status);

<...>

Ok, I will change to that way, but there will be warning in patch check.
Because at first I do not split them, then after patch check, I find that I must eliminate these over 80 warning.

#21 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 66 lines · Wei
Quoted 66 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, September 21, 2017 3:10 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 19 lines · Wei

Hi, Ferruh

Quoted 17 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 5 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will distribute packets into queue reqions which may consists of multiple

queues.

Quoted 16 lines
Quoted 16 lines

If so, is there a way to control how packets distributed within same queue region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 5 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

<...>

Quoted 8 lines
Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

If I do not spli it , the line will has more 80 character, there will be warning in

patch check log!

Quoted 1 line

So, which way do you think will be better? Split or warning log?

Checkpatch detects log lines and shouldn't complain about them.

Even it does I thinks checkpatch warning is better, assuming reasonable length.

And you can do as following to reduce the line length:

Quoted 8 lines
Quoted 5 lines

PMD_INIT_LOG(ERR,

	"Failed to configure queue region mapping = %d ",
	hw->aq.asq_last_status);

<...>

Ok, I will change to that way, but there will be warning in patch check.
Because at first I do not split them, then after patch check, I find that I must eliminate these over 80 warning.

If you are using devtools/checkpatches.sh script, it ignores the LONG_LINE_STRING warnings, so long log messages shouldn't be generating warning. I just confirmed it is working as expected.

author
#22 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

In reply to Ferruh Yigit

Hi, Ferruh

Quoted 30 lines

-----Original Message-----

From: Yigit, Ferruh

Sent: Wednesday, September 20, 2017 6:36 PM

To: Zhao1, Wei <[email protected]>; [email protected]

Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 9 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so

that different traffic classes or different packet classification

types can be separated to different queues in different queue

regions.This patch can set queue region range, it include queue number

in a region and the index of first queue.

Is following correct:

So instead of distributing packets to the multiple queues, this will distribute

Quoted 9 lines

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue

region to multiple queues?

distributed within same queue region is based on a rss algorithm, it is implemented by NIC self, software can not control it.

Quoted 5 lines

And is this feature only supported with RSS? Can it be part of RSS

configuration instead of PMD specific API?

Yes, only valid after rss enable.May be in the feature, in rte_flow mode, we can combine them together.

Quoted 5 lines
Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

oK, change in v4

Quoted 64 lines
Quoted 12 lines

different traffic classes.It also enable mapping between a region

index and a sepcific flowtype(PCTYPE).It also provide the solution of

flush all configuration about queue region the above described.

Quoted 7 lines

---

 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482

++++++++++++++++++++++++++++++

Quoted 7 lines
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 27 lines
drivers/net/i40e/rte_pmd_i40e.c +14 -0
+static int
 
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
 
+                                            struct i40e_pf *pf)
 
+{
 
+      uint16_t i;
 
+      struct i40e_vsi *vsi = pf->main_vsi;
 
+      uint16_t queue_offset, bsf, tc_index;
 
+      struct i40e_vsi_context ctxt;
 
+      struct i40e_aqc_vsi_properties_data *vsi_info;
 
+      struct i40e_queue_region_info *region_info =
 
+                                                      &pf->queue_region;
 
+      uint32_t ret = -EINVAL;
 
+
 
+      if (!region_info->queue_region_number) {
Quoted 7 lines
Quoted 1 line

+ PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Can you please re-check the log message.

oK, change in v4

Quoted 114 lines
Quoted 45 lines
(quoted diff) +22 -0
+                      return ret;
 
+      }
 
+
 
+      memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
 
+
 
+      /* Update Queue Pairs Mapping for currently enabled UPs */
 
+      ctxt.seid = vsi->seid;
 
+      ctxt.pf_num = hw->pf_id;
 
+      ctxt.vf_num = 0;
 
+      ctxt.uplink_seid = vsi->uplink_seid;
 
+      ctxt.info = vsi->info;
 
+      vsi_info = &ctxt.info;
 
+
 
+      memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
 
+      memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
 
+
 
+      /**
 
+      * Configure queue region and queue mapping parameters,
 
+      * for enabled queue region, allocate queues to this region.
 
+      */
 
+
 
+      for (i = 0; i < region_info->queue_region_number; i++) {

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+                      tc_index = region_info->region[i].region_id;
 
+                      bsf = rte_bsf32(region_info->region[i].queue_num);
 
+                      queue_offset = region_info->region[i].queue_start_index;
 
+                      vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
 
+                                      (queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

Quoted 1 line

+ (bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev)

Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
+      }
 
+
 
+      /* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+      if (vsi->type == I40E_VSI_SRIOV) {
 
+                      vsi_info->mapping_flags |=
 
+
            rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+                      for (i = 0; i < vsi->nb_qps; i++)
 
+                                      vsi_info->queue_mapping[i] =
 
+                                                      rte_cpu_to_le_16(vsi->base_queue + i);
 
+      } else {
 
+                      vsi_info->mapping_flags |=
 
+
            rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 9 lines

+ vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+      }
 
+      vsi_info->valid_sections |=
 
+
            rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +2 -0
+
 
+      /* Update the VSI after updating the VSI queue-mapping

information */

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+      ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
 
+      if (ret) {
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2230

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                      PMD_INIT_LOG(ERR, "Failed to configure queue region "
 
+                                      "mapping = %d ", hw->aq.asq_last_status);

Please don't split log message.

oK, change in v4

Quoted 14 lines
Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+                      return ret;
 
+      }
 
+      /* update the local VSI info with updated queue map */
 
+      (void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
 
+                                                                      sizeof(vsi->info.tc_mapping));
 
+      (void)rte_memcpy(&vsi->info.queue_mapping,
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2238

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                                      &ctxt.info.queue_mapping,
 
+                      sizeof(vsi->info.queue_mapping));

Please keep line allignment same with above line.

oK, change in v4, but can not the same.

(void)rte_memcpy(&vsi->info.queue_mapping, &ctxt.info.queue_mapping,

                                                sizeof(vsi->info.queue_mapping));

will over 80 maxnumber.

Quoted 98 lines
Quoted 61 lines
(quoted diff) +30 -0
+      vsi->info.mapping_flags = ctxt.info.mapping_flags;
 
+      vsi->info.valid_sections = 0;
 
+
 
+      return 0;
 
+}
 
+
 
+
 
+static int
 
+i40e_set_queue_region(struct i40e_pf *pf,
 
+                                                      struct rte_i40e_rss_region_conf *conf_ptr) {
 
+      uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
 
+      uint16_t i;
 
+      struct i40e_vsi *main_vsi = pf->main_vsi;
 
+      struct i40e_queue_region_info *info = &pf->queue_region;
 
+      uint32_t ret = -EINVAL;
 
+
 
+      for (i = 0; i < I40E_REGION_MAX_INDEX; i++)
 
+                      if (conf_ptr->queue_num == tc_size_tb[i])
 
+                                      break;
 
+
 
+      if (i == I40E_REGION_MAX_INDEX) {
 
+                      printf("The region sizes should be any of the following "
 
+                      "values: 1, 2, 4, 8, 16, 32, 64 as long as the "
 
+                      "total number of queues do not exceed the VSI allocation");
 
+                      return ret;
 
+      }
 
+
 
+      if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
 
+                      PMD_INIT_LOG(ERR, "the queue region max index is 7");
 
+                      return ret;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+      }
 
+
 
+      if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
 
+                                                                      > main_vsi->nb_used_qps) {
 
+                      PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+                      return ret;
 
+      }
 
+
 
+      if (info->queue_region_number) {
 
+                      for (i = 0; i < info->queue_region_number; i++)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
 
+                                      if (conf_ptr->region_id == info->region[i].region_id)
 
+                                                      break;
 
+
 
+                      if ((i == info->queue_region_number) &&
 
+                                      (i <= I40E_REGION_MAX_INDEX)) {
Quoted 3 lines

Please use one more level indentaion here, and pharantesis looks extra can

you please double check?

You mean,you want the following moede ?

                                if (i == info->queue_region_number) {

                                                if(i <= I40E_REGION_MAX_INDEX) {

                                                                ...........................

                                                }

                                }
Quoted 18 lines
Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+                                      info->region[i].region_id = conf_ptr->region_id;
 
+                                      info->region[i].queue_num = conf_ptr->queue_num;
 
+                                      info->region[i].queue_start_index =
 
+                                                      conf_ptr->queue_start_index;
 
+                                      info->queue_region_number++;
 
+                      } else {
 
+                                      PMD_INIT_LOG(ERR, "queue region number "
 
+                                                      "exceeds maxnum 8 or the "
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                                                      "queue region id has "
 
+                                                      "been set before");

please don't split log message.

oK, change in v4

Quoted 34 lines
Quoted 23 lines
(quoted diff) +11 -0
+                                      return ret;
 
+                      }
 
+      } else {
 
+                      info->region[0].region_id = conf_ptr->region_id;
 
+                      info->region[0].queue_num = conf_ptr->queue_num;
 
+                      info->region[0].queue_start_index =
 
+                                      conf_ptr->queue_start_index;
 
+                      info->queue_region_number++;
 
+      }
 
+
 
+      return 0;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+}
 
+
 
+static int
 
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
 
+                      struct i40e_pf *pf, struct rte_i40e_rss_region_conf
Quoted 7 lines

*conf_ptr)

What do you think starting all functions, even they are static, with

"i40e_queue_region_" prefix?

                                ret = i40e_set_queue_region(pf, conf_ptr);

                                break;

                case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:

                                ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);

                                break;

                case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:

                                ret = -EINVAL;

                                break;

                case RTE_PMD_I40E_UP_REGION_SET:

                                ret = i40e_set_up_region(pf, conf_ptr);

I have use the format of i40e_set_ as prefix?

Because many set is not related directly to queue region.

Quoted 84 lines
Quoted 19 lines
(quoted diff) +9 -0
+{
 
+      uint32_t pfqf_hregion;
 
+      uint32_t ret = -EINVAL;
 
+      struct i40e_queue_region_info *info = &pf->queue_region;
 
+      uint16_t i, j, index, flowtype_set = 0;
 
+      uint16_t region_index, flowtype_index;
 
+
 
+      if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
 
+                      PMD_INIT_LOG(ERR, "the queue region max index is 7");

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+                      return ret;
 
+      }
 
+
 
+      if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
 
+                      PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

Quoted 51 lines
drivers/net/i40e/rte_pmd_i40e.c +26 -0
+                      return ret;
 
+      }
 
+
 
+      if (info->queue_region_number) {
 
+                      for (i = 0; i < info->queue_region_number; i++)
 
+                                      if (conf_ptr->region_id == info->region[i].region_id)
 
+                                                      break;
 
+
 
+                      if (i == info->queue_region_number) {
 
+                                      PMD_INIT_LOG(ERR, "that region id has not "
 
+                                                      "been set before");
 
+                                      return ret;
 
+                      }
 
+                      region_index = i;
 
+
 
+                      for (i = 0; i < info->queue_region_number; i++) {
 
+                                      for (j = 0; j < info->region[i].flowtype_num; j++) {
 
+                                                      if (conf_ptr->hw_flowtype ==
 
+                                                                      info->region[i].hw_flowtype[j]) {
 
+                                                                      flowtype_set = 1;
 
+                                                                      break;
 
+                                                      }
 
+                                      }
 
+                      }
 
+
 
+                      if (flowtype_set) {
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2352

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                                      PMD_INIT_LOG(ERR, "that hw_flowtype "
 
+                                                      "has been set before");

Please don't split log messages.

Ok.

Quoted 130 lines
Quoted 7 lines
(quoted diff) +3 -0
+                                      return ret;
 
+                      }
 
+                      flowtype_index = info->region[region_index].flowtype_num;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+                      info->region[region_index].hw_flowtype[flowtype_index] =
 
+                                                                                      conf_ptr->hw_flowtype;
 
+                      info->region[region_index].flowtype_num++;
 
+      } else  {
 
+                      PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 9 lines
(quoted diff) +5 -0
+                      return ret;
 
+      }
 
+
 
+      index = conf_ptr->hw_flowtype >> 3;
 
+      pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+
 
+      if ((conf_ptr->hw_flowtype & 0x7) == 0) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_0_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_1_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_2_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_3_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_4_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_5_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_6_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;

Review

Quoted 7 lines
(quoted diff) +4 -0
+      } else {
 
+                      pfqf_hregion |= conf_ptr->region_id <<
 
+                                                      I40E_PFQF_HREGION_REGION_7_SHIFT;
 
+                      pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+      }
 
+
 
+      i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
 
+
 
+      return 0;
 
+}
 
+
 
+static int
 
+i40e_set_up_region(struct i40e_pf *pf,
Quoted 7 lines
Quoted 1 line

+ struct rte_i40e_rss_region_conf *conf_ptr)

The API name looks like "setup" but that up part is user_priority, can you

please long form against "up"?

Ok, I will change to “user_priority” instead of “up”

Quoted 66 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2412

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+{
 
+      struct i40e_queue_region_info *info = &pf->queue_region;
 
+      uint32_t ret = -EINVAL;
 
+      uint16_t i, j, region_index, up_set = 0;

Same abrevation comment for "upset", please use long form.

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +2 -0
+
 
+      if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

Quoted 43 lines
drivers/net/i40e/rte_pmd_i40e.c +22 -0
+                      PMD_INIT_LOG(ERR, "the queue region max index is 7");
 
+                      return ret;
 
+      }
 
+
 
+      if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
 
+                      PMD_INIT_LOG(ERR, "the region_id max index is 7");
 
+                      return ret;
 
+      }
 
+
 
+      if (info->queue_region_number) {
 
+                      for (i = 0; i < info->queue_region_number; i++)
 
+                                      if (conf_ptr->region_id == info->region[i].region_id)
 
+                                                      break;
 
+
 
+                      if (i == info->queue_region_number) {
 
+                                      PMD_INIT_LOG(ERR, "that region id "
 
+                                                      "has not been set before");
 
+                                      return ret;
 
+                      }
 
+                      region_index = i;
 
+
 
+                      for (i = 0; i < info->queue_region_number; i++) {
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2438

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                                      for (j = 0; j <
 
+                                                      info->region[i].user_priority_num; j++) {

Please break line after ";"

Ok.

Quoted 70 lines
Quoted 31 lines
(quoted diff) +15 -0
+                                                      if (info->region[i].user_priority[j] ==
 
+                                                                      conf_ptr->user_priority) {
 
+                                                                      up_set = 1;
 
+                                                                      break;
 
+                                                      }
 
+                                      }
 
+                      }
 
+
 
+                      if (up_set) {
 
+                                      PMD_INIT_LOG(ERR, "that user priority "
 
+                                                      "has been set before");
 
+                                      return ret;
 
+                      }
 
+
 
+                      j = info->region[region_index].user_priority_num;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+                      info->region[region_index].user_priority[j] =
 
+                                                                                      conf_ptr->user_priority;
 
+                      info->region[region_index].user_priority_num++;
 
+      } else {
 
+                      PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 25 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+                      return ret;
 
+      }
 
+
 
+      return 0;
 
+}
 
+
 
+static int
 
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
 
+                                                      struct i40e_pf *pf)
 
+{
 
+      struct i40e_dcbx_config dcb_cfg_local;
 
+      struct i40e_dcbx_config *dcb_cfg;
 
+      struct i40e_queue_region_info *info = &pf->queue_region;
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2473

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+      struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
 
+      uint32_t ret = -EINVAL;

Please use signed variable, there are more above.

Ok

Quoted 108 lines

Review

Quoted 11 lines
(quoted diff) +5 -0
+      uint16_t i, j, prio_index, region_index;
 
+      uint8_t tc_map, tc_bw, bw_lf;
 
+
 
+      if (!info->queue_region_number) {
 
+                      PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 83 lines
(quoted diff) +42 -0
+                      return ret;
 
+      }
 
+
 
+      dcb_cfg = &dcb_cfg_local;
 
+      memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
 
+
 
+      /* assume each tc has the same bw */
 
+      tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
 
+      for (i = 0; i < info->queue_region_number; i++)
 
+                      dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
 
+      /* to ensure the sum of tcbw is equal to 100 */
 
+      bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
 
+      for (i = 0; i < bw_lf; i++)
 
+                      dcb_cfg->etscfg.tcbwtable[i]++;
 
+
 
+      /* assume each tc has the same Transmission Selection Algorithm */
 
+      for (i = 0; i < info->queue_region_number; i++)
 
+                      dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
 
+
 
+      for (i = 0; i < info->queue_region_number; i++) {
 
+                      for (j = 0; j < info->region[i].user_priority_num; j++) {
 
+                                      prio_index = info->region[i].user_priority[j];
 
+                                      region_index = info->region[i].region_id;
 
+                                      dcb_cfg->etscfg.prioritytable[prio_index] =
 
+                                                                                      region_index;
 
+                      }
 
+      }
 
+
 
+      /* FW needs one App to configure HW */
 
+      dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
 
+      dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
 
+      dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
 
+      dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
 
+
 
+      tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
 
+
 
+      dcb_cfg->pfc.willing = 0;
 
+      dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
 
+      dcb_cfg->pfc.pfcenable = tc_map;
 
+
 
+      /* Copy the new config to the current config */
 
+      *old_cfg = *dcb_cfg;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+      old_cfg->etsrec = old_cfg->etscfg;
 
+      ret = i40e_set_dcb_config(hw);
 
+
 
+      if (ret) {
 
+                      PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,
Quoted 7 lines

err"

Quoted 1 line

+ " %s aq_err %s",

Please don't split the log message.

Ok

Quoted 22 lines
Quoted 21 lines
(quoted diff) +10 -0
+                                      i40e_stat_str(hw, ret),
 
+                                      i40e_aq_str(hw, hw->aq.asq_last_status));
 
+                      return ret;
 
+      }
 
+
 
+      return 0;
 
+}
 
+
 
+static int
 
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw) {
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2177

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+      uint16_t i;
 
+      uint32_t ret = -EINVAL;

Please use signed variable here.

Ok

Quoted 240 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2542

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+
 
+      memset(&hw->local_dcbx_config, 0,
 
+      sizeof(struct i40e_dcbx_config));

Wrong indentation.

Quoted 115 lines
(quoted diff) +58 -0
+      /* set dcb default configuration */
 
+      hw->local_dcbx_config.etscfg.willing = 0;
 
+      hw->local_dcbx_config.etscfg.maxtcs = 0;
 
+      hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
 
+      hw->local_dcbx_config.etscfg.tsatable[0] =
 
+                                      I40E_IEEE_TSA_ETS;
 
+      /* all UPs mapping to region 0 */
 
+      for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
 
+                      hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
 
+      hw->local_dcbx_config.etsrec =
 
+                      hw->local_dcbx_config.etscfg;
 
+      hw->local_dcbx_config.pfc.willing = 0;
 
+      hw->local_dcbx_config.pfc.pfccap =
 
+                                      I40E_MAX_TRAFFIC_CLASS;
 
+      /* FW needs one App to configure HW */
 
+      hw->local_dcbx_config.numapps = 1;
 
+      hw->local_dcbx_config.app[0].selector =
 
+                                      I40E_APP_SEL_ETHTYPE;
 
+      hw->local_dcbx_config.app[0].priority = 3;
 
+      hw->local_dcbx_config.app[0].protocolid =
 
+                                      I40E_APP_PROTOID_FCOE;
 
+      ret = i40e_set_dcb_config(hw);
 
+      if (ret) {
 
+                      PMD_INIT_LOG(ERR,
 
+                      "default dcb config fails. err = %d, aq_err = %d.",
 
+                                      ret, hw->aq.asq_last_status);
 
+                      return ret;
 
+      }
 
+
 
+      return 0;
 
+}
 
+
 
+int
 
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
 
+                                                      uint16_t on)
 
+{
 
+      uint16_t i;
 
+      struct i40e_queue_region_info *info = &pf->queue_region;
 
+
 
+      if (on) {
 
+                      i40e_vsi_update_queue_region_mapping(hw, pf);
 
+                      i40e_queue_region_dcb_configure(hw, pf);
 
+                      return 0;
 
+      }
 
+
 
+      info->queue_region_number = 1;
 
+      info->region[0].queue_num = 64;
 
+      info->region[0].queue_start_index = 0;
 
+
 
+      i40e_vsi_update_queue_region_mapping(hw, pf);
 
+      i40e_queue_region_dcb_configure_default(hw);
 
+
 
+      for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
 
+                      i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
 
+
 
+      memset(info, 0, sizeof(struct i40e_queue_region_info));
 
+
 
+      return 0;

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+}
 
+
 
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
 
+                                      struct rte_i40e_rss_region_conf *conf_ptr) {
 
+      struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check other

APIs in this file.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2610

Quoted 11 lines

+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +2 -0
+      enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
 
+      uint32_t ret;

This should be signed variable, since you are using it for return and assigning

negative values.

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+
 
+      if (!is_i40e_supported(dev))
 
+                      return -ENOTSUP;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2618

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
 
+
 
+      switch (op_type) {
 
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
 
+                      ret = i40e_set_queue_region(pf, conf_ptr);
 
+                      break;

Does it make sense to add another type to get the current queue region

config?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2623

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+      case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
 
+                      ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
 
+                      break;
 
+      case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
 
+                      ret = -EINVAL;

Will this be implemented later, or not a valid case at all?

Review

Quoted 3 lines
(quoted diff) +2 -0
+                      break;
 
+      case RTE_PMD_I40E_UP_REGION_SET:> +                          ret =

i40e_set_up_region(pf, conf_ptr);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2632

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+                      break;
 
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
 
+                      ret = i40e_flush_region_all_conf(hw, pf, 1);
 
+                      break;
 
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
 
+                      ret = i40e_flush_region_all_conf(hw, pf, 0);

Can you please describe what flush_on and flush_off are, you can comment

to code if also.

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+                      break;
 
+
 
+      default:
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2637

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+                      PMD_DRV_LOG(WARNING, "op type (%d) not supported",
 
+                                          op_type);

Line break not required.

Ok, delete in v4

Quoted 38 lines
Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+                      ret = -EINVAL;
 
+                      break;
 
+      }
 
+
 
+      I40E_WRITE_FLUSH(hw);
 
+
 
+      return ret;
 
+}
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..a1329f4 100644

--- a/drivers/net/i40e/rte_pmd_i40e.h

+++ b/drivers/net/i40e/rte_pmd_i40e.h

(quoted diff) +3 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 
         RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
 
 
+/**
 
+ *  Option types of queue region.
 
+ */
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info {

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+enum rte_pmd_i40e_queue_region_op {
 
+      RTE_PMD_I40E_REGION_UNDEFINED = 0,

No need to set to zero, it is default value.

Ok

Quoted 26 lines
Quoted 3 lines

+ RTE_PMD_I40E_QUEUE_REGION_SET, /**< add queue region

set*/

I would suggest using same namespace for the enum ites, there are

"RTE_PMD_I40E_REGION" and "RTE_PMD_I40E_QUEUE_REGION".

"RTE_PMD_I40E_QUEUE_REGION" looks better. Or if it makes sense,

perhaps "RTE_PMD_I40E_RSS_QUEUE_REGION"? But please stick with one.

Quoted 1 line

+ RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET, /**< add pf region

pctype set */

Quoted 1 line

+ RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET, /**< add vf region

pctype set */

Quoted 7 lines
Quoted 1 line

+ RTE_PMD_I40E_UP_REGION_SET, /**< add queue region pctype

set */

is this comment correct, this type should be for user priority

Ok, fix in v4

Quoted 36 lines
Quoted 3 lines

+ RTE_PMD_I40E_REGION_ALL_FLUSH_ON, /**< flush on all

configuration */

Quoted 1 line

+ RTE_PMD_I40E_REGION_ALL_FLUSH_OFF, /**< flush off all

configuration */

Quoted 13 lines
(quoted diff) +3 -0
+      RTE_PMD_I40E_QUEUE_REGION_OP_MAX
 
+};
 
+
 
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 
 
 /**

Review struct rte_pmd_i40e_ptype_mapping { }; · line 165

Quoted 6 lines
(quoted diff) +1 -0
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
 
 
 /**
 
+ * Queue region information get from CLI.

It doesn't need to be from CLI, can drop that part

Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 165

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+ */
 
+struct rte_i40e_rss_region_conf {

This is now public struct, can you please comment items.

Ok. Add in v4

Quoted 10 lines
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.h +4 -0
+      uint8_t region_id;
 
+      uint8_t hw_flowtype;
 
+      uint8_t queue_start_index;
 
+      uint8_t queue_num;
Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 171

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+      uint8_t user_priority;
 
+      enum rte_pmd_i40e_queue_region_op  op;

Extra space before "op"

Maybe, I SHOULD add uint8_t raw[3] before “op”

Quoted 46 lines

drivers/net/i40e/rte_pmd_i40e.h int

Quoted 15 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+};
 
+
 
+/**
 
  * Notify VF when PF link status changes.
 
  *
 
  * @param port
@@ -657,4 +683,16 @@ int

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Review int

Quoted 9 lines
(quoted diff) +2 -0
 port,  int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 
                                                          struct ether_addr *mac_addr);
 
 
 
+/**
 
+ * Get RSS queue region info from CLI and do configuration for

Again now this is an API, not just for testpmd, please drop CLI

Quoted 1 line

+ * that port as the command otion type

s/otion/options

Quoted 3 lines

+ *

+ * @param port

Quoted 7 lines
Quoted 1 line

+ * pointer to port identifier of the device

Not pointer.

Also this will conflict with patch that updates port storage to uint16_t. Can

Ok, change in v4

Quoted 3 lines

you please follow the status of the patch, and if this merged after that one,

please ping to remind to update the storage.

Ok ,I will commit a new v4 to fix these , then remind you of the new version

Quoted 18 lines
Quoted 11 lines

+ * @param conf_ptr

+ * pointer to the struct that contain all the

+ * region configuration parameters

+ */

+int rte_pmd_i40e_queue_region_conf(uint8_t port,

Can you please use port_id as variable name to be consistent.

Quoted 7 lines
Quoted 1 line

+ struct rte_i40e_rss_region_conf *conf_ptr);

conf_ptr variable name doesn't say much, although it is OK in this context. I

would suggest something like rss_region_conf

Ok.

Quoted 26 lines
Quoted 15 lines

#endif /* _PMD_I40E_H_ */

(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e_version.map

index ef8882b..c3ee2da 100644

--- a/drivers/net/i40e/rte_pmd_i40e_version.map

+++ b/drivers/net/i40e/rte_pmd_i40e_version.map

drivers/net/i40e/rte_pmd_i40e_version.map DPDK_17.11 {

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -50,5 +50,6 @@ DPDK_17.11 {
 
         global:
 
 
 
         rte_pmd_i40e_add_vf_mac_addr;
 
+      rte_pmd_i40e_queue_region_conf;
Quoted 5 lines

The feature has been mention as "rss queue region" above a few places, do

you think rte_pmd_i40e_rss_queue_region_conf() or

rte_pmd_i40e_queue_region_conf() is better for API name?

Ok, I will change to rte_pmd_i40e_rss_queue_region_conf

Quoted 7 lines
Quoted 7 lines

} DPDK_17.08;

#23 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 19 lines · Wei

Hi, Ferruh

Quoted 5 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

flush

Quoted 10 lines · Wei Zhao
Quoted 5 lines

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will

distribute

Quoted 8 lines
Quoted 5 lines

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

distributed within same queue region is based on a rss algorithm, it is implemented by NIC self, software can not control it.

I was thinking RSS used to select queue region, but no first queue region selected, later RSS used to select queue within the region. Thanks for clarification.

<...>

Quoted 5 lines

sizeof(vsi->info.tc_mapping));

Quoted 4 lines
Quoted 3 lines

+      (void)rte_memcpy(&vsi->info.queue_mapping,
+                                      &ctxt.info.queue_mapping, +                      sizeof(vsi->info.queue_mapping));

Quoted 7 lines
Quoted 1 line

Please keep line allignment same with above line.

oK, change in v4, but can not the same. (void)rte_memcpy(&vsi->info.queue_mapping, &ctxt.info.queue_mapping,
sizeof(vsi->info.queue_mapping));
will over 80 maxnumber.

Someting like following, new lines aligned:

	(void)rte_memcpy(&vsi->info.queue_mapping,
		&ctxt.info.queue_mapping,
		sizeof(vsi->info.queue_mapping));

<...>

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

+                      if ((i == info->queue_region_number) && +                                      (i <= I40E_REGION_MAX_INDEX)) {

Please use one more level indentaion here, and pharantesis looks extra can you please double check?

Quoted 7 lines

You mean,you want the following moede ?
        if (i == info->queue_region_number) {

        	if(i <= I40E_REGION_MAX_INDEX) {
			...........................
        	}
       }

No, continuation of the "if" should be easy to recognized from body of the "if", something like:

	if ((i == info->queue_region_number) &&
			(i <= I40E_REGION_MAX_INDEX)) {
		info->region[i].region_id = conf_ptr->region_id;
		info->region[i].queue_num = conf_ptr->queue_num;

<...>

Quoted 20 lines
Quoted 3 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+                      struct i40e_pf *pf, struct

rte_i40e_rss_region_conf

Quoted 4 lines

*conf_ptr)

What do you think starting all functions, even they are static, with "i40e_queue_region_" prefix?

                                ret = i40e_set_queue_region(pf, conf_ptr); break;
                case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
                                ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
                                break;
                case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
                                ret = -EINVAL;
                                break;
                case RTE_PMD_I40E_UP_REGION_SET:
                                ret = i40e_set_up_region(pf, conf_ptr);

Quoted 2 lines

I have use the format ofi40e_set_  as prefix? Because many set is not related directly to queue region.

When looking to this patch what functions are doing is clear, but it also should be clear when looking the source code some time later what that function is about.

That is why I believe a namespace is useful, like "i40e_queue_region_xx", so you can immediately say this function is about "RSS queue region" feature.

This function is "rte_pmd_i40e_queue_region_conf", it is applying provided queue region configuration based of region op type, so I assumed all these functions are directly related to the fature.

If you believe function name will be wrong with that prefix, of course just don't use it, but please try to stick with a name space, that will make easy to understand these features in all source code.

<...>

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

+
+      memset(&hw->local_dcbx_config, 0,
+      sizeof(struct i40e_dcbx_config));

Wrong indentation.

Reminder of this one incase missed.

<...>

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+                                      struct

rte_i40e_rss_region_conf *conf_ptr) {

Quoted 3 lines
Quoted 1 line

+      struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check

other

Quoted 1 line

APIs in this file.

Reminder of this one incase missed.

I mean is_i40e_supported() call that other APIs have.

<...>

Quoted 11 lines
Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2618

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+      if (!is_i40e_supported(dev))
+                      return -ENOTSUP;
+
+      switch (op_type) {
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
+                      ret = i40e_set_queue_region(pf, conf_ptr);
+                      break;

Does it make sense to add another type to get the current queue region config?

Reminder of this one incase missed.

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

+      case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+                      ret = i40e_set_region_flowtype_pf(hw, pf,

conf_ptr);

Quoted 5 lines
Quoted 3 lines

+                      break;
+      case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+                      ret = -EINVAL;

Will this be implemented later, or not a valid case at all?

Reminder of this one incase missed.

Quoted 13 lines
Quoted 2 lines
Quoted 2 lines

+                      break;
+      case RTE_PMD_I40E_UP_REGION_SET:> +

ret =

Quoted 10 lines

i40e_set_up_region(pf, conf_ptr);

Quoted 6 lines

+                      break;
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+                      ret = i40e_flush_region_all_conf(hw, pf, 1); +                      break;
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+                      ret = i40e_flush_region_all_conf(hw, pf, 0);

Can you please describe what flush_on and flush_off are, you can comment to code if also.

Reminder of this one incase missed.

<...>

Quoted 6 lines
Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping {  }; · line 162

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.h +1 -0
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
   /**
+ * Queue region information get from CLI.

It doesn't need to be from CLI, can drop that part

Reminder of this one incase missed.

<...>

Quoted 6 lines
Quoted 4 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 171

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.h +2 -0
+      uint8_t user_priority;
+      enum rte_pmd_i40e_queue_region_op  op;

Extra space before "op"

Maybe, I SHOULD add uint8_t raw[3] before “op”

Sorry, I didn't get this one.

<...>

Quoted 9 lines
Quoted 3 lines

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Quoted 2 lines
(quoted diff) +0 -0
 port,  int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

                                                           struct

ether_addr *mac_addr);

Quoted 5 lines
Quoted 3 lines

+/**
+ * Get RSS queue region info from CLI and do configuration for

Again now this is an API, not just for testpmd, please drop CLI

Reminder of this one incase missed.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

+ * that port as the command otion type

s/otion/options

Reminder of this one incase missed.

<...>

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+int rte_pmd_i40e_queue_region_conf(uint8_t port,

Can you please use port_id as variable name to be consistent.

Reminder of this one incase missed.

<...>

author
#24 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi, Ferruh

Quoted 33 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 25, 2017 5:32 PM
To: Zhao1, Wei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 25 lines · Wei

Hi, Ferruh

Quoted 5 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

flush

Quoted 10 lines · Wei Zhao
Quoted 5 lines

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will

distribute

Quoted 5 lines

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

Quoted 6 lines
Quoted 2 lines

distributed within same queue region is based on a rss algorithm, it is implemented by NIC self, software can not control it.

I was thinking RSS used to select queue region, but no first queue region selected, later RSS used to select queue within the region. Thanks for clarification.

OK

Quoted 14 lines

<...>

Quoted 9 lines

sizeof(vsi->info.tc_mapping));

Quoted 5 lines
Quoted 3 lines

+      (void)rte_memcpy(&vsi->info.queue_mapping,
+                                      &ctxt.info.queue_mapping, +                      sizeof(vsi->info.queue_mapping));

Please keep line allignment same with above line.

oK, change in v4, but can not the same.
(void)rte_memcpy(&vsi->info.queue_mapping,

&ctxt.info.queue_mapping,

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

sizeof(vsi->info.queue_mapping));
will over 80 maxnumber.

Someting like following, new lines aligned:

	(void)rte_memcpy(&vsi->info.queue_mapping,
		&ctxt.info.queue_mapping,
		sizeof(vsi->info.queue_mapping));

Ok, change in v4

Quoted 22 lines

<...>

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

+                      if ((i == info->queue_region_number) && +                                      (i <= +I40E_REGION_MAX_INDEX)) {

Please use one more level indentaion here, and pharantesis looks extra can you please double check?

Quoted 7 lines

You mean,you want the following moede ?
        if (i == info->queue_region_number) {

        	if(i <= I40E_REGION_MAX_INDEX) {
			...........................
        	}
       }

No, continuation of the "if" should be easy to recognized from body of the "if", something like:

Quoted 7 lines
	if ((i == info->queue_region_number) &&
			(i <= I40E_REGION_MAX_INDEX)) {
		info->region[i].region_id = conf_ptr->region_id;
		info->region[i].queue_num = conf_ptr->queue_num;

<...>

Ok, change in v4

Quoted 37 lines
Quoted 23 lines
Quoted 4 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+                      struct i40e_pf *pf, struct

rte_i40e_rss_region_conf

Quoted 4 lines

*conf_ptr)

What do you think starting all functions, even they are static, with "i40e_queue_region_" prefix?

                                ret = i40e_set_queue_region(pf, conf_ptr);
                                break;
                case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
                                ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
                                break;
                case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
                                ret = -EINVAL;
                                break;
                case RTE_PMD_I40E_UP_REGION_SET:
                                ret = i40e_set_up_region(pf, conf_ptr);

Quoted 2 lines

I have use the format ofi40e_set_  as prefix? Because many set is not related directly to queue region.

When looking to this patch what functions are doing is clear, but it also should be clear when looking the source code some time later what that function is about.

That is why I believe a namespace is useful, like "i40e_queue_region_xx", so you can immediately say this function is about "RSS queue region" feature.

This function is "rte_pmd_i40e_queue_region_conf", it is applying provided queue region configuration based of region op type, so I assumed all these functions are directly related to the fature.

Quoted 5 lines

If you believe function name will be wrong with that prefix, of course just don't use it, but please try to stick with a name space, that will make easy to understand these features in all source code.

<...>

Ok, fix in v4

Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

+
+      memset(&hw->local_dcbx_config, 0,
+      sizeof(struct i40e_dcbx_config));

Wrong indentation.

Reminder of this one incase missed.

Ok, change in v4

Quoted 6 lines

<...>

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+                                      struct

rte_i40e_rss_region_conf *conf_ptr) {

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

+      struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check

other

Quoted 1 line

APIs in this file.

Reminder of this one incase missed.

Ok, change in v4

Quoted 17 lines

I mean is_i40e_supported() call that other APIs have.

<...>

Quoted 11 lines
Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2618

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+      if (!is_i40e_supported(dev))
+                      return -ENOTSUP;
+
+      switch (op_type) {
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
+                      ret = i40e_set_queue_region(pf, conf_ptr);
+                      break;

Does it make sense to add another type to get the current queue region config?

Quoted 1 line

Reminder of this one incase missed.

I will add a get command.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

+      case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+                      ret = i40e_set_region_flowtype_pf(hw, pf,

Quoted 8 lines
Quoted 6 lines

conf_ptr);

Quoted 5 lines
Quoted 3 lines

+                      break;
+      case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+                      ret = -EINVAL;

Will this be implemented later, or not a valid case at all?

Reminder of this one incase missed.

Ok, change in v4

Quoted 12 lines
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines

+                      break;
+      case RTE_PMD_I40E_UP_REGION_SET:> +

ret =

Quoted 8 lines

i40e_set_up_region(pf, conf_ptr);

Quoted 6 lines

+                      break;
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+                      ret = i40e_flush_region_all_conf(hw, pf, 1); +                      break;
+      case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+                      ret = i40e_flush_region_all_conf(hw, pf, 0);

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Can you please describe what flush_on and flush_off are, you can comment to code if also.

Reminder of this one incase missed.

I will comment to code in v4.
ALL config from CLI at first will only keep in DPDK software stored in driver, only after " FLUSH_ON ", it commit all configure to HW. Because I have to set hardware config at a time, so I have to record all CLI command at first.
" FLUSH_OFF " is just clean all configuration about queue region just now, and restore all to DPDK i40e driver default config when start up. The following is my test process in CLI:

./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 -- -i --nb-cores=8 --rxq=8 --txq=8 --port-topology=chained set fwd rxonly port config all rss all queue-region set port 0 region_id 0 queue_start_index 2 queue_num 2 queue-region set port 0 region_id 1 queue_start_index 4 queue_num 2
queue-region set pf port 0 region_id 0 flowtype 31
queue-region set pf port 0 region_id 1 flowtype 33
queue-region set pf port 0 region_id 1 flowtype 34
queue-region set port 0 UP 1 region_id 0
queue-region set port 0 UP 3 region_id 1
queue-region flush on port 0
start set verbose 1 sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/Dot1Q(prio=3)/IP(src="10.0.0.1",dst="192.168.0.2")/TCP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/SCTP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/UDP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10)

Quoted 12 lines

<...>

Quoted 6 lines
Quoted 6 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping {  }; · line 162

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.h +1 -0
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
   /**
+ * Queue region information get from CLI.

It doesn't need to be from CLI, can drop that part

Reminder of this one incase missed.

Ok, change in v4

Quoted 10 lines

<...>

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

+      uint8_t user_priority;
+      enum rte_pmd_i40e_queue_region_op  op;

Extra space before "op"

Maybe, I SHOULD add uint8_t raw[3] before “op”

Sorry, I didn't get this one.

Ok

Quoted 7 lines

<...>

Quoted 4 lines
Quoted 4 lines

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Quoted 3 lines

port,  int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
                                                           struct

Quoted 8 lines
Quoted 6 lines

ether_addr *mac_addr);

Quoted 5 lines
Quoted 3 lines

+/**
+ * Get RSS queue region info from CLI and do configuration for

Again now this is an API, not just for testpmd, please drop CLI

Reminder of this one incase missed.

Ok, change in v4

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

+ * that port as the command otion type

s/otion/options

Reminder of this one incase missed.

Ok, change in v4

Quoted 8 lines

<...>

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+int rte_pmd_i40e_queue_region_conf(uint8_t port,

Can you please use port_id as variable name to be consistent.

Reminder of this one incase missed.

Ok, change in v4

Quoted 2 lines

<...>

author
#25 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

In reply to Ferruh Yigit

Hi, Ferruh

Quoted 115 lines

-----Original Message-----

From: Yigit, Ferruh

Sent: Wednesday, September 20, 2017 6:36 PM

To: Zhao1, Wei <[email protected]>; [email protected]

Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 9 lines · Wei Zhao

This feature enable queue regions configuration for RSS in PF/VF, so

that different traffic classes or different packet classification

types can be separated to different queues in different queue

regions.This patch can set queue region range, it include queue number

in a region and the index of first queue.

Is following correct:

So instead of distributing packets to the multiple queues, this will distribute

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue

region to multiple queues?

And is this feature only supported with RSS? Can it be part of RSS

configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 10 lines

different traffic classes.It also enable mapping between a region

index and a sepcific flowtype(PCTYPE).It also provide the solution of

flush all configuration about queue region the above described.

Quoted 7 lines

---

 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482

++++++++++++++++++++++++++++++

Quoted 7 lines
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 27 lines
drivers/net/i40e/rte_pmd_i40e.c +14 -0
+static int
 
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
 
+                                            struct i40e_pf *pf)
 
+{
 
+      uint16_t i;
 
+      struct i40e_vsi *vsi = pf->main_vsi;
 
+      uint16_t queue_offset, bsf, tc_index;
 
+      struct i40e_vsi_context ctxt;
 
+      struct i40e_aqc_vsi_properties_data *vsi_info;
 
+      struct i40e_queue_region_info *region_info =
 
+                                                      &pf->queue_region;
 
+      uint32_t ret = -EINVAL;
 
+
 
+      if (!region_info->queue_region_number) {

....................

Quoted 11 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
 
+                                      struct rte_i40e_rss_region_conf *conf_ptr) {
 
+      struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check other

APIs in this file.

I have already "if (!is_i40e_supported(dev))" code in v3 in function rte_pmd_i40e_queue_region_conf.

So, I do not know what is your meaning.

Quoted 39 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2610

Quoted 13 lines

+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +2 -0
+      enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
 
+      uint32_t ret;

This should be signed variable, since you are using it for return and assigning

negative values.

Quoted 15 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
 
+      if (!is_i40e_supported(dev))
 
+                      return -ENOTSUP;
 
+
 
+      switch (op_type) {
 
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
 
+                      ret = i40e_set_queue_region(pf, conf_ptr);
 
+                      break;
#26 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 1 line · Wei

Hi,  Ferruh

Hi Wei,

Quoted 70 lines
Quoted 5 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

flush

Quoted 10 lines · Wei Zhao
Quoted 5 lines

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will

distribute

Quoted 5 lines

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

Quoted 12 lines

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 5 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

<mailto:[email protected]>>

Quoted 12 lines
Quoted 4 lines

---
  drivers/net/i40e/i40e_ethdev.c            |  19 +- drivers/net/i40e/i40e_ethdev.h            |  30 ++ drivers/net/i40e/rte_pmd_i40e.c           | 482

++++++++++++++++++++++++++++++

Quoted 4 lines

  drivers/net/i40e/rte_pmd_i40e.h           |  38 +++ drivers/net/i40e/rte_pmd_i40e_version.map |   1 +

  5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2178

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+                                            struct i40e_pf *pf)
+{
+      uint16_t i;
+      struct i40e_vsi *vsi = pf->main_vsi;
+      uint16_t queue_offset, bsf, tc_index;
+      struct i40e_vsi_context ctxt;
+      struct i40e_aqc_vsi_properties_data *vsi_info;
+      struct i40e_queue_region_info *region_info =
+                                                     

&pf->queue_region;

Quoted 3 lines
Quoted 3 lines

+      uint32_t ret = -EINVAL;
+
+      if (!region_info->queue_region_number) {


....................

Quoted 2 lines
Quoted 2 lines

+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+                                      struct

rte_i40e_rss_region_conf *conf_ptr) {

Quoted 2 lines
Quoted 1 line

+      struct rte_eth_dev *dev = &rte_eth_devices[port];

Quoted 8 lines
Quoted 1 line

you need to verify port_id, since this is public API now. Please check

other

Quoted 1 line

APIs in this file.

I have already "if (!is_i40e_supported(dev))" code in v3 in function rte_pmd_i40e_queue_region_conf.

So, I do not know what is your meaning.

RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);

Normally we don't need to worry about this in PMD because abstraction layer APIs do this check already. But since this is public API, user can give any value as port_id parameter, better to verify it.

Quoted 22 lines
Quoted 10 lines
Quoted 8 lines

+      struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data- dev_private);
+      struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data- dev_private);
+      enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op; +      uint32_t ret;

This should be signed variable, since you are using it for return and

assigning

Quoted 11 lines

negative values.

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+      if (!is_i40e_supported(dev))
+                      return -ENOTSUP;
+
+      switch (op_type) {
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
+                      ret = i40e_set_queue_region(pf, conf_ptr);
+                      break;
author
#27 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Thank you.

Quoted 118 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, September 28, 2017 3:13 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Quoted 1 line · Wei

Hi,  Ferruh

Hi Wei,

Quoted 71 lines
Quoted 5 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:36 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

flush

Quoted 10 lines · Wei Zhao
Quoted 5 lines

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.

Is following correct:
So instead of distributing packets to the multiple queues, this will

distribute

Quoted 5 lines

packets into queue reqions which may consists of multiple queues.

If so, is there a way to control how packets distributed within same queue region to multiple queues?

Quoted 12 lines

And is this feature only supported with RSS? Can it be part of RSS configuration instead of PMD specific API?

Quoted 1 line

This patch enable mapping between different priorities (UP) and

User priorities (UP)

Quoted 5 lines

different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

<mailto:[email protected]>>

Quoted 12 lines
Quoted 4 lines

---
  drivers/net/i40e/i40e_ethdev.c            |  19 +- drivers/net/i40e/i40e_ethdev.h            |  30 ++ drivers/net/i40e/rte_pmd_i40e.c           | 482

++++++++++++++++++++++++++++++

Quoted 4 lines

  drivers/net/i40e/rte_pmd_i40e.h           |  38 +++ drivers/net/i40e/rte_pmd_i40e_version.map |   1 +

  5 files changed, 566 insertions(+), 4 deletions(-)

<...>

Quoted 10 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2178

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+                                            struct i40e_pf *pf) {
+      uint16_t i;
+      struct i40e_vsi *vsi = pf->main_vsi;
+      uint16_t queue_offset, bsf, tc_index;
+      struct i40e_vsi_context ctxt;
+      struct i40e_aqc_vsi_properties_data *vsi_info;
+      struct i40e_queue_region_info *region_info =
+

&pf->queue_region;

Quoted 3 lines
Quoted 3 lines

+      uint32_t ret = -EINVAL;
+
+      if (!region_info->queue_region_number) {

....................

Quoted 2 lines
Quoted 2 lines

+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+                                      struct

rte_i40e_rss_region_conf *conf_ptr) {

Quoted 4 lines
Quoted 1 line

+      struct rte_eth_dev *dev = &rte_eth_devices[port];

you need to verify port_id, since this is public API now. Please check

Quoted 7 lines

other

Quoted 1 line

APIs in this file.

I have already "if (!is_i40e_supported(dev))" code in v3 in function rte_pmd_i40e_queue_region_conf.

So, I do not know what is your meaning.

RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);

Normally we don't need to worry about this in PMD because abstraction layer APIs do this check already. But since this is public API, user can give any value as port_id parameter, better to verify it.

Quoted 22 lines
Quoted 10 lines
Quoted 8 lines

+      struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data- dev_private);
+      struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data- dev_private);
+      enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op; +      uint32_t ret;

This should be signed variable, since you are using it for return and

assigning

Quoted 11 lines

negative values.

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+
+      if (!is_i40e_supported(dev))
+                      return -ENOTSUP;
+
+      switch (op_type) {
+      case RTE_PMD_I40E_QUEUE_REGION_SET:
+                      ret = i40e_set_queue_region(pf, conf_ptr);
+                      break;
#28 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

In reply to Wei Zhao
Quoted 260 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 15, 2017 4:13 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +9 -4
index 8e0580c..1663fc0 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
 >dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)

{

drivers/net/i40e/i40e_ethdev.c +6 -0
@@ -1309,6 +1314,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
drivers/net/i40e/i40e_ethdev.h +27 -0
index ad80f0f..d612886 100644
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info
 */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
drivers/net/i40e/i40e_ethdev.h +3 -0
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw,
 uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
drivers/net/i40e/i40e_ethdev.h +0 -0
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +17 -0
index d69a472..9a75f21 100644
@@ -35,6 +35,7 @@
 #include <rte_tailq.h>
 
 #include "base/i40e_prototype.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
 #include "i40e_rxtx.h"
@@ -2161,3 +2162,484 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port,
 uint16_t vf_id,
 
 	return 0;
 }
+
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +27 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	if (vsi->type == I40E_VSI_SRIOV) {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-
Quoted 1 line

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+	vsi_info->valid_sections |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+
+	/* Update the VSI after updating the VSI queue-mapping

information */

drivers/net/i40e/rte_pmd_i40e.c +27 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2263

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");

printf?

Quoted 371 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

drivers/net/i40e/rte_pmd_i40e.c +12 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr-
Quoted 1 line

queue_num;

drivers/net/i40e/rte_pmd_i40e.c +24 -0
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf

*conf_ptr)

drivers/net/i40e/rte_pmd_i40e.c +14 -0
+{
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

drivers/net/i40e/rte_pmd_i40e.c +31 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==
+					info->region[i].hw_flowtype[j]) {
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");
+			return ret;
+		}
+		flowtype_index = info-
Quoted 1 line

region[region_index].flowtype_num;

drivers/net/i40e/rte_pmd_i40e.c +5 -0
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +16 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;
+
+	if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

drivers/net/i40e/rte_pmd_i40e.c +44 -0
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +20 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +47 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,

err"

drivers/net/i40e/rte_pmd_i40e.c +82 -0
+			" %s aq_err %s",
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw)
+{
+	uint16_t i;
+	uint32_t ret = -EINVAL;
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

Why setting of flowtype mapping is separated to two different option? Does it mean that application will need to detect which driver it uses before calling this API? Application should not care which driver is in use, it tracks the number of queues used for RSS and just configures these queues to different regions, regardless if it runs on top of PF or VF. Difference in configuration for PF/VF should be hidden from application, so
only single RTE_PMD_I40E_REGION_FLOWTYPE_SET should be used.

All other options do not have separate check.
Will they work on both PF and VF?

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+
+	default:

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2645

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}

How this API can be tested, is there a separate testpmd patch?

Quoted 83 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
index 155b7e8..a1329f4 100644
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region

set*/

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype

set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all

configuration */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all

configuration */

drivers/net/i40e/rte_pmd_i40e.h +27 -0
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t
 port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);

#endif /* _PMD_I40E_H_ */

drivers/net/i40e/rte_pmd_i40e_version.map +1 -1
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;
 
 } DPDK_17.08;
--

2.9.3

author
#29 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 656 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, September 22, 2017 3:53 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

drivers/net/i40e/i40e_ethdev.c i40e_init_fdir_filter_list(struct rte_eth_dev

Quoted 44 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 15, 2017 4:13 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 8e0580c..1663fc0 100644

drivers/net/i40e/i40e_ethdev.c +0 -4
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev

*dev)

Quoted 38 lines
drivers/net/i40e/i40e_ethdev.c +7 -0
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev) {
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
 >dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info)); }
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)  { @@ -1309,6 +1314,9 @@

eth_i40e_dev_init(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c +6 -0
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index ad80f0f..d612886 100644

drivers/net/i40e/i40e_ethdev.h +0 -0
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {  #define
Quoted 4 lines

I40E_QOS_BW_WEIGHT_MIN 1
/* The max bandwidth weight is 127. */ #define
I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */ #define

I40E_REGION_MAX_INDEX

Quoted 167 lines

+7

drivers/net/i40e/i40e_ethdev.h +23 -0
+/* The max queue region userpriority is 7. */ #define
+I40E_REGION_USERPRIORITY_MAX_INDEX 7
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1]; };
+
 /* Tunnel filter number HW supports */  #define

I40E_MAX_TUNNEL_FILTER_NUM 400

drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info
 */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
drivers/net/i40e/i40e_ethdev.h +0 -0
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw,

uint32_t addr, uint32_t val); int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops); void i40e_tm_conf_init(struct rte_eth_dev *dev); void i40e_tm_conf_uninit(struct rte_eth_dev *dev);

drivers/net/i40e/i40e_ethdev.h +3 -0
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index d69a472..9a75f21 100644

drivers/net/i40e/rte_pmd_i40e.c +17 -0
@@ -35,6 +35,7 @@
 #include <rte_tailq.h>
 
 #include "base/i40e_prototype.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
 #include "i40e_rxtx.h"
@@ -2161,3 +2162,484 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port,
 uint16_t vf_id,
 
 	return 0;
 }
+
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +27 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	if (vsi->type == I40E_VSI_SRIOV) {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-
Quoted 1 line

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+	vsi_info->valid_sections |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+
+	/* Update the VSI after updating the VSI queue-mapping

information */

drivers/net/i40e/rte_pmd_i40e.c +26 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "
+			"mapping = %d ", hw->aq.asq_last_status);
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2263

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");

printf?

Quoted 368 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

drivers/net/i40e/rte_pmd_i40e.c +12 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr-
Quoted 1 line

queue_num;

drivers/net/i40e/rte_pmd_i40e.c +24 -0
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf

*conf_ptr)

drivers/net/i40e/rte_pmd_i40e.c +14 -0
+{
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

drivers/net/i40e/rte_pmd_i40e.c +31 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==
+					info->region[i].hw_flowtype[j]) {
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");
+			return ret;
+		}
+		flowtype_index = info-
Quoted 1 line

region[region_index].flowtype_num;

drivers/net/i40e/rte_pmd_i40e.c +5 -0
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c +15 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;
+
+	if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

drivers/net/i40e/rte_pmd_i40e.c +44 -0
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +20 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c +47 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,

err"

drivers/net/i40e/rte_pmd_i40e.c +80 -0
+			" %s aq_err %s",
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw) {
+	uint16_t i;
+	uint32_t ret = -EINVAL;
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
Quoted 1 line

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;
Quoted 7 lines

Why setting of flowtype mapping is separated to two different option? Does it mean that application will need to detect which driver it uses before calling this API? Application should not care which driver is in use, it tracks the number of queues used for RSS and just configures these queues to different regions, regardless if it runs on top of PF or VF. Difference in configuration for PF/VF should be hidden from application, so only single RTE_PMD_I40E_REGION_FLOWTYPE_SET should be used.

By now , we only support pf for this config.
But I think what you said is very reasonable. I can change code to a new scheme:
DPDK i40e driver use rte_eth_dev ->device->name to detect whether his name is
" net_i40e_vf " or " net_i40e" itself, then we can PMD driver decide to config PFQF_HREGION or VFQF_HREGION. I will make change in v4 later.

Quoted 3 lines

All other options do not have separate check.
Will they work on both PF and VF?

No, only WORK on PF. The reason we have talk in other mail before.

Quoted 17 lines
Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +16 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2645

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}

How this API can be tested, is there a separate testpmd patch?

Yes, testpmd has add new CLI commands to support it, also can be use by customer.

Quoted 82 lines

drivers/net/i40e/rte_pmd_i40e.h int

Quoted 49 lines
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..a1329f4 100644

drivers/net/i40e/rte_pmd_i40e.h +6 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region

set*/

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype

set */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all

configuration */

drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all

configuration */

drivers/net/i40e/rte_pmd_i40e.h +14 -0
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op; };
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
@@ -657,4 +683,16 @@ int

rte_pmd_i40e_ptype_mapping_replace(uint8_t

Quoted 31 lines
drivers/net/i40e/rte_pmd_i40e.h +12 -0
 port,
 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Get RSS queue region info from CLI and do configuration for
+ * that port as the command otion type
+ *
+ * @param port
+ *    pointer to port identifier of the device
+ * @param conf_ptr
+ *    pointer to the struct that contain all the
+ *    region configuration parameters
+ */
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+		struct rte_i40e_rss_region_conf *conf_ptr);

#endif /* _PMD_I40E_H_ */

drivers/net/i40e/rte_pmd_i40e_version.map +1 -1
index ef8882b..c3ee2da 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_queue_region_conf;
 
 } DPDK_17.08;
--

2.9.3

#30 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi Wei

Quoted 19 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, September 22, 2017 9:49 AM
To: Chilikin, Andrey <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 8 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, September 22, 2017 3:53 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

flush

<snip>

Quoted 4 lines
Quoted 4 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2263

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");

printf?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+

<snip>

Quoted 30 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

Why setting of flowtype mapping is separated to two different option? Does it mean that application will need to detect which driver it uses before calling this API? Application should not care which driver is in use, it tracks

the

Quoted 4 lines

number of queues used for RSS and just configures these queues to different regions, regardless if it runs on top of PF or VF. Difference in configuration for PF/VF should be hidden from application, so only single RTE_PMD_I40E_REGION_FLOWTYPE_SET should be used.

By now , we only support pf for this config.
But I think what you said is very reasonable. I can change code to a new scheme:
DPDK i40e driver use rte_eth_dev ->device->name to detect whether his
name is
" net_i40e_vf " or " net_i40e" itself, then we can PMD driver decide to config PFQF_HREGION or VFQF_HREGION.
I will make change in v4 later.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

All other options do not have separate check.
Will they work on both PF and VF?

No, only WORK on PF. The reason we have talk in other mail before.

Yes, it is why I was confused with separating RTE_PMD_I40E_REGION_FLOWTYPE to PF and VF. All options work on PF only, by only FLOWTYPE was split to PF/VF.

Quoted 11 lines
Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2634

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+

Could you explain what is the difference between FLUSH_OFF and FLUSH_ON and how it can be used by an application?

Quoted 13 lines
Quoted 12 lines
Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
Quoted 4 lines
Quoted 1 line

How this API can be tested, is there a separate testpmd patch?

Yes, testpmd has add new CLI commands to support it, also can be use by customer.

Sorry, missed second part of the patchset.

Regards,
Andrey

author
#31 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi, Andrey

Quoted 32 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Saturday, September 23, 2017 4:14 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Hi Wei

Quoted 20 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, September 22, 2017 9:49 AM
To: Chilikin, Andrey <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

Hi,Andrey

Quoted 9 lines

-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, September 22, 2017 3:53 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Yigit, Ferruh <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and

Quoted 1 line

flush

Quoted 8 lines

<snip>

Quoted 4 lines
Quoted 4 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2263

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");

printf?

Yes, just a reminder for user, you think I should use " PMD_INIT_LOG( )" instead? I will change to that.

Quoted 47 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+

<snip>

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

Why setting of flowtype mapping is separated to two different option? Does it mean that application will need to detect which driver it uses before calling this API? Application should not care which driver is in use, it tracks

Quoted 5 lines

the

Quoted 4 lines

number of queues used for RSS and just configures these queues to different regions, regardless if it runs on top of PF or VF. Difference in configuration for PF/VF should be hidden from application, so only single RTE_PMD_I40E_REGION_FLOWTYPE_SET

should be used.

Quoted 15 lines

By now , we only support pf for this config.
But I think what you said is very reasonable. I can change code to a new
scheme:
DPDK i40e driver use rte_eth_dev ->device->name to detect whether his
name is
" net_i40e_vf " or " net_i40e" itself, then we can PMD driver decide to config PFQF_HREGION or VFQF_HREGION.
I will make change in v4 later.

Quoted 3 lines

All other options do not have separate check.
Will they work on both PF and VF?

Quoted 6 lines
Quoted 2 lines

No, only WORK on PF. The reason we have talk in other mail before.

Yes, it is why I was confused with separating RTE_PMD_I40E_REGION_FLOWTYPE to PF and VF. All options work on PF only, by only FLOWTYPE was split to PF/VF.

Yes, I will point out that only pf support in commit log in v4.

Quoted 15 lines
Quoted 12 lines
Quoted 12 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2634

Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+

Could you explain what is the difference between FLUSH_OFF and FLUSH_ON and how it can be used by an application?

ALL config from CLI at first will only keep in DPDK software stored in driver, only after " FLUSH_ON ", it commit all configure to HW. Because I have to set hardware config at a time, so I have to record all CLI command at first.
" FLUSH_OFF " is just clean all configuration about queue region just now, and restore all to DPDK i40e driver default config when start up. The following is my test process in CLI:

./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 -- -i --nb-cores=8 --rxq=8 --txq=8 --port-topology=chained
set fwd rxonly
port config all rss all
queue-region set port 0 region_id 0 queue_start_index 2 queue_num 2
queue-region set port 0 region_id 1 queue_start_index 4 queue_num 2
queue-region set pf port 0 region_id 0 flowtype 31
queue-region set pf port 0 region_id 1 flowtype 33
queue-region set pf port 0 region_id 1 flowtype 34
queue-region set port 0 UP 1 region_id 0
queue-region set port 0 UP 3 region_id 1
queue-region flush on port 0
start
set verbose 1
sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/Dot1Q(prio=3)/IP(src="10.0.0.1",dst="192.168.0.2")/TCP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/SCTP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/UDP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10)

Quoted 23 lines
Quoted 14 lines
Quoted 13 lines
Quoted 12 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
Quoted 4 lines
Quoted 1 line

How this API can be tested, is there a separate testpmd patch?

Yes, testpmd has add new CLI commands to support it, also can be use by customer.

Sorry, missed second part of the patchset.

Regards,
Andrey

#32 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

In reply to Wei Zhao
Quoted 61 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 15, 2017 11:13 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +9 -4
index 8e0580c..1663fc0 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev) · line 1319

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
@@ -1309,6 +1314,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+

If this func i40e_init_queue_region_conf is only called here, then it is Not necessary? Because all the pf struct has been zeroed at probe time.

Quoted 18 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
drivers/net/i40e/i40e_ethdev.h +0 -0
index ad80f0f..d612886 100644

drivers/net/i40e/i40e_ethdev.h enum i40e_flxpld_layer_idx { · line 266

Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +4 -0
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+/* The max queue region userpriority is 7. */
+#define I40E_REGION_USERPRIORITY_MAX_INDEX 7

You can reuse I40E_MAX_USER_PRIORITY.

drivers/net/i40e/i40e_ethdev.h enum i40e_flxpld_layer_idx { · line 269

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+

You can use I40E_FILTER_PCTYPE_MAX

Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 560

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +7 -0
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];

Please comment what is the meaning of this array?

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 562

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.h +2 -0
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];

The same, please comment it.

Quoted 65 lines
drivers/net/i40e/i40e_ethdev.h +11 -0
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr,
 uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
drivers/net/i40e/i40e_ethdev.h +0 -0
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +20 -0
index d69a472..9a75f21 100644
@@ -35,6 +35,7 @@
 #include <rte_tailq.h>
 
 #include "base/i40e_prototype.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
 #include "i40e_rxtx.h"
@@ -2161,3 +2162,484 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t
 vf_id,
 
 	return 0;
 }
+
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t · line 2193

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+

Please use the vsi_info stored in i40e_vsi to avoid missing parameters.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2196

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+

Ctxt has been zeroed, no need to memset tc_mapping and queue_mapping again.

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2212

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset << I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |
+				(bsf << I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged */
+	if (vsi->type == I40E_VSI_SRIOV) {

Vsi is main vsi, it is impossible that the type to be SRIOV. If you want to configure Queue mapping on sriov VSI, you need to scan all the SRIOV VSIs.

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+		vsi_info->mapping_flags |=
+			rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2229

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi->base_queue);
+	}
+	vsi_info->valid_sections |=
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);
+
+	/* Update the VSI after updating the VSI queue-mapping information */
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "

PMD_INIT_LOG -> PMD_DRV_LOG

Quoted 27 lines
drivers/net/i40e/rte_pmd_i40e.c +27 -0
+			"mapping = %d ", hw->aq.asq_last_status);
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2266

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");
+		return ret;
+	}
+

If you just want to check if the queue_nume is one of {1, 2,4,8,16,32,64} You can use

If (rte_is_power_of_2(queue_num) && queue_num <= 64)

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI range");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {

It is impossible that i > I40E_REGION_MAX_INDEX, right?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr->queue_num;
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");

Does it mean we can not change the set of one queue region whose id is set before?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2303

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}

I think this part of code can be refined.

Quoted 24 lines
drivers/net/i40e/rte_pmd_i40e.c +24 -0
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index is 63");
+		return ret;
+	}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2337

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}

If info->queue_region_number==0, then i would be 0. So, the outer wrap if (info->queue_region_number) {} can be omit. The same at above func, I think this part of code can be refined.

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		region_index = i;
+	
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==
+					info->region[i].hw_flowtype[j]) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2353

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");
+			return ret;

Is that right to return -EINVAL when it has been set. And it seems In this function, the error code is only -EINVAL, if so, why we define ret?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2360

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+		}
+		flowtype_index = info->region[region_index].flowtype_num;
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");

Again, please use PMD_DRV_LOG. Because the func is not called at initialization time. Please replace it in all the patch.

Quoted 24 lines
drivers/net/i40e/rte_pmd_i40e.c +24 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2394

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;

What is the (conf_ptr->hw_flowtype & 0x7) == 1/2/3/4/5/6 meanings? Please avoid coding with integer number. Can not understand the relationship with flow type. And the hw_flowtype is API to users, you need to make it clear enough.

Quoted 132 lines
drivers/net/i40e/rte_pmd_i40e.c +132 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 << I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;
+
+	if (conf_ptr->user_priority > I40E_REGION_USERPRIORITY_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed, err"
+			" %s aq_err %s",

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2536

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw)

Can i40e_dcb_init_configure do what this func did here?

Quoted 38 lines
drivers/net/i40e/rte_pmd_i40e.c +38 -0
+{
+	uint16_t i;
+	uint32_t ret = -EINVAL;
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2584

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);

Don't check all the return code?

Quoted 29 lines
drivers/net/i40e/rte_pmd_i40e.c +29 -0
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

If it is not supported, why to define this op?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2630

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;

What is the FLUSH on meaning? Commit all configure to HW?
If so, what makes me confused that:
RTE_PMD_I40E_QUEUE_REGION_SET only touch the software stored in driver. But RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET set the I40E_PFQF_HREGION register. Those behaviors are not consist.

And FLUSH OFF means delete all?

You need to add more comments.

Quoted 44 lines
drivers/net/i40e/rte_pmd_i40e.c +15 -0
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
drivers/net/i40e/rte_pmd_i40e.h +14 -0
index 155b7e8..a1329f4 100644
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
 };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set*/
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region pctype set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region pctype set */
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype set */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all configuration */
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all configuration */
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {
 };
 
 /**

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { · line 172

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10 -0
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op;
+};

This is API struct, you need to comment them in detail

Thanks
Jingjing

author
#33 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

Hi, jingjing

Quoted 71 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Monday, September 25, 2017 12:02 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

drivers/net/i40e/i40e_ethdev.c i40e_init_fdir_filter_list(struct rte_eth_dev

Quoted 44 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 15, 2017 11:13 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 8e0580c..1663fc0 100644

drivers/net/i40e/i40e_ethdev.c +0 -4
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev

*dev)

Quoted 17 lines
drivers/net/i40e/i40e_ethdev.c +7 -0
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev) {
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
 dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info)); }
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)  { @@ -1309,6 +1314,9 @@

eth_i40e_dev_init(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c +0 -0
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
Quoted 6 lines

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev) · line 1319

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+

If this func i40e_init_queue_region_conf is only called here, then it is Not necessary? Because all the pf struct has been zeroed at probe time.

I find that t should also be called in i40e_flush_region_all_conf() to replace the code " memset(info, 0, sizeof(struct i40e_queue_region_info)); " So, in v4 I will change to that. Another reason is to set zero after restart process from CLI command " start -stop -start...."

Quoted 23 lines
Quoted 18 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index ad80f0f..d612886 100644

drivers/net/i40e/i40e_ethdev.h +0 -0
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {  #define
Quoted 4 lines

I40E_QOS_BW_WEIGHT_MIN 1
/* The max bandwidth weight is 127. */ #define
I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */ #define

I40E_REGION_MAX_INDEX

Quoted 4 lines

drivers/net/i40e/i40e_ethdev.h

Quoted 3 lines

+7

drivers/net/i40e/i40e_ethdev.h +2 -0
+/* The max queue region userpriority is 7. */ #define
+I40E_REGION_USERPRIORITY_MAX_INDEX 7

You can reuse I40E_MAX_USER_PRIORITY.

Ok, change in v4

Quoted 5 lines

drivers/net/i40e/i40e_ethdev.h enum i40e_flxpld_layer_idx { · line 269

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+

You can use I40E_FILTER_PCTYPE_MAX

Ok, change in v4

Quoted 11 lines
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
Quoted 8 lines

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 560

Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +7 -0
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];

Please comment what is the meaning of this array?

Ok, change in v4

Quoted 4 lines

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 562

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.h +2 -0
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];

The same, please comment it.

Ok, change in v4

Quoted 78 lines
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.h +6 -0
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1]; };
+
 /* Tunnel filter number HW supports */  #define

I40E_MAX_TUNNEL_FILTER_NUM 400

drivers/net/i40e/i40e_ethdev.h struct i40e_pf { · line 805

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info

*/

Quoted 36 lines
drivers/net/i40e/i40e_ethdev.h +0 -0
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw,

uint32_t addr, uint32_t val); int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops); void i40e_tm_conf_init(struct rte_eth_dev *dev); void i40e_tm_conf_uninit(struct rte_eth_dev *dev);

drivers/net/i40e/i40e_ethdev.h +3 -0
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index d69a472..9a75f21 100644

drivers/net/i40e/rte_pmd_i40e.c +7 -0
@@ -35,6 +35,7 @@
 #include <rte_tailq.h>
 
 #include "base/i40e_prototype.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
 #include "i40e_rxtx.h"
@@ -2161,3 +2162,484 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port,
 uint16_t vf_id,
 
 	return 0;
 }
+
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2193

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+

Please use the vsi_info stored in i40e_vsi to avoid missing parameters.

Quoted 5 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2196

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+

Ctxt has been zeroed, no need to memset tc_mapping and queue_mapping again.

Ok, change in v4

Quoted 14 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

drivers/net/i40e/rte_pmd_i40e.c

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

Quoted 7 lines

drivers/net/i40e/rte_pmd_i40e.c

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2212

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	if (vsi->type == I40E_VSI_SRIOV) {

Vsi is main vsi, it is impossible that the type to be SRIOV. If you want to configure Queue mapping on sriov VSI, you need to scan all the SRIOV VSIs.

Ok.

Quoted 132 lines

drivers/net/i40e/rte_pmd_i40e.c

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+	vsi_info->valid_sections |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);

drivers/net/i40e/rte_pmd_i40e.c

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+
+	/* Update the VSI after updating the VSI queue-mapping

information */

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2229

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "

PMD_INIT_LOG -> PMD_DRV_LOG

Quoted 26 lines
drivers/net/i40e/rte_pmd_i40e.c +26 -0
+			"mapping = %d ", hw->aq.asq_last_status);
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2266

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");
+		return ret;
+	}
+

If you just want to check if the queue_nume is one of {1, 2,4,8,16,32,64} You can use

If (rte_is_power_of_2(queue_num) && queue_num <= 64)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {

It is impossible that i > I40E_REGION_MAX_INDEX, right?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr->queue_num;
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");

Does it mean we can not change the set of one queue region whose id is set before?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2303

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}

I think this part of code can be refined.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf

*conf_ptr) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

Quoted 16 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2337

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}

If info->queue_region_number==0, then i would be 0. So, the outer wrap if (info->queue_region_number) {} can be omit. The same at above func, I think this part of code can be refined.

Let me have a little think about it.

Quoted 10 lines
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==
+					info->region[i].hw_flowtype[j]) {
+					flowtype_set = 1;
+					break;
+				}
+			}
Quoted 8 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2353

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");
+			return ret;

Is that right to return -EINVAL when it has been set. And it seems In this function, the error code is only -EINVAL, if so, why we define ret?

Yes, if it has been set , I will not do a second time. Other code also use rte as this way.

Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+		}
+		flowtype_index = info->region[region_index].flowtype_num;
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Again, please use PMD_DRV_LOG. Because the func is not called at initialization time.

Ok, change in v4

Quoted 37 lines

Please replace it in all the patch.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

Quoted 9 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;
What is the (conf_ptr->hw_flowtype & 0x7) == 1/2/3/4/5/6 meanings? Please avoid coding with integer number. Can not understand the relationship with flow type.
And the hw_flowtype is API to users, you need to make it clear enough.

No practical meaning, just find position for that pctype, because 8 type pctype reuse one register. We support 64 types of them.

Quoted 136 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;
+
+	if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

Quoted 34 lines
drivers/net/i40e/rte_pmd_i40e.c +34 -0
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +37 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,

err"

Quoted 13 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2536

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+			" %s aq_err %s",
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw)

Can i40e_dcb_init_configure do what this func did here?

It seems ok, change in v4.

Quoted 108 lines
Quoted 39 lines
drivers/net/i40e/rte_pmd_i40e.c +38 -0
+{
+	uint16_t i;
+	uint32_t ret = -EINVAL;
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2584

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);

Don't check all the return code?

Quoted 30 lines
drivers/net/i40e/rte_pmd_i40e.c +21 -0
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

If it is not supported, why to define this op?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2630

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;

What is the FLUSH on meaning? Commit all configure to HW? If so, what makes me confused that:
RTE_PMD_I40E_QUEUE_REGION_SET only touch the software stored in driver.
But RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET set the I40E_PFQF_HREGION register.
Those behaviors are not consist.

Quoted 3 lines

And FLUSH OFF means delete all?

You need to add more comments.

I will add more comment in function comment.
ALL config from CLI at first will only keep in DPDK software stored in driver, only after " FLUSH_ON ", it commit all configure to HW. Because I have to set hardware config at a time, so I have to record all CLI command at first.
" FLUSH_OFF " is just clean all configuration about queue region just now, and restore all to DPDK i40e driver default config when start up. The following is my test process in CLI:

./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 -- -i --nb-cores=8 --rxq=8 --txq=8 --port-topology=chained set fwd rxonly port config all rss all queue-region set port 0 region_id 0 queue_start_index 2 queue_num 2 queue-region set port 0 region_id 1 queue_start_index 4 queue_num 2 queue-region set pf port 0 region_id 0 flowtype 31 queue-region set pf port 0 region_id 1 flowtype 33 queue-region set pf port 0 region_id 1 flowtype 34 queue-region set port 0 UP 1 region_id 0 queue-region set port 0 UP 3 region_id 1 queue-region flush on port 0 start set verbose 1 sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/Dot1Q(prio=3)/IP(src="10.0.0.1",dst="192.168.0.2")/TCP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/SCTP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10) sendp([Ether(dst="3C:FD:FE:9F:70:B8", src="52:00:00:00:00:00")/IP(src="10.0.0.1",dst="192.168.0.2")/UDP(dport=80, sport=80 )/("X"*48)], iface="ens5f2", count=10)

Quoted 48 lines
Quoted 21 lines
drivers/net/i40e/rte_pmd_i40e.c +15 -0
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..a1329f4 100644

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 98

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region

set*/

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 99

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 100

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype

set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 102

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all

configuration */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 103

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all

configuration */

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 
Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping {

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +9 -0
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op; };

This is API struct, you need to comment them in detail

Ok, change in v4

Quoted 3 lines

Thanks
Jingjing

author
#34 lore raw

Re: [PATCH v3 1/2] net/i40e: queue region set and flush

In reply to Wu, Jingjing

Hi, jingjing

Quoted 311 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Monday, September 25, 2017 12:02 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

drivers/net/i40e/i40e_ethdev.c i40e_init_fdir_filter_list(struct rte_eth_dev

Quoted 44 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Friday, September 15, 2017 11:13 AM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF/VF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue.
This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  19 +-
 drivers/net/i40e/i40e_ethdev.h            |  30 ++
 drivers/net/i40e/rte_pmd_i40e.c           | 482
++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  38 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 566 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 8e0580c..1663fc0 100644

drivers/net/i40e/i40e_ethdev.c +0 -4
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -1034,6 +1030,15 @@ i40e_init_fdir_filter_list(struct rte_eth_dev

*dev)

Quoted 14 lines
drivers/net/i40e/i40e_ethdev.c +7 -0
 	return ret;
 }
 
+static void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev) {
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-
 dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info)); }
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)  { @@ -1309,6 +1314,9 @@

eth_i40e_dev_init(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c eth_i40e_dev_init(struct rte_eth_dev *dev) · line 1319

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+	/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+

If this func i40e_init_queue_region_conf is only called here, then it is Not necessary? Because all the pf struct has been zeroed at probe time.

Quoted 18 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1464,6 +1472,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+	/* Remove all the queue region configuration */
+	i40e_flush_region_all_conf(hw, pf, 0);
+
 	return 0;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index ad80f0f..d612886 100644

drivers/net/i40e/i40e_ethdev.h +0 -0
@@ -260,6 +260,16 @@ enum i40e_flxpld_layer_idx {  #define
Quoted 4 lines

I40E_QOS_BW_WEIGHT_MIN 1
/* The max bandwidth weight is 127. */ #define
I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */ #define

I40E_REGION_MAX_INDEX

drivers/net/i40e/i40e_ethdev.h

Quoted 3 lines

+7

drivers/net/i40e/i40e_ethdev.h +2 -0
+/* The max queue region userpriority is 7. */ #define
+I40E_REGION_USERPRIORITY_MAX_INDEX 7

You can reuse I40E_MAX_USER_PRIORITY.

drivers/net/i40e/i40e_ethdev.h enum i40e_flxpld_layer_idx { · line 269

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+/* The max pctype index is 63. */
+#define I40E_REGION_PCTYPE_MAX_INDEX 63
+

You can use I40E_FILTER_PCTYPE_MAX

Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +3 -0
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 560

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +7 -0
@@ -541,6 +551,22 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	uint8_t region_id;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority_num;
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];

Please comment what is the meaning of this array?

drivers/net/i40e/i40e_ethdev.h struct i40e_ethertype_rule { · line 562

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.h +2 -0
+	uint8_t flowtype_num;
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];

The same, please comment it.

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +6 -0
+};
+
+struct i40e_queue_region_info {
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1]; };
+
 /* Tunnel filter number HW supports */  #define

I40E_MAX_TUNNEL_FILTER_NUM 400

drivers/net/i40e/i40e_ethdev.h struct i40e_pf { · line 805

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -776,6 +802,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info

*/

Quoted 36 lines
drivers/net/i40e/i40e_ethdev.h +0 -0
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1030,9 @@ void i40e_check_write_reg(struct i40e_hw *hw,

uint32_t addr, uint32_t val); int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops); void i40e_tm_conf_init(struct rte_eth_dev *dev); void i40e_tm_conf_uninit(struct rte_eth_dev *dev);

drivers/net/i40e/i40e_ethdev.h +3 -0
+int i40e_flush_region_all_conf(struct i40e_hw *hw,
+				struct i40e_pf *pf, uint16_t on);
+
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index d69a472..9a75f21 100644

drivers/net/i40e/rte_pmd_i40e.c +7 -0
@@ -35,6 +35,7 @@
 #include <rte_tailq.h>
 
 #include "base/i40e_prototype.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_pf.h"
 #include "i40e_rxtx.h"
@@ -2161,3 +2162,484 @@ rte_pmd_i40e_add_vf_mac_addr(uint8_t port,
 uint16_t vf_id,
 
 	return 0;
 }
+
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2193

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+

Please use the vsi_info stored in i40e_vsi to avoid missing parameters.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2196

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+

Ctxt has been zeroed, no need to memset tc_mapping and queue_mapping again.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

drivers/net/i40e/rte_pmd_i40e.c

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/rte_pmd_i40e.c

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2212

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	if (vsi->type == I40E_VSI_SRIOV) {

Vsi is main vsi, it is impossible that the type to be SRIOV. If you want to configure Queue mapping on sriov VSI, you need to scan all the SRIOV VSIs.

drivers/net/i40e/rte_pmd_i40e.c

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_NONCONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		for (i = 0; i < vsi->nb_qps; i++)
+			vsi_info->queue_mapping[i] =
+				rte_cpu_to_le_16(vsi->base_queue + i);
+	} else {
+		vsi_info->mapping_flags |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_QUE_MAP_CONTIG);

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2225

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+		vsi_info->queue_mapping[0] = rte_cpu_to_le_16(vsi-

base_queue);

drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	}
+	vsi_info->valid_sections |=
+
	rte_cpu_to_le_16(I40E_AQ_VSI_PROP_QUEUE_MAP_VALID);

drivers/net/i40e/rte_pmd_i40e.c

Quoted 2 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -0
+
+	/* Update the VSI after updating the VSI queue-mapping

information */

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2229

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure queue region "

PMD_INIT_LOG -> PMD_DRV_LOG

Quoted 26 lines
drivers/net/i40e/rte_pmd_i40e.c +26 -0
+			"mapping = %d ", hw->aq.asq_last_status);
+		return ret;
+	}
+	/* update the local VSI info with updated queue map */
+	(void)rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping,
+					sizeof(vsi->info.tc_mapping));
+	(void)rte_memcpy(&vsi->info.queue_mapping,
+			&ctxt.info.queue_mapping,
+		sizeof(vsi->info.queue_mapping));
+	vsi->info.mapping_flags = ctxt.info.mapping_flags;
+	vsi->info.valid_sections = 0;
+
+	return 0;
+}
+
+
+static int
+i40e_set_queue_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint16_t tc_size_tb[7] = {1, 2, 4, 8, 16, 32, 64};
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+
+	for (i = 0; i < I40E_REGION_MAX_INDEX; i++)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2266

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		if (conf_ptr->queue_num == tc_size_tb[i])
+			break;
+
+	if (i == I40E_REGION_MAX_INDEX) {
+		printf("The region sizes should be any of the following "
+		"values: 1, 2, 4, 8, 16, 32, 64 as long as the "
+		"total number of queues do not exceed the VSI allocation");
+		return ret;
+	}
+

If you just want to check if the queue_nume is one of {1, 2,4,8,16,32,64} You can use

If (rte_is_power_of_2(queue_num) && queue_num <= 64)

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_INIT_LOG(ERR, "the queue index exceeds the VSI

range");

Quoted 11 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2284

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if ((i == info->queue_region_number) &&
+			(i <= I40E_REGION_MAX_INDEX)) {

It is impossible that i > I40E_REGION_MAX_INDEX, right?

Yes, only support 8 queue region max.

Quoted 13 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2294

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			info->region[i].region_id = conf_ptr->region_id;
+			info->region[i].queue_num = conf_ptr->queue_num;
+			info->region[i].queue_start_index =
+				conf_ptr->queue_start_index;
+			info->queue_region_number++;
+		} else {
+			PMD_INIT_LOG(ERR, "queue region number "
+				"exceeds maxnum 8 or the "
+				"queue region id has "
+				"been set before");

Does it mean we can not change the set of one queue region whose id is set before?

No, FLUSH_OFF can clear all the config

Quoted 33 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2303

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+			return ret;
+		}
+	} else {
+		info->region[0].region_id = conf_ptr->region_id;
+		info->region[0].queue_num = conf_ptr->queue_num;
+		info->region[0].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	}

I think this part of code can be refined.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+
+	return 0;
+}
+
+static int
+i40e_set_region_flowtype_pf(struct i40e_hw *hw,
+		struct i40e_pf *pf, struct rte_i40e_rss_region_conf

*conf_ptr) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+	uint32_t pfqf_hregion;
+	uint32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, index, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	if (conf_ptr->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_INIT_LOG(ERR, "the hw_flowtype or PCTYPE max index

is 63");

Quoted 16 lines

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2337

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id has not "
+				"been set before");
+			return ret;
+		}

If info->queue_region_number==0, then i would be 0. So, the outer wrap if (info->queue_region_number) {} can be omit. The same at above func, I think this part of code can be refined.

Ok,change in v4

Quoted 396 lines
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j < info->region[i].flowtype_num; j++) {
+				if (conf_ptr->hw_flowtype ==
+					info->region[i].hw_flowtype[j]) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2353

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+					flowtype_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (flowtype_set) {
+			PMD_INIT_LOG(ERR, "that hw_flowtype "
+				"has been set before");
+			return ret;

Is that right to return -EINVAL when it has been set. And it seems In this function, the error code is only -EINVAL, if so, why we define ret?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -0
+		}
+		flowtype_index = info->region[region_index].flowtype_num;
+		info->region[region_index].hw_flowtype[flowtype_index] =
+						conf_ptr->hw_flowtype;
+		info->region[region_index].flowtype_num++;
+	} else  {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Again, please use PMD_DRV_LOG. Because the func is not called at initialization time.
Please replace it in all the patch.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	index = conf_ptr->hw_flowtype >> 3;
+	pfqf_hregion = i40e_read_rx_ctl(hw, I40E_PFQF_HREGION(index));
+
+	if ((conf_ptr->hw_flowtype & 0x7) == 0) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_0_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_0_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 1) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_1_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_1_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 2) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_2_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_2_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 3) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_3_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_3_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 4) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_4_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_4_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 5) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_5_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_5_SHIFT;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else if ((conf_ptr->hw_flowtype & 0x7) == 6) {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_6_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_6_SHIFT;
What is the (conf_ptr->hw_flowtype & 0x7) == 1/2/3/4/5/6 meanings? Please avoid coding with integer number. Can not understand the relationship with flow type.
And the hw_flowtype is API to users, you need to make it clear enough.

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+	} else {
+		pfqf_hregion |= conf_ptr->region_id <<
+				I40E_PFQF_HREGION_REGION_7_SHIFT;
+		pfqf_hregion |= 1 <<

I40E_PFQF_HREGION_OVERRIDE_ENA_7_SHIFT;

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+	}
+
+	i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(index), pfqf_hregion);
+
+	return 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+}
+
+static int
+i40e_set_up_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, region_index, up_set = 0;
+
+	if (conf_ptr->user_priority >

I40E_REGION_USERPRIORITY_MAX_INDEX) {

Quoted 34 lines
drivers/net/i40e/rte_pmd_i40e.c +34 -0
+		PMD_INIT_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (conf_ptr->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_INIT_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	if (info->queue_region_number) {
+		for (i = 0; i < info->queue_region_number; i++)
+			if (conf_ptr->region_id == info->region[i].region_id)
+				break;
+
+		if (i == info->queue_region_number) {
+			PMD_INIT_LOG(ERR, "that region id "
+				"has not been set before");
+			return ret;
+		}
+		region_index = i;
+
+		for (i = 0; i < info->queue_region_number; i++) {
+			for (j = 0; j <
+				info->region[i].user_priority_num; j++) {
+				if (info->region[i].user_priority[j] ==
+					conf_ptr->user_priority) {
+					up_set = 1;
+					break;
+				}
+			}
+		}
+
+		if (up_set) {
+			PMD_INIT_LOG(ERR, "that user priority "

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+				"has been set before");
+			return ret;
+		}
+
+		j = info->region[region_index].user_priority_num;
+		info->region[region_index].user_priority[j] =
+						conf_ptr->user_priority;
+		info->region[region_index].user_priority_num++;
+	} else {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	uint32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +37 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Set queue region DCB Config failed,

err"

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2536

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+			" %s aq_err %s",
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_dcb_configure_default(struct i40e_hw *hw)

Can i40e_dcb_init_configure do what this func did here?

Quoted 38 lines
drivers/net/i40e/rte_pmd_i40e.c +38 -0
+{
+	uint16_t i;
+	uint32_t ret = -EINVAL;
+
+	memset(&hw->local_dcbx_config, 0,
+	sizeof(struct i40e_dcbx_config));
+	/* set dcb default configuration */
+	hw->local_dcbx_config.etscfg.willing = 0;
+	hw->local_dcbx_config.etscfg.maxtcs = 0;
+	hw->local_dcbx_config.etscfg.tcbwtable[0] = 100;
+	hw->local_dcbx_config.etscfg.tsatable[0] =
+			I40E_IEEE_TSA_ETS;
+	/* all UPs mapping to region 0 */
+	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+		hw->local_dcbx_config.etscfg.prioritytable[i] = 0;
+	hw->local_dcbx_config.etsrec =
+		hw->local_dcbx_config.etscfg;
+	hw->local_dcbx_config.pfc.willing = 0;
+	hw->local_dcbx_config.pfc.pfccap =
+			I40E_MAX_TRAFFIC_CLASS;
+	/* FW needs one App to configure HW */
+	hw->local_dcbx_config.numapps = 1;
+	hw->local_dcbx_config.app[0].selector =
+			I40E_APP_SEL_ETHTYPE;
+	hw->local_dcbx_config.app[0].priority = 3;
+	hw->local_dcbx_config.app[0].protocolid =
+			I40E_APP_PROTOID_FCOE;
+	ret = i40e_set_dcb_config(hw);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+		"default dcb config fails. err = %d, aq_err = %d.",
+			ret, hw->aq.asq_last_status);
+		return ret;
+	}
+
+	return 0;
+}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2584

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+int
+i40e_flush_region_all_conf(struct i40e_hw *hw, struct i40e_pf *pf,
+				uint16_t on)
+{
+	uint16_t i;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_vsi_update_queue_region_mapping(hw, pf);
+		i40e_queue_region_dcb_configure(hw, pf);

Don't check all the return code?

Quoted 30 lines
drivers/net/i40e/rte_pmd_i40e.c +21 -0
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	i40e_vsi_update_queue_region_mapping(hw, pf);
+	i40e_queue_region_dcb_configure_default(hw);
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+
+	return 0;
+}
+
+int rte_pmd_i40e_queue_region_conf(uint8_t port,
+			struct rte_i40e_rss_region_conf *conf_ptr) {
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-

dev_private);

drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	enum rte_pmd_i40e_queue_region_op op_type = conf_ptr->op;
+	uint32_t ret;
+
+	if (!is_i40e_supported(dev))
+		return -ENOTSUP;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2624

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	switch (op_type) {
+	case RTE_PMD_I40E_QUEUE_REGION_SET:
+		ret = i40e_set_queue_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET:
+		ret = i40e_set_region_flowtype_pf(hw, pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET:
+		ret = -EINVAL;
+		break;

If it is not supported, why to define this op?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2630

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	case RTE_PMD_I40E_UP_REGION_SET:
+		ret = i40e_set_up_region(pf, conf_ptr);
+		break;
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_ON:
+		ret = i40e_flush_region_all_conf(hw, pf, 1);
+		break;

What is the FLUSH on meaning? Commit all configure to HW? If so, what makes me confused that:
RTE_PMD_I40E_QUEUE_REGION_SET only touch the software stored in driver.
But RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET set the I40E_PFQF_HREGION register.
Those behaviors are not consist.

And FLUSH OFF means delete all?

You need to add more comments.

Quoted 20 lines
drivers/net/i40e/rte_pmd_i40e.c +15 -0
+	case RTE_PMD_I40E_REGION_ALL_FLUSH_OFF:
+		ret = i40e_flush_region_all_conf(hw, pf, 0);
+		break;
+
+	default:
+		PMD_DRV_LOG(WARNING, "op type (%d) not supported",
+			    op_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	I40E_WRITE_FLUSH(hw);
+
+	return ret;
+}
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.h index 155b7e8..a1329f4 100644

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 98

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +6 -0
@@ -91,6 +91,20 @@ enum rte_pmd_i40e_package_info {
 	RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF  };
 
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED = 0,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region

set*/

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 99

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 100

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET,   /**< add vf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_UP_REGION_SET,   /**< add queue region pctype

set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 102

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_ON,   /**< flush on all

configuration */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 103

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	RTE_PMD_I40E_REGION_ALL_FLUSH_OFF,   /**< flush off all

configuration */

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.h +3 -0
+	RTE_PMD_I40E_QUEUE_REGION_OP_MAX
+};
+
 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
 
 /**
@@ -146,6 +160,18 @@ struct rte_pmd_i40e_ptype_mapping {  };
 

drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_ptype_mapping { }; · line 170

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +9 -0
 /**
+ * Queue region information get from CLI.
+ */
+struct rte_i40e_rss_region_conf {
+	uint8_t region_id;
+	uint8_t hw_flowtype;
+	uint8_t queue_start_index;
+	uint8_t queue_num;
+	uint8_t user_priority;
+	enum rte_pmd_i40e_queue_region_op  op; };

This is API struct, you need to comment them in detail

Thanks
Jingjing

author
#35 lore raw

PATCH v3 2/2 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 328 insertions(+)
app/test-pmd/cmdline.c +328 -0
index 0144191..060fcb1 100644
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "pf") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_PF_SET;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_VF_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_what =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				what, "pf#vf");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set pf|vf port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_what,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_UP_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14387,6 +14711,10 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_user_priority_region,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
 	NULL,
 };
 
Signature · 1 line
2.9.3
#36 lore raw

Re: [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 11 lines · Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++++

Testpmd documentation also needs to be updated.

Quoted 14 lines
 1 file changed, 328 insertions(+)
app/test-pmd/cmdline.c +4 -0
index 0144191..060fcb1 100644
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 653

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+			"queue-region set (pf|vf) port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"

I keep doing same comment but I will do it again...

Each patch adding a new feature looking from its own context and adding a new root level command and this is making overall testpmd confusing.

Since this is to set an option of the port, what do you think making this command part of existing commands, like:
"port config #P queue-region ...."
OR
"set port #P queue-region ..." ?

Quoted 28 lines
app/test-pmd/cmdline.c +21 -0
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8271

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id, &region_conf);

It is not safe to directly call PMD specific APIs from testpmd? What if that PMD is not enabled? There are samples how to do this, can you please check them?

<...>

author
#37 lore raw

Re: [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Hi, Ferruh

Quoted 16 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:46 PM
To: Zhao1, Wei <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 7 lines · Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on.
According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

Quoted 6 lines
Quoted 4 lines
---
 app/test-pmd/cmdline.c | 328

+++++++++++++++++++++++++++++++++++++++++++++++++

Testpmd documentation also needs to be updated.

Do you mean the following doc or others?
dpdk\doc\guides\testpmd_app_ug.rst

Quoted 32 lines

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 8 lines
 1 file changed, 328 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

0144191..060fcb1 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 7 lines
app/test-pmd/cmdline.c +5 -0
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id

(value) "

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 4 lines
app/test-pmd/cmdline.c +4 -0
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value)

region_id (value)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 653

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"

I keep doing same comment but I will do it again...

Quoted 8 lines

Each patch adding a new feature looking from its own context and adding a new root level command and this is making overall testpmd confusing.

Since this is to set an option of the port, what do you think making this command part of existing commands, like:
"port config #P queue-region ...."
OR
"set port #P queue-region ..." ?

What you said is very meaningful, but other feature liake ptype mapping use the same mode and so on. maybe we should do a whole work to make CLI command style consistent.

Quoted 40 lines
Quoted 28 lines
app/test-pmd/cmdline.c +20 -0
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8224,6 +8239,315 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data) {
+	struct cmd_queue_region_result *res = parsed_result;

app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_syn_filter = { · line 8270

Quoted 10 lines
app/test-pmd/cmdline.c +10 -0
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_queue_region_conf(res->port_id,

&region_conf);

Quoted 4 lines

It is not safe to directly call PMD specific APIs from testpmd? What if that PMD is not enabled? There are samples how to do this, can you please check them?

Good idea, I will add check code in PMD code to make sure RSS is enable. If not, code will return fail.

Quoted 1 line

<...>

#38 lore raw

Re: [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 23 lines · Wei

Hi, Ferruh

Quoted 21 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:46 PM
To: Zhao1, Wei <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 11 lines · Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on.
According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 328

+++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 4 lines
Quoted 1 line

Testpmd documentation also needs to be updated.

Do you mean the following doc or others?
dpdk\doc\guides\testpmd_app_ug.rst

Yes this one, thanks.

Quoted 37 lines
Quoted 37 lines

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 10 lines


 1 file changed, 328 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

0144191..060fcb1 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 7 lines
app/test-pmd/cmdline.c +5 -0
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id

(value) "

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 4 lines
app/test-pmd/cmdline.c +4 -0
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value)

region_id (value)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 653

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"

I keep doing same comment but I will do it again...

Each patch adding a new feature looking from its own context and adding a new root level command and this is making overall testpmd confusing.

Quoted 8 lines
Quoted 5 lines

Since this is to set an option of the port, what do you think making this command part of existing commands, like:
"port config #P queue-region ...."
OR
"set port #P queue-region ..." ?

What you said is very meaningful, but other feature liake ptype mapping use the same mode and so on. maybe we should do a whole work to make CLI command style consistent.

Yes ptype does it, is seems it is one of the missed ones. Although we can do a whole work for CLI commands, meanwhile I think new ones can be added properly.

This may be good opportunity to remember broken window theory [1] :)

[1]
https://blog.codinghorror.com/the-broken-window-theory/

<...>

author
#39 lore raw

Re: [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Hi,Ferruh

Quoted 84 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 25, 2017 5:43 PM
To: Zhao1, Wei <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 23 lines · Wei

Hi, Ferruh

Quoted 21 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, September 20, 2017 6:46 PM
To: Zhao1, Wei <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add API for configuration of queue region

Quoted 11 lines · Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 328

+++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 4 lines
Quoted 1 line

Testpmd documentation also needs to be updated.

Do you mean the following doc or others?
dpdk\doc\guides\testpmd_app_ug.rst

Yes this one, thanks.

Quoted 34 lines
Quoted 34 lines

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 10 lines


 1 file changed, 328 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

0144191..060fcb1 100644

app/test-pmd/cmdline.c +0 -0
@@ -637,6 +637,21 @@ static void cmd_help_long_parsed(void

*parsed_result,

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void · line 637

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
 			"ptype mapping update (port_id) (hw_ptype)

(sw_ptype)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 7 lines
app/test-pmd/cmdline.c +5 -0
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set (pf|vf) port (port_id) region_id

(value) "

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result,

Quoted 4 lines
app/test-pmd/cmdline.c +4 -0
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value)

region_id (value)\n"

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 653

Quoted 5 lines
app/test-pmd/cmdline.c +5 -0
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"

I keep doing same comment but I will do it again...

Quoted 2 lines
Quoted 2 lines

Each patch adding a new feature looking from its own context and adding a new root level command and this is making overall testpmd

confusing.

Quoted 8 lines
Quoted 6 lines

Since this is to set an option of the port, what do you think making this command part of existing commands, like:
"port config #P queue-region ...."
OR
"set port #P queue-region ..." ?

What you said is very meaningful, but other feature liake ptype mapping

Quoted 8 lines

use the same mode and so on.

Quoted 1 line

maybe we should do a whole work to make CLI command style consistent.

Yes ptype does it, is seems it is one of the missed ones. Although we can do a whole work for CLI commands, meanwhile I think new ones can be added properly.

This may be good opportunity to remember broken window theory [1] :)

But this type of CLI for queue region has been discussion when this feature skype meeting
We have do a ppt, which review by DPDK-ENG-TECH-COMMITTEE, they have support and approve this type of command for this feature. I think we should respect their review wok and decision of other committee member.
AND also, The minority is subordinate to the majority, do you think so ?
I do not want do hold a second meeting later to persuade them accept the new type of CLI command.
They may not also not change their idea too.

Quoted 5 lines

[1]
https://blog.codinghorror.com/the-broken-window-theory/

<...>

author
#40 lore raw

v4 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

 app/test-pmd/cmdline.c                      | 379 ++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 ++
 drivers/net/i40e/rte_pmd_i40e.c             | 536 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   1 +
 7 files changed, 1076 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#41 lore raw

PATCH v4 1/3 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 536 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 657 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index 720f067..1a5b73e 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1311,6 +1320,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+		/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1466,6 +1478,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+		/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	return 0;
 }
 
@@ -10419,7 +10434,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index ad80f0f..3d237cd 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +810,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1038,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +536 -0

545 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +60 -0

76 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.7.4
author
#42 lore raw

PATCH v4 2/3 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 379 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 379 insertions(+)
app/test-pmd/cmdline.c +379 -0
index 4f2d731..fc2444f 100644
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
+			"queue-region get port (port_id)\n"
+			"	 get all queue region related configuration info\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8228,6 +8246,362 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_USER_PRIORITY_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config flush error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_get_queue_region_info {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t get;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_get_queue_region_info_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_get_queue_region_info *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config info get error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_get_queue_region_info_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_get_queue_region_info_get =
+TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				get, "get");
+cmdline_parse_token_string_t cmd_get_queue_region_info_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				port, "port");
+cmdline_parse_token_num_t cmd_get_queue_region_info_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_get_queue_region_info,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_get_queue_region_info_all = {
+	.f = cmd_get_queue_region_info_parsed,
+	.data = NULL,
+	.help_str = "queue-region get port <port_id> "
+		": get all queue region related configuration info",
+	.tokens = {
+		(void *)&cmd_get_queue_region_info_cmd,
+		(void *)&cmd_get_queue_region_info_get,
+		(void *)&cmd_get_queue_region_info_port,
+		(void *)&cmd_get_queue_region_info_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14391,6 +14765,11 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_user_priority_region,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
+	(cmdline_parse_inst_t *)&cmd_get_queue_region_info_all,
 	NULL,
 };
 
Signature · 1 line
2.7.4
author
#43 lore raw

PATCH v4 3/3 doc/testpmd_app_ug: add doc info for queue region

In reply to Wei Zhao

Queue region only support PF by now, so this document is only for configuration of queue region on PF port.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +40 -0
index 2ed62f5..f31ec5f 100644
@@ -842,6 +842,46 @@ Where:
 
    Check the NIC Datasheet for hardware limits.
 
+RSS queue region
+~~~~~~~~~~~~~~~~
+
+Set RSS queue region span on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) queue_start_index (value) queue_num (value)
+
+Set flowtype mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) flowtype (value)
+
+where:
+
+* For the flowtype(pctype) of packet,the specific index for each type has
+  been defined in file i40e_type.h as enum i40e_filter_pctype.
+
+Set user priority mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) UP (value) region_id (value)
+
+Flush all queue region related configuration on a port::
+
+   testpmd> queue-region flush (on|off) port (port_id)
+
+where:
+* "on"is just an enable function which server for other configuration,
+  it is for all configuration about queue region from up layer,
+  at first will only keep in DPDK softwarestored in driver,
+  only after "flush on", it commit all configuration to HW.
+  "off" is just clean all configuration about queue region just now,
+  and restore all to DPDK i40e driver default config when start up.
+
+Get all queue region related configuration info on a port::
+
+   testpmd> queue-region get port (port_id)
+
+.. note::
+Queue region only support on PF by now, so thses command is
+only for configuration of queue region on PF port.
+
 csum parse-tunnel
 ~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.7.4
author
#44 lore raw

v4 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

 app/test-pmd/cmdline.c                      | 379 ++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 ++
 drivers/net/i40e/rte_pmd_i40e.c             | 536 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   1 +
 7 files changed, 1076 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#45 lore raw

PATCH v4 1/3 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 536 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 657 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index 720f067..1a5b73e 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1311,6 +1320,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+		/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1466,6 +1478,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+		/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	return 0;
 }
 
@@ -10419,7 +10434,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index ad80f0f..3d237cd 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +810,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1038,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +536 -0

545 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +60 -0

76 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.7.4
author
#46 lore raw

PATCH v4 2/3 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 379 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 379 insertions(+)
app/test-pmd/cmdline.c +379 -0
index 4f2d731..fc2444f 100644
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
+			"queue-region get port (port_id)\n"
+			"	 get all queue region related configuration info\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8228,6 +8246,362 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_USER_PRIORITY_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config flush error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_get_queue_region_info {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t get;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_get_queue_region_info_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_get_queue_region_info *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config info get error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_get_queue_region_info_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_get_queue_region_info_get =
+TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				get, "get");
+cmdline_parse_token_string_t cmd_get_queue_region_info_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				port, "port");
+cmdline_parse_token_num_t cmd_get_queue_region_info_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_get_queue_region_info,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_get_queue_region_info_all = {
+	.f = cmd_get_queue_region_info_parsed,
+	.data = NULL,
+	.help_str = "queue-region get port <port_id> "
+		": get all queue region related configuration info",
+	.tokens = {
+		(void *)&cmd_get_queue_region_info_cmd,
+		(void *)&cmd_get_queue_region_info_get,
+		(void *)&cmd_get_queue_region_info_port,
+		(void *)&cmd_get_queue_region_info_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14391,6 +14765,11 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_user_priority_region,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
+	(cmdline_parse_inst_t *)&cmd_get_queue_region_info_all,
 	NULL,
 };
 
Signature · 1 line
2.7.4
author
#47 lore raw

PATCH v4 3/3 doc/testpmd_app_ug: add doc info for queue region

In reply to Wei Zhao

Queue region only support PF by now, so this document is only for configuration of queue region on PF port.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +40 -0
index 2ed62f5..f31ec5f 100644
@@ -842,6 +842,46 @@ Where:
 
    Check the NIC Datasheet for hardware limits.
 
+RSS queue region
+~~~~~~~~~~~~~~~~
+
+Set RSS queue region span on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) queue_start_index (value) queue_num (value)
+
+Set flowtype mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) flowtype (value)
+
+where:
+
+* For the flowtype(pctype) of packet,the specific index for each type has
+  been defined in file i40e_type.h as enum i40e_filter_pctype.
+
+Set user priority mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) UP (value) region_id (value)
+
+Flush all queue region related configuration on a port::
+
+   testpmd> queue-region flush (on|off) port (port_id)
+
+where:
+* "on"is just an enable function which server for other configuration,
+  it is for all configuration about queue region from up layer,
+  at first will only keep in DPDK softwarestored in driver,
+  only after "flush on", it commit all configuration to HW.
+  "off" is just clean all configuration about queue region just now,
+  and restore all to DPDK i40e driver default config when start up.
+
+Get all queue region related configuration info on a port::
+
+   testpmd> queue-region get port (port_id)
+
+.. note::
+Queue region only support on PF by now, so these command is
+only for configuration of queue region on PF port.
+
 csum parse-tunnel
 ~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.7.4
author
#48 lore raw

v5 cover net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning
-add port id check

root (3):
net/i40e: queue region set and flush app/testpmd: add API for configuration of queue region doc/testpmd_app_ug: add doc info for queue region

 app/test-pmd/cmdline.c                      | 379 ++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 +++
 drivers/net/i40e/i40e_ethdev.c              |  27 +-
 drivers/net/i40e/i40e_ethdev.h              |  39 ++
 drivers/net/i40e/rte_pmd_i40e.c             | 537 ++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h             |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map   |   1 +
 7 files changed, 1077 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#49 lore raw

PATCH v5 1/3 net/i40e: queue region set and flush

This feature enable queue regions configuration for RSS in PF, so that different traffic classes or different packet classification types can be separated to different queues in different queue regions.This patch can set queue region range, it include queue number in a region and the index of first queue. This patch enable mapping between different priorities (UP) and different traffic classes.It also enable mapping between a region index and a sepcific flowtype(PCTYPE).It also provide the solution of flush all configuration about queue region the above described.

---
 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 537 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 658 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev.c +21 -6
index 720f067..1a5b73e 100644
@@ -137,10 +137,6 @@
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
 #define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
-#define I40E_MAX_PERCENT            100
-#define I40E_DEFAULT_DCB_APP_NUM    1
-#define I40E_DEFAULT_DCB_APP_PRIO   3
-
 /**
  * Below are values for writing un-exposed registers suggested
  * by silicon experts
@@ -309,7 +305,6 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
-static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
 static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
 		bool offset_loaded, uint64_t *offset, uint64_t *stat);
@@ -1036,6 +1031,20 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
 	return ret;
 }
 
+void
+i40e_init_queue_region_conf(struct rte_eth_dev *dev)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i;
+
+	for (i = 0; i < I40E_PFQF_HREGION_MAX_INDEX; i++)
+		i40e_write_rx_ctl(hw, I40E_PFQF_HREGION(i), 0);
+
+	memset(info, 0, sizeof(struct i40e_queue_region_info));
+}
+
 static int
 eth_i40e_dev_init(struct rte_eth_dev *dev)
 {
@@ -1311,6 +1320,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	if (ret < 0)
 		goto err_init_fdir_filter_list;
 
+		/* initialize queue region configuration */
+	i40e_init_queue_region_conf(dev);
+
 	return 0;
 
 err_init_fdir_filter_list:
@@ -1466,6 +1478,9 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 	/* Remove all Traffic Manager configuration */
 	i40e_tm_conf_uninit(dev);
 
+		/* Remove all the queue region configuration */
+	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
+
 	return 0;
 }
 
@@ -10419,7 +10434,7 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
  *
  * Returns 0 on success, negative value on failure
  */
-static int
+int
 i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
drivers/net/i40e/i40e_ethdev.h +39 -0
index ad80f0f..3d237cd 100644
@@ -260,6 +260,12 @@ enum i40e_flxpld_layer_idx {
 #define I40E_QOS_BW_WEIGHT_MIN 1
 /* The max bandwidth weight is 127. */
 #define I40E_QOS_BW_WEIGHT_MAX 127
+/* The max queue region index is 7. */
+#define I40E_REGION_MAX_INDEX 7
+
+#define I40E_MAX_PERCENT            100
+#define I40E_DEFAULT_DCB_APP_NUM    1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
 
 /**
  * The overhead from MTU to max frame size.
@@ -541,6 +547,34 @@ struct i40e_ethertype_rule {
 	struct rte_hash *hash_table;
 };
 
+/* queue region info */
+struct i40e_region_info {
+	/* the region id for this configuration */
+	uint8_t region_id;
+	/* the start queue index for this region */
+	uint8_t queue_start_index;
+	/* the total queue number of this queue region */
+	uint8_t queue_num;
+	/* the total number of user priority for this region */
+	uint8_t user_priority_num;
+	/* the packet's user priority for this region */
+	uint8_t user_priority[I40E_MAX_USER_PRIORITY];
+	/* the total number of flowtype for this region */
+	uint8_t flowtype_num;
+	/**
+	 * the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+	uint8_t hw_flowtype[I40E_FILTER_PCTYPE_MAX];
+};
+
+struct i40e_queue_region_info {
+	/* the total number of queue region for this port */
+	uint16_t queue_region_number;
+	struct i40e_region_info region[I40E_REGION_MAX_INDEX + 1];
+};
+
 /* Tunnel filter number HW supports */
 #define I40E_MAX_TUNNEL_FILTER_NUM 400
 
@@ -776,6 +810,7 @@ struct i40e_pf {
 	struct i40e_fdir_info fdir; /* flow director info */
 	struct i40e_ethertype_rule ethertype; /* Ethertype filter rule */
 	struct i40e_tunnel_rule tunnel; /* Tunnel filter rule */
+	struct i40e_queue_region_info queue_region; /* queue region info */
 	struct i40e_fc_conf fc_conf; /* Flow control conf */
 	struct i40e_mirror_rule_list mirror_list;
 	uint16_t nb_mirror_rule;   /* The number of mirror rules */
@@ -1003,6 +1038,10 @@ void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
 void i40e_tm_conf_init(struct rte_eth_dev *dev);
 void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
+int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+int i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+		struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on);
+void i40e_init_queue_region_conf(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
 	RTE_DEV_TO_PCI((eth_dev)->device)
drivers/net/i40e/rte_pmd_i40e.c +537 -0

546 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +60 -0

76 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
index ef8882b..29d6b74 100644
@@ -50,5 +50,6 @@ DPDK_17.11 {
 	global:
 
 	rte_pmd_i40e_add_vf_mac_addr;
+	rte_pmd_i40e_rss_queue_region_conf;
 
 } DPDK_17.08;
Signature · 1 line
2.7.4
#50 lore raw

Re: [PATCH v5 1/3] net/i40e: queue region set and flush

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +37 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	int32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2212

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset << I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |
+				(bsf << I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged */
+	if (vsi->type == I40E_VSI_SRIOV) {

You already assign the vsi to main_vsi in the beginning of the function, so
It is impossible here the type is SRIOV. I think I already commented it in your v3 patch set?

[......]

Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +12 -0
+static int
+i40e_queue_region_set_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr)
+{
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+
+	if (!((rte_is_power_of_2(conf_ptr->queue_num)) &&
+				conf_ptr->queue_num <= 64)) {
+		PMD_DRV_LOG(ERR, "The region sizes should be any of the following values: 1,

2, 4, 8, 16, 32, 64 as long as the "

drivers/net/i40e/rte_pmd_i40e.c +5 -0
+			"total number of queues do not exceed the VSI allocation");
+		return ret;
+	}
+
+	if (conf_ptr->region_id > I40E_REGION_MAX_INDEX) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2272

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_DRV_LOG(ERR, "the queue index exceeds the VSI range");
+		return ret;
+	}
+

You are using nb_used_qps for the comparison, is that to say the function Is supposed to be called after dev_start?

Quoted 25 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+	for (i = 0; i < info->queue_region_number; i++)
+		if (conf_ptr->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number &&
+				i <= I40E_REGION_MAX_INDEX) {
+		info->region[i].region_id = conf_ptr->region_id;
+		info->region[i].queue_num = conf_ptr->queue_num;
+		info->region[i].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	} else {
+		PMD_DRV_LOG(ERR, "queue region number exceeds maxnum 8 or the queue

region id has been set before");

drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_set_flowtype(struct i40e_pf *pf,
+			struct rte_i40e_rss_region_conf *rss_region_conf)
+{
+	int32_t ret = -EINVAL;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2306

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	/**
+	 * For the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+

Are you meeing the type of hw_flowtype in rss_region_conf Is defined in i40e_type.h?

Quoted 18 lines
drivers/net/i40e/rte_pmd_i40e.c +18 -0
+	if (rss_region_conf->region_id > I40E_PFQF_HREGION_MAX_INDEX) {
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (rss_region_conf->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_DRV_LOG(ERR, "the hw_flowtype or PCTYPE max index is 63");
+		return ret;
+	}
+
+
+	for (i = 0; i < info->queue_region_number; i++)
+		if (rss_region_conf->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "that region id has not been set before");
+		ret = -ENODATA;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2334

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+	region_index = i;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].flowtype_num; j++) {
+			if (rss_region_conf->hw_flowtype ==
+				info->region[i].hw_flowtype[j]) {
+				flowtype_set = 1;
+				break;

You can just return here?

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+			}
+		}
+	}
+

[......]

Quoted 24 lines
drivers/net/i40e/rte_pmd_i40e.c +24 -0
+static int
+i40e_queue_region_set_user_priority(struct i40e_pf *pf,
+		struct rte_i40e_rss_region_conf *rss_region_conf)
+{
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, region_index, user_priority_set = 0;
+
+	if (rss_region_conf->user_priority >= I40E_MAX_USER_PRIORITY) {
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (rss_region_conf->region_id >= I40E_REGION_MAX_INDEX) {
+		PMD_DRV_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	for (i = 0; i < info->queue_region_number; i++)
+		if (rss_region_conf->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "that region id has not been set before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2453

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		ret = -ENODATA;
+		return ret;
+	}
+	region_index = i;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			if (info->region[i].user_priority[j] ==
+				rss_region_conf->user_priority) {
+				user_priority_set = 1;

The same, you can return here.

Quoted 1 line
(quoted diff) +1 -0
+				break;

[......]

Quoted 120 lines
drivers/net/i40e/rte_pmd_i40e.c +120 -0
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "there is no that region id been set before");
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Set queue region DCB Config failed, err %s aq_err %s",
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on)
+{
+	int32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
+
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+
+	return 0;
+}
+
+static int
+i40e_queue_region_pf_check_rss(struct i40e_pf *pf)
+{
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	uint64_t hena;
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2600

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
+	hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) << 32;
+	if (hw->mac.type == I40E_MAC_X722)
+		hena &= I40E_RSS_HENA_ALL_X722;
+	else
+		hena &= I40E_RSS_HENA_ALL;
+
+	if (!hena)
+		return -ENOTSUP;
+

Why made such change? Will it be impacted by kiril's pctype patches and beilei's new pctype patches?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2606

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	return 0;
+}
+
+static void
+i40e_queue_region_get_all_info(struct i40e_pf *pf, uint16_t port_id)
+{

In this function, it looks like you print all the information about queue region? If so, You can use "display" instead of "get".
In my opinion, generally, we are getting info but not display info in API level.

[......]

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.h +9 -0
+
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set */
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region pctype set */
+	/**< add queue region user priority set */

If the comments is added before the definition, you need to use /** xxx */ instead of /**< XX */
for doxygen-likely format you can check http://www.dpdk.org/doc/guides/contributing/documentation.html#doxygen-guidelines

Thanks
Jingjing

author
#51 lore raw

Re: [PATCH v5 1/3] net/i40e: queue region set and flush

Hi, jingjing
All will be fix in v6

Quoted 377 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Friday, September 29, 2017 12:55 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v5 1/3] net/i40e: queue region set and flush

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+static int
+i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
+			      struct i40e_pf *pf)
+{
+	uint16_t i;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_vsi *vsi = pf->main_vsi;
+	uint16_t queue_offset, bsf, tc_index;
+	struct i40e_vsi_context ctxt;
+	struct i40e_aqc_vsi_properties_data *vsi_info;
+	struct i40e_queue_region_info *region_info =
+				&pf->queue_region;
+	int32_t ret = -EINVAL;
+
+	if (!region_info->queue_region_number) {
+		PMD_INIT_LOG(ERR, "there is no that region id been set

before");

Quoted 17 lines
drivers/net/i40e/rte_pmd_i40e.c +17 -0
+		return ret;
+	}
+
+	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
+
+	/* Update Queue Pairs Mapping for currently enabled UPs */
+	ctxt.seid = vsi->seid;
+	ctxt.pf_num = hw->pf_id;
+	ctxt.vf_num = 0;
+	ctxt.uplink_seid = vsi->uplink_seid;
+	ctxt.info = vsi->info;
+	vsi_info = &ctxt.info;
+
+	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
+	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
+
+	/**

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	 * Configure queue region and queue mapping parameters,
+	 * for enabled queue region, allocate queues to this region.
+	 */
+
+	for (i = 0; i < region_info->queue_region_number; i++) {
+		tc_index = region_info->region[i].region_id;
+		bsf = rte_bsf32(region_info->region[i].queue_num);
+		queue_offset = region_info->region[i].queue_start_index;
+		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
+			(queue_offset <<

I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |

Review

Quoted 1 line
(quoted diff) +1 -0
+				(bsf <<

I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));

drivers/net/i40e/i40e_ethdev.c i40e_init_fdir_filter_list(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +3 -0
+	}
+
+	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged

*/

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2212

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.c +1 -0
+	if (vsi->type == I40E_VSI_SRIOV) {

You already assign the vsi to main_vsi in the beginning of the function, so It is impossible here the type is SRIOV. I think I already commented it in your v3 patch set?

[......]

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+static int
+i40e_queue_region_set_region(struct i40e_pf *pf,
+				struct rte_i40e_rss_region_conf *conf_ptr) {
+	uint16_t i;
+	struct i40e_vsi *main_vsi = pf->main_vsi;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+
+	if (!((rte_is_power_of_2(conf_ptr->queue_num)) &&
+				conf_ptr->queue_num <= 64)) {
+		PMD_DRV_LOG(ERR, "The region sizes should be any of the

following

Review

Quoted 3 lines

+values: 1,
2, 4, 8, 16, 32, 64 as long as the "

(quoted diff) +1 -0
+			"total number of queues do not exceed the VSI

allocation");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		return ret;
+	}
+
+	if (conf_ptr->region_id > I40E_REGION_MAX_INDEX) {
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
+					> main_vsi->nb_used_qps) {
+		PMD_DRV_LOG(ERR, "the queue index exceeds the VSI

range");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2183

Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -0
+		return ret;
+	}
+

You are using nb_used_qps for the comparison, is that to say the function Is supposed to be called after dev_start?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+	for (i = 0; i < info->queue_region_number; i++)
+		if (conf_ptr->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number &&
+				i <= I40E_REGION_MAX_INDEX) {
+		info->region[i].region_id = conf_ptr->region_id;
+		info->region[i].queue_num = conf_ptr->queue_num;
+		info->region[i].queue_start_index =
+			conf_ptr->queue_start_index;
+		info->queue_region_number++;
+	} else {
+		PMD_DRV_LOG(ERR, "queue region number exceeds

maxnum 8 or the queue

Quoted 11 lines

region id has been set before");

drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+i40e_queue_region_set_flowtype(struct i40e_pf *pf,
+			struct rte_i40e_rss_region_conf *rss_region_conf) {
+	int32_t ret = -EINVAL;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2306

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	uint16_t i, j, flowtype_set = 0;
+	uint16_t region_index, flowtype_index;
+
+	/**
+	 * For the pctype or hardware flowtype of packet,
+	 * the specific index for each type has been defined
+	 * in file i40e_type.h as enum i40e_filter_pctype.
+	 */
+

Are you meeing the type of hw_flowtype in rss_region_conf Is defined in i40e_type.h?

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (rss_region_conf->region_id > I40E_PFQF_HREGION_MAX_INDEX)

{

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (rss_region_conf->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
+		PMD_DRV_LOG(ERR, "the hw_flowtype or PCTYPE max

index is 63");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return ret;
+	}
+
+
+	for (i = 0; i < info->queue_region_number; i++)
+		if (rss_region_conf->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "that region id has not been set

before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2334

Quoted 11 lines
drivers/net/i40e/rte_pmd_i40e.c +11 -0
+		ret = -ENODATA;
+		return ret;
+	}
+	region_index = i;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].flowtype_num; j++) {
+			if (rss_region_conf->hw_flowtype ==
+				info->region[i].hw_flowtype[j]) {
+				flowtype_set = 1;
+				break;

You can just return here?

Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -0
+			}
+		}
+	}
+

[......]

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +13 -0
+static int
+i40e_queue_region_set_user_priority(struct i40e_pf *pf,
+		struct rte_i40e_rss_region_conf *rss_region_conf) {
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, region_index, user_priority_set = 0;
+
+	if (rss_region_conf->user_priority >= I40E_MAX_USER_PRIORITY) {
+		PMD_DRV_LOG(ERR, "the queue region max index is 7");
+		return ret;
+	}
+
+	if (rss_region_conf->region_id >= I40E_REGION_MAX_INDEX) {

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		PMD_DRV_LOG(ERR, "the region_id max index is 7");
+		return ret;
+	}
+
+	for (i = 0; i < info->queue_region_number; i++)
+		if (rss_region_conf->region_id == info->region[i].region_id)
+			break;
+
+	if (i == info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "that region id has not been set

before");

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2453

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		ret = -ENODATA;
+		return ret;
+	}
+	region_index = i;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			if (info->region[i].user_priority[j] ==
+				rss_region_conf->user_priority) {
+				user_priority_set = 1;

The same, you can return here.

Quoted 1 line
(quoted diff) +1 -0
+				break;

[......]

Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e.c +5 -0
+
+static int
+i40e_queue_region_dcb_configure(struct i40e_hw *hw,
+				struct i40e_pf *pf)
+{

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_dcbx_config dcb_cfg_local;
+	struct i40e_dcbx_config *dcb_cfg;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
+	int32_t ret = -EINVAL;
+	uint16_t i, j, prio_index, region_index;
+	uint8_t tc_map, tc_bw, bw_lf;
+
+	if (!info->queue_region_number) {
+		PMD_DRV_LOG(ERR, "there is no that region id been set

before");

Quoted 37 lines
drivers/net/i40e/rte_pmd_i40e.c +37 -0
+		return ret;
+	}
+
+	dcb_cfg = &dcb_cfg_local;
+	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
+
+	/* assume each tc has the same bw */
+	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
+	/* to ensure the sum of tcbw is equal to 100 */
+	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
+	for (i = 0; i < bw_lf; i++)
+		dcb_cfg->etscfg.tcbwtable[i]++;
+
+	/* assume each tc has the same Transmission Selection Algorithm */
+	for (i = 0; i < info->queue_region_number; i++)
+		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
+
+	for (i = 0; i < info->queue_region_number; i++) {
+		for (j = 0; j < info->region[i].user_priority_num; j++) {
+			prio_index = info->region[i].user_priority[j];
+			region_index = info->region[i].region_id;
+			dcb_cfg->etscfg.prioritytable[prio_index] =
+						region_index;
+		}
+	}
+
+	/* FW needs one App to configure HW */
+	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
+	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
+	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
+	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+
+	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
+
+	dcb_cfg->pfc.willing = 0;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
+	dcb_cfg->pfc.pfcenable = tc_map;
+
+	/* Copy the new config to the current config */
+	*old_cfg = *dcb_cfg;
+	old_cfg->etsrec = old_cfg->etscfg;
+	ret = i40e_set_dcb_config(hw);
+
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Set queue region DCB Config failed,

err %s aq_err %s",

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+			 i40e_stat_str(hw, ret),
+			 i40e_aq_str(hw, hw->aq.asq_last_status));
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on) {
+	int32_t ret = -EINVAL;
+	struct i40e_queue_region_info *info = &pf->queue_region;
+
+	if (on) {
+		i40e_queue_region_pf_flowtype_conf(hw, pf);
+
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+			return ret;
+		}
+
+		ret = i40e_queue_region_dcb_configure(hw, pf);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			return ret;
+		}
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+		return 0;
+	}
+
+	info->queue_region_number = 1;
+	info->region[0].queue_num = 64;
+	info->region[0].queue_start_index = 0;
+
+	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(INFO, "Failed to flush queue region

mapping.");

Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.c +9 -0
+
+	ret = i40e_dcb_init_configure(dev, TRUE);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+		pf->flags &= ~I40E_FLAG_DCB;
+	}
+
+	i40e_init_queue_region_conf(dev);
+

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +10 -0
+	return 0;
+}
+
+static int
+i40e_queue_region_pf_check_rss(struct i40e_pf *pf) {
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	uint64_t hena;
+
+	hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
+	hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) <<

32;

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2600

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +8 -0
+	if (hw->mac.type == I40E_MAC_X722)
+		hena &= I40E_RSS_HENA_ALL_X722;
+	else
+		hena &= I40E_RSS_HENA_ALL;
+
+	if (!hena)
+		return -ENOTSUP;
+

Why made such change? Will it be impacted by kiril's pctype patches and beilei's new pctype patches?

drivers/net/i40e/rte_pmd_i40e.c rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id, · line 2606

Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e.c +6 -0
+	return 0;
+}
+
+static void
+i40e_queue_region_get_all_info(struct i40e_pf *pf, uint16_t port_id)
+{

In this function, it looks like you print all the information about queue region? If so, You can use "display" instead of "get".
In my opinion, generally, we are getting info but not display info in API level.

[......]

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info {

Quoted 7 lines
drivers/net/i40e/rte_pmd_i40e.h +7 -0
+
+/**
+ *  Option types of queue region.
+ */
+enum rte_pmd_i40e_queue_region_op {
+	RTE_PMD_I40E_REGION_UNDEFINED,
+	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set

*/

Review

Quoted 1 line
(quoted diff) +1 -0
+	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region

pctype set */

drivers/net/i40e/rte_pmd_i40e.h enum rte_pmd_i40e_package_info { · line 101

Quoted 1 line
drivers/net/i40e/rte_pmd_i40e.h +1 -0
+	/**< add queue region user priority set */

If the comments is added before the definition, you need to use /** xxx */ instead of /**< XX */ for doxygen-likely format you can check
http://www.dpdk.org/doc/guides/contributing/documentation.html#doxyg
en-guidelines

Thanks
Jingjing

author
#52 lore raw

PATCH v5 2/3 app/testpmd: add API for configuration of queue region

In reply to Wei Zhao

This patch add a API configuration of queue region in rss. It can parse the parameters of region index, queue number, queue start index, user priority, traffic classes and so on. According to commands from command line, it will call i40e private API and start the process of set or flush queue region configure. As this feature is specific for i40e, so private API will be used.

---
 app/test-pmd/cmdline.c | 379 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 379 insertions(+)
app/test-pmd/cmdline.c +379 -0
index 4f2d731..fc2444f 100644
@@ -637,6 +637,24 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
 			"    Update a ptype mapping item on a port\n\n"
 
+			"queue-region set port (port_id) region_id (value) "
+			"queue_start_index (value) queue_num (value)\n"
+			"    Set a queue region on a port\n\n"
+
+			"queue-region set port (port_id) region_id (value) "
+			"flowtype (value)\n"
+			"    Set a flowtype region index on a port\n\n"
+
+			"queue-region set port (port_id) UP (value) region_id (value)\n"
+			"    Set the mapping of User Priority to "
+			"queue region on a port\n\n"
+
+			"queue-region flush (on|off) port (port_id)\n"
+			"    flush all queue region related configuration\n\n"
+
+			"queue-region get port (port_id)\n"
+			"	 get all queue region related configuration info\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -8228,6 +8246,362 @@ cmdline_parse_inst_t cmd_syn_filter = {
 		NULL,
 	},
 };
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t queue_start_index;
+	uint8_t  queue_id;
+	cmdline_fixed_string_t queue_num;
+	uint8_t  queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_QUEUE_REGION_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.queue_num = res->queue_num_value;
+	region_conf.queue_start_index = res->queue_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				 cmd, "queue-region");
+cmdline_parse_token_string_t cmd_queue_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+		set, "set");
+cmdline_parse_token_string_t cmd_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
+cmdline_parse_token_num_t cmd_queue_region_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_id =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_queue_region_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_start_index, "queue_start_index");
+cmdline_parse_token_num_t cmd_queue_region_queue_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_id, UINT8);
+cmdline_parse_token_string_t cmd_queue_region_queue_num =
+	TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+				queue_num, "queue_num");
+cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+				queue_num_value, UINT8);
+
+cmdline_parse_inst_t cmd_queue_region = {
+	.f = cmd_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"queue_start_index <value> queue_num <value>: Set a queue region",
+	.tokens = {
+		(void *)&cmd_queue_region_cmd,
+		(void *)&cmd_queue_region_set,
+		(void *)&cmd_queue_region_port,
+		(void *)&cmd_queue_region_port_id,
+		(void *)&cmd_queue_region_id,
+		(void *)&cmd_queue_region_index,
+		(void *)&cmd_queue_region_queue_start_index,
+		(void *)&cmd_queue_region_queue_id,
+		(void *)&cmd_queue_region_queue_num,
+		(void *)&cmd_queue_region_queue_num_value,
+		NULL,
+	},
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+	cmdline_fixed_string_t flowtype;
+	uint8_t  flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_region_flowtype_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_REGION_FLOWTYPE_SET;
+	region_conf.region_id = res->region_id;
+	region_conf.hw_flowtype = res->flowtype_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("region flowtype config programming error: (%s)\n",
+				strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_region_flowtype_set =
+TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_region_flowtype_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_region_flowtype_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				region_id, UINT8);
+cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+	TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype, "flowtype");
+cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+				flowtype_id, UINT8);
+cmdline_parse_inst_t cmd_region_flowtype = {
+	.f = cmd_region_flowtype_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> region_id <value> "
+		"flowtype <value>: Set a flowtype region index",
+	.tokens = {
+		(void *)&cmd_region_flowtype_cmd,
+		(void *)&cmd_region_flowtype_set,
+		(void *)&cmd_region_flowtype_port,
+		(void *)&cmd_region_flowtype_port_index,
+		(void *)&cmd_region_flowtype_index,
+		(void *)&cmd_region_flowtype_id,
+		(void *)&cmd_region_flowtype_flow_index,
+		(void *)&cmd_region_flowtype_flow_id,
+		NULL,
+	},
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+	cmdline_fixed_string_t user_priority;
+	uint8_t  user_priority_id;
+	cmdline_fixed_string_t region;
+	uint8_t  region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_user_priority_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+	region_conf.op = RTE_PMD_I40E_USER_PRIORITY_REGION_SET;
+	region_conf.user_priority = res->user_priority_id;
+	region_conf.region_id = res->region_id;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("user_priority region config programming "
+			"error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_user_priority_region_set =
+TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				set, "set");
+cmdline_parse_token_string_t cmd_user_priority_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				port_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_UP =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority, "UP");
+cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				user_priority_id, UINT8);
+cmdline_parse_token_string_t cmd_user_priority_region_region =
+	TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+				region, "region_id");
+cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+				region_id, UINT8);
+
+cmdline_parse_inst_t cmd_user_priority_region = {
+	.f = cmd_user_priority_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region set port <port_id> UP <value> "
+		"region_id <value>: Set the mapping of User Priority (UP) "
+		"to queue region (region_id) ",
+	.tokens = {
+		(void *)&cmd_user_priority_region_cmd,
+		(void *)&cmd_user_priority_region_set,
+		(void *)&cmd_user_priority_region_port,
+		(void *)&cmd_user_priority_region_port_index,
+		(void *)&cmd_user_priority_region_UP,
+		(void *)&cmd_user_priority_region_UP_id,
+		(void *)&cmd_user_priority_region_region,
+		(void *)&cmd_user_priority_region_region_id,
+		NULL,
+	},
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t flush;
+	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_flush_queue_region_result *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	if (strcmp(res->what, "on") == 0)
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+	else
+		region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config flush error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				flush, "flush");
+cmdline_parse_token_string_t cmd_flush_queue_region_what =
+TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				what, "on#off");
+cmdline_parse_token_string_t cmd_flush_queue_region_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+				port, "port");
+cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_flush_queue_region = {
+	.f = cmd_flush_queue_region_parsed,
+	.data = NULL,
+	.help_str = "queue-region flush on|off port <port_id> "
+		": flush all queue region related configuration",
+	.tokens = {
+		(void *)&cmd_flush_queue_region_cmd,
+		(void *)&cmd_flush_queue_region_flush,
+		(void *)&cmd_flush_queue_region_what,
+		(void *)&cmd_flush_queue_region_port,
+		(void *)&cmd_flush_queue_region_port_index,
+		NULL,
+	},
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_get_queue_region_info {
+	cmdline_fixed_string_t cmd;
+	cmdline_fixed_string_t get;
+	cmdline_fixed_string_t port;
+	uint8_t  port_id;
+};
+
+static void
+cmd_get_queue_region_info_parsed(void *parsed_result,
+			__attribute__((unused)) struct cmdline *cl,
+			__attribute__((unused)) void *data)
+{
+	struct cmd_get_queue_region_info *res = parsed_result;
+	struct rte_i40e_rss_region_conf region_conf;
+	int ret = 0;
+
+	memset(&region_conf, 0, sizeof(region_conf));
+
+	region_conf.op = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+	ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id, &region_conf);
+
+	if (ret < 0)
+		printf("queue region config info get error: (%s)\n",
+					strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_get_queue_region_info_cmd =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				cmd, "queue-region");
+cmdline_parse_token_string_t cmd_get_queue_region_info_get =
+TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				get, "get");
+cmdline_parse_token_string_t cmd_get_queue_region_info_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_get_queue_region_info,
+				port, "port");
+cmdline_parse_token_num_t cmd_get_queue_region_info_port_index =
+	TOKEN_NUM_INITIALIZER(struct cmd_get_queue_region_info,
+				port_id, UINT8);
+
+cmdline_parse_inst_t cmd_get_queue_region_info_all = {
+	.f = cmd_get_queue_region_info_parsed,
+	.data = NULL,
+	.help_str = "queue-region get port <port_id> "
+		": get all queue region related configuration info",
+	.tokens = {
+		(void *)&cmd_get_queue_region_info_cmd,
+		(void *)&cmd_get_queue_region_info_get,
+		(void *)&cmd_get_queue_region_info_port,
+		(void *)&cmd_get_queue_region_info_port_index,
+		NULL,
+	},
+};
 
 /* *** ADD/REMOVE A 2tuple FILTER *** */
 struct cmd_2tuple_filter_result {
@@ -14391,6 +14765,11 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
 	(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
+	(cmdline_parse_inst_t *)&cmd_queue_region,
+	(cmdline_parse_inst_t *)&cmd_region_flowtype,
+	(cmdline_parse_inst_t *)&cmd_user_priority_region,
+	(cmdline_parse_inst_t *)&cmd_flush_queue_region,
+	(cmdline_parse_inst_t *)&cmd_get_queue_region_info_all,
 	NULL,
 };
 
Signature · 1 line
2.7.4
#53 lore raw

Re: [PATCH v5 2/3] app/testpmd: add API for configuration of queue region

General comments:

You need to wrap i40e private API by
#ifdef RTE_LIBRTE_I40E_PMD
#endif

Otherwise it will cause compile error if I40E_PMD is not enable in config.

You can refer to other implementation like cmd_ptype_mapping_get_parsed.

Thanks
Jingjing

author
#54 lore raw

Re: [PATCH v5 2/3] app/testpmd: add API for configuration of queue region

Ok.

Quoted 21 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Friday, September 29, 2017 1:05 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v5 2/3] app/testpmd: add API for configuration of queue region

General comments:

You need to wrap i40e private API by
#ifdef RTE_LIBRTE_I40E_PMD
#endif

Otherwise it will cause compile error if I40E_PMD is not enable in config.

You can refer to other implementation like
cmd_ptype_mapping_get_parsed.

Thanks
Jingjing

author
#55 lore raw

PATCH v5 3/3 doc/testpmd_app_ug: add doc info for queue region

In reply to Wei Zhao

Queue region only support PF by now, so this document is only for configuration of queue region on PF port.

---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
doc/guides/testpmd_app_ug/testpmd_funcs.rst +40 -0
index 2ed62f5..29b981f 100644
@@ -842,6 +842,46 @@ Where:
 
    Check the NIC Datasheet for hardware limits.
 
+RSS queue region
+~~~~~~~~~~~~~~~~
+
+Set RSS queue region span on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) queue_start_index (value) queue_num (value)
+
+Set flowtype mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) region_id (value) flowtype (value)
+
+where:
+
+* For the flowtype(pctype) of packet,the specific index for each type has
+  been defined in file i40e_type.h as enum i40e_filter_pctype.
+
+Set user priority mapping on a RSS queue region on a port::
+
+   testpmd> queue-region set port (port_id) UP (value) region_id (value)
+
+Flush all queue region related configuration on a port::
+
+   testpmd> queue-region flush (on|off) port (port_id)
+
+where:
+* "on"is just an enable function which server for other configuration,
+  it is for all configuration about queue region from up layer,
+  at first will only keep in DPDK softwarestored in driver,
+  only after "flush on", it commit all configuration to HW.
+  "off" is just clean all configuration about queue region just now,
+  and restore all to DPDK i40e driver default config when start up.
+
+Get all queue region related configuration info on a port::
+
+   testpmd> queue-region get port (port_id)
+
+.. note::
+Queue region only support on PF by now, so these command is
+only for configuration of queue region on PF port.
+
 csum parse-tunnel
 ~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.7.4
author
#56 lore raw

PATCH v6 1/1 net/i40e: API to configure queue regions for RSS

In reply to Wei Zhao

The patches mainly finish following functions:
1) Command line for input queue region configure parameters.
2) Set or flush queue region configutation.

v2:
-fix bug for packet into queue region code.
-change code style for DPDK C programing.
-change that "flowtype" name to " hw_flowtype " in struct rte_i40e_rss_region_conf

v3:
-fix patch check warning
-fix a bug in cmdline.c

v4:
-fix bug for flowtype config.
-add a new command for get all queue region configuration. -change function name to "rss" related.
-add document info about queue region CLI.

v5:
-fix patchcheck warning.
-add port id check.

v6:
-split this patch set into 2 patch.

root (1):
net/i40e: queue region set and flush

 drivers/net/i40e/i40e_ethdev.c            |  27 +-
 drivers/net/i40e/i40e_ethdev.h            |  39 +++
 drivers/net/i40e/rte_pmd_i40e.c           | 520 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  60 ++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 5 files changed, 641 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4