* [dpdk-dev] [PATCH v1] net/ice: fix error check for QoS in DCF
@ 2021-07-06 16:16 Ting Xu
2021-07-08 2:32 ` [dpdk-dev] [PATCH v2] " Ting Xu
0 siblings, 1 reply; 3+ messages in thread
From: Ting Xu @ 2021-07-06 16:16 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, jingjing.wu, beilei.xing, Ting Xu, stable
This patch fixed some unreasonable error check. Move all checks into one
helper function before configuring. Skip the check for DCF (VF0).
Fixes: 3a5a5bfc618b ("net/ice: support QoS config VF bandwidth in DCF")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
---
drivers/net/ice/ice_dcf_sched.c | 65 ++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c
index 4371bbc820..d24fd5b1c1 100644
--- a/drivers/net/ice/ice_dcf_sched.c
+++ b/drivers/net/ice/ice_dcf_sched.c
@@ -631,6 +631,43 @@ ice_dcf_validate_tc_bw(struct virtchnl_dcf_bw_cfg_list *tc_bw,
return 0;
}
+
+static int ice_dcf_commit_check(struct ice_dcf_hw *hw)
+{
+ struct ice_dcf_tm_node_list *tc_list = &hw->tm_conf.tc_list;
+ struct ice_dcf_tm_node_list *vsi_list = &hw->tm_conf.vsi_list;
+ struct ice_dcf_tm_node *tm_node;
+
+ if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)) {
+ PMD_DRV_LOG(ERR, "Configure VF bandwidth is not supported");
+ return ICE_ERR_NOT_SUPPORTED;
+ }
+
+ /* check if all TC nodes are set */
+ if (BIT(hw->tm_conf.nb_tc_node) & hw->ets_config->tc_valid_bits) {
+ PMD_DRV_LOG(ERR, "Not all enabled TC nodes are set");
+ return ICE_ERR_PARAM;
+ }
+
+ /* check if all VF vsi nodes are binded to all TCs */
+ TAILQ_FOREACH(tm_node, tc_list, node) {
+ if (tm_node->reference_count != hw->num_vfs) {
+ PMD_DRV_LOG(ERR, "Not all VFs are binded to TC%u",
+ tm_node->tc);
+ return ICE_ERR_PARAM;
+ }
+ }
+
+ /* check if VF vsi node id start with 0 */
+ tm_node = TAILQ_FIRST(vsi_list);
+ if (tm_node->id != 0) {
+ PMD_DRV_LOG(ERR, "VF vsi node id must start with 0");
+ return ICE_ERR_PARAM;
+ }
+
+ return ICE_SUCCESS;
+}
+
static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
int clear_on_fail,
__rte_unused struct rte_tm_error *error)
@@ -645,20 +682,11 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
uint32_t port_bw, cir_total;
uint16_t size, vf_id;
uint8_t num_elem = 0;
- int i, ret_val = ICE_SUCCESS;
-
- if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)) {
- PMD_DRV_LOG(ERR, "Configure VF bandwidth is not supported");
- ret_val = ICE_ERR_NOT_SUPPORTED;
- goto fail_clear;
- }
+ int i, ret_val;
- /* check if all TC nodes are set */
- if (BIT(hw->tm_conf.nb_tc_node) & hw->ets_config->tc_valid_bits) {
- PMD_DRV_LOG(ERR, "Not all enabled TC nodes are set");
- ret_val = ICE_ERR_PARAM;
+ ret_val = ice_dcf_commit_check(hw);
+ if (ret_val)
goto fail_clear;
- }
size = sizeof(struct virtchnl_dcf_bw_cfg_list) +
sizeof(struct virtchnl_dcf_bw_cfg) *
@@ -690,7 +718,10 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
VIRTCHNL_DCF_BW_PIR | VIRTCHNL_DCF_BW_CIR;
}
- for (vf_id = 0; vf_id < hw->num_vfs; vf_id++) {
+ /* start with VF1, skip VF0 since DCF does not need to configure
+ * bandwidth for itself
+ */
+ for (vf_id = 1; vf_id < hw->num_vfs; vf_id++) {
num_elem = 0;
vf_bw->vf_id = vf_id;
vf_bw->node_type = VIRTCHNL_DCF_TARGET_VF_BW;
@@ -722,14 +753,6 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
num_elem++;
}
- /* check if all TC nodes are set with VF vsi nodes */
- if (num_elem != hw->tm_conf.nb_tc_node) {
- PMD_DRV_LOG(ERR, "VF%u vsi nodes are not set to all TC nodes, node id should be continuous",
- vf_id);
- ret_val = ICE_ERR_PARAM;
- goto fail_clear;
- }
-
vf_bw->num_elem = num_elem;
ret_val = ice_dcf_set_vf_bw(hw, vf_bw, size);
if (ret_val)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH v2] net/ice: fix error check for QoS in DCF
2021-07-06 16:16 [dpdk-dev] [PATCH v1] net/ice: fix error check for QoS in DCF Ting Xu
@ 2021-07-08 2:32 ` Ting Xu
2021-07-08 5:22 ` Zhang, Qi Z
0 siblings, 1 reply; 3+ messages in thread
From: Ting Xu @ 2021-07-08 2:32 UTC (permalink / raw)
To: dev; +Cc: qi.z.zhang, jingjing.wu, beilei.xing, Ting Xu, stable
This patch fixed some unreasonable error check. Move all checks into one
helper function before configuring. Skip the check for DCF (VF0).
Fixes: 3a5a5bfc618b ("net/ice: support QoS config VF bandwidth in DCF")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
---
v1->v2: rebase
---
drivers/net/ice/ice_dcf_sched.c | 65 ++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c
index aeb1afbe85..8a0529a3bc 100644
--- a/drivers/net/ice/ice_dcf_sched.c
+++ b/drivers/net/ice/ice_dcf_sched.c
@@ -631,6 +631,43 @@ ice_dcf_validate_tc_bw(struct virtchnl_dcf_bw_cfg_list *tc_bw,
return 0;
}
+
+static int ice_dcf_commit_check(struct ice_dcf_hw *hw)
+{
+ struct ice_dcf_tm_node_list *tc_list = &hw->tm_conf.tc_list;
+ struct ice_dcf_tm_node_list *vsi_list = &hw->tm_conf.vsi_list;
+ struct ice_dcf_tm_node *tm_node;
+
+ if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)) {
+ PMD_DRV_LOG(ERR, "Configure VF bandwidth is not supported");
+ return ICE_ERR_NOT_SUPPORTED;
+ }
+
+ /* check if all TC nodes are set */
+ if (BIT(hw->tm_conf.nb_tc_node) & hw->ets_config->tc_valid_bits) {
+ PMD_DRV_LOG(ERR, "Not all enabled TC nodes are set");
+ return ICE_ERR_PARAM;
+ }
+
+ /* check if all VF vsi nodes are binded to all TCs */
+ TAILQ_FOREACH(tm_node, tc_list, node) {
+ if (tm_node->reference_count != hw->num_vfs) {
+ PMD_DRV_LOG(ERR, "Not all VFs are binded to TC%u",
+ tm_node->tc);
+ return ICE_ERR_PARAM;
+ }
+ }
+
+ /* check if VF vsi node id start with 0 */
+ tm_node = TAILQ_FIRST(vsi_list);
+ if (tm_node->id != 0) {
+ PMD_DRV_LOG(ERR, "VF vsi node id must start with 0");
+ return ICE_ERR_PARAM;
+ }
+
+ return ICE_SUCCESS;
+}
+
static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
int clear_on_fail,
__rte_unused struct rte_tm_error *error)
@@ -645,20 +682,11 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
uint32_t port_bw, cir_total;
uint16_t size, vf_id;
uint8_t num_elem = 0;
- int i, ret_val = ICE_SUCCESS;
-
- if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)) {
- PMD_DRV_LOG(ERR, "Configure VF bandwidth is not supported");
- ret_val = ICE_ERR_NOT_SUPPORTED;
- goto fail_clear;
- }
+ int i, ret_val;
- /* check if all TC nodes are set */
- if (BIT(hw->tm_conf.nb_tc_node) & hw->ets_config->tc_valid_bits) {
- PMD_DRV_LOG(ERR, "Not all enabled TC nodes are set");
- ret_val = ICE_ERR_PARAM;
+ ret_val = ice_dcf_commit_check(hw);
+ if (ret_val)
goto fail_clear;
- }
size = sizeof(struct virtchnl_dcf_bw_cfg_list) +
sizeof(struct virtchnl_dcf_bw_cfg) *
@@ -690,7 +718,10 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
VIRTCHNL_DCF_BW_PIR | VIRTCHNL_DCF_BW_CIR;
}
- for (vf_id = 0; vf_id < hw->num_vfs; vf_id++) {
+ /* start with VF1, skip VF0 since DCF does not need to configure
+ * bandwidth for itself
+ */
+ for (vf_id = 1; vf_id < hw->num_vfs; vf_id++) {
num_elem = 0;
vf_bw->vf_id = vf_id;
vf_bw->node_type = VIRTCHNL_DCF_TARGET_VF_BW;
@@ -722,14 +753,6 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
num_elem++;
}
- /* check if all TC nodes are set with VF vsi nodes */
- if (num_elem != hw->tm_conf.nb_tc_node) {
- PMD_DRV_LOG(ERR, "VF%u vsi nodes are not set to all TC nodes, node id should be continuous",
- vf_id);
- ret_val = ICE_ERR_PARAM;
- goto fail_clear;
- }
-
vf_bw->num_elem = num_elem;
ret_val = ice_dcf_set_vf_bw(hw, vf_bw, size);
if (ret_val)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/ice: fix error check for QoS in DCF
2021-07-08 2:32 ` [dpdk-dev] [PATCH v2] " Ting Xu
@ 2021-07-08 5:22 ` Zhang, Qi Z
0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2021-07-08 5:22 UTC (permalink / raw)
To: Xu, Ting, dev; +Cc: Wu, Jingjing, Xing, Beilei, stable
> -----Original Message-----
> From: Xu, Ting <ting.xu@intel.com>
> Sent: Thursday, July 8, 2021 10:32 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>; Xu, Ting <ting.xu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/ice: fix error check for QoS in DCF
>
> This patch fixed some unreasonable error check. Move all checks into one
> helper function before configuring. Skip the check for DCF (VF0).
>
> Fixes: 3a5a5bfc618b ("net/ice: support QoS config VF bandwidth in DCF")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-08 5:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 16:16 [dpdk-dev] [PATCH v1] net/ice: fix error check for QoS in DCF Ting Xu
2021-07-08 2:32 ` [dpdk-dev] [PATCH v2] " Ting Xu
2021-07-08 5:22 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).