* [PATCH v2] net/ice: fix DCF state checking mechanism
@ 2022-05-11 15:49 peng1x.zhang
2022-05-13 9:56 ` Connolly, Padraig J
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: peng1x.zhang @ 2022-05-11 15:49 UTC (permalink / raw)
To: qiming.yang, qi.z.zhang, dev; +Cc: Peng Zhang, stable
From: Peng Zhang <peng1x.zhang@intel.com>
DCF state previous checking mechanism can not fully detect DCF state
whether is on or not,so PMD will report uncorrect error code in some
cases and mislead user.Fix DCF state checking mechanism which will
mention user resource temporarily unavailable when DCF state is not on.
Fixes: 285f63fc6bb7 ("net/ice: track DCF state of PF")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
---
drivers/net/ice/ice_dcf_parent.c | 3 ---
drivers/net/ice/ice_switch_filter.c | 20 ++++++--------------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index 2f96dedcce..5b02e0197f 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -121,7 +121,6 @@ ice_dcf_vsi_update_service_handler(void *param)
struct ice_dcf_hw *hw = reset_param->dcf_hw;
struct ice_dcf_adapter *adapter =
container_of(hw, struct ice_dcf_adapter, real_hw);
- struct ice_adapter *parent_adapter = &adapter->parent;
pthread_detach(pthread_self());
@@ -130,8 +129,6 @@ ice_dcf_vsi_update_service_handler(void *param)
rte_spinlock_lock(&vsi_update_lock);
if (!ice_dcf_handle_vsi_update_event(hw)) {
- __atomic_store_n(&parent_adapter->dcf_state_on, true,
- __ATOMIC_RELAXED);
ice_dcf_update_vf_vsi_map(&adapter->parent.hw,
hw->num_vfs, hw->vf_vsi_map);
}
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 36c9bffb73..3d36c63e97 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -403,13 +403,6 @@ ice_switch_create(struct ice_adapter *ad,
goto error;
}
- if (ice_dcf_adminq_need_retry(ad)) {
- rte_flow_error_set(error, EAGAIN,
- RTE_FLOW_ERROR_TYPE_ITEM, NULL,
- "DCF is not on");
- goto error;
- }
-
ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added);
if (!ret) {
filter_conf_ptr = rte_zmalloc("ice_switch_filter",
@@ -432,6 +425,9 @@ ice_switch_create(struct ice_adapter *ad,
filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED;
flow->rule = filter_conf_ptr;
+
+ if (ad->hw.dcf_enabled)
+ __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED);
} else {
if (ice_dcf_adminq_need_retry(ad))
ret = -EAGAIN;
@@ -490,13 +486,6 @@ ice_switch_destroy(struct ice_adapter *ad,
return -rte_errno;
}
- if (ice_dcf_adminq_need_retry(ad)) {
- rte_flow_error_set(error, EAGAIN,
- RTE_FLOW_ERROR_TYPE_ITEM, NULL,
- "DCF is not on");
- return -rte_errno;
- }
-
ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data);
if (ret) {
if (ice_dcf_adminq_need_retry(ad))
@@ -508,6 +497,9 @@ ice_switch_destroy(struct ice_adapter *ad,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"fail to destroy switch filter rule");
return -rte_errno;
+ } else {
+ if (ad->hw.dcf_enabled)
+ __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED);
}
ice_switch_filter_rule_free(flow);
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v2] net/ice: fix DCF state checking mechanism
2022-05-11 15:49 [PATCH v2] net/ice: fix DCF state checking mechanism peng1x.zhang
@ 2022-05-13 9:56 ` Connolly, Padraig J
2022-05-17 7:35 ` Zhang, Qi Z
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
2 siblings, 0 replies; 16+ messages in thread
From: Connolly, Padraig J @ 2022-05-13 9:56 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, Zhang, Qi Z, dev; +Cc: Zhang, Peng1X, stable
> -----Original Message-----
> From: peng1x.zhang@intel.com <peng1x.zhang@intel.com>
> Sent: Wednesday, May 11, 2022 4:50 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/ice: fix DCF state checking mechanism
>
> From: Peng Zhang <peng1x.zhang@intel.com>
>
> DCF state previous checking mechanism can not fully detect DCF state
> whether is on or not,so PMD will report uncorrect error code in some cases
> and mislead user.Fix DCF state checking mechanism which will mention user
> resource temporarily unavailable when DCF state is not on.
>
> Fixes: 285f63fc6bb7 ("net/ice: track DCF state of PF")
> Cc: stable@dpdk.org
>
> Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> ---
> drivers/net/ice/ice_dcf_parent.c | 3 ---
> drivers/net/ice/ice_switch_filter.c | 20 ++++++--------------
> 2 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ice/ice_dcf_parent.c
> b/drivers/net/ice/ice_dcf_parent.c
> index 2f96dedcce..5b02e0197f 100644
> --- a/drivers/net/ice/ice_dcf_parent.c
> +++ b/drivers/net/ice/ice_dcf_parent.c
> @@ -121,7 +121,6 @@ ice_dcf_vsi_update_service_handler(void *param)
> struct ice_dcf_hw *hw = reset_param->dcf_hw;
> struct ice_dcf_adapter *adapter =
> container_of(hw, struct ice_dcf_adapter, real_hw);
> - struct ice_adapter *parent_adapter = &adapter->parent;
>
> pthread_detach(pthread_self());
>
> @@ -130,8 +129,6 @@ ice_dcf_vsi_update_service_handler(void *param)
> rte_spinlock_lock(&vsi_update_lock);
>
> if (!ice_dcf_handle_vsi_update_event(hw)) {
> - __atomic_store_n(&parent_adapter->dcf_state_on, true,
> - __ATOMIC_RELAXED);
> ice_dcf_update_vf_vsi_map(&adapter->parent.hw,
> hw->num_vfs, hw->vf_vsi_map);
> }
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index 36c9bffb73..3d36c63e97 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -403,13 +403,6 @@ ice_switch_create(struct ice_adapter *ad,
> goto error;
> }
>
> - if (ice_dcf_adminq_need_retry(ad)) {
> - rte_flow_error_set(error, EAGAIN,
> - RTE_FLOW_ERROR_TYPE_ITEM, NULL,
> - "DCF is not on");
> - goto error;
> - }
> -
> ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added);
> if (!ret) {
> filter_conf_ptr = rte_zmalloc("ice_switch_filter", @@ -432,6
> +425,9 @@ ice_switch_create(struct ice_adapter *ad,
> filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED;
>
> flow->rule = filter_conf_ptr;
> +
> + if (ad->hw.dcf_enabled)
> + __atomic_store_n(&ad->dcf_state_on, true,
> __ATOMIC_RELAXED);
> } else {
> if (ice_dcf_adminq_need_retry(ad))
> ret = -EAGAIN;
> @@ -490,13 +486,6 @@ ice_switch_destroy(struct ice_adapter *ad,
> return -rte_errno;
> }
>
> - if (ice_dcf_adminq_need_retry(ad)) {
> - rte_flow_error_set(error, EAGAIN,
> - RTE_FLOW_ERROR_TYPE_ITEM, NULL,
> - "DCF is not on");
> - return -rte_errno;
> - }
> -
> ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr-
> >sw_query_data);
> if (ret) {
> if (ice_dcf_adminq_need_retry(ad))
> @@ -508,6 +497,9 @@ ice_switch_destroy(struct ice_adapter *ad,
> RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> "fail to destroy switch filter rule");
> return -rte_errno;
> + } else {
> + if (ad->hw.dcf_enabled)
> + __atomic_store_n(&ad->dcf_state_on, true,
> __ATOMIC_RELAXED);
> }
>
> ice_switch_filter_rule_free(flow);
> --
> 2.25.1
Tested-by: Padraig Connolly <padraig.j.connolly@intel.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v2] net/ice: fix DCF state checking mechanism
2022-05-11 15:49 [PATCH v2] net/ice: fix DCF state checking mechanism peng1x.zhang
2022-05-13 9:56 ` Connolly, Padraig J
@ 2022-05-17 7:35 ` Zhang, Qi Z
2022-05-18 6:36 ` Zhang, Peng1X
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
2 siblings, 1 reply; 16+ messages in thread
From: Zhang, Qi Z @ 2022-05-17 7:35 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Wednesday, May 11, 2022 11:50 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/ice: fix DCF state checking mechanism
>
> From: Peng Zhang <peng1x.zhang@intel.com>
>
> DCF state previous checking mechanism can not fully detect DCF state whether
> is on or not,so PMD will report uncorrect error code in some cases and mislead
> user.Fix DCF state checking mechanism which will mention user resource
> temporarily unavailable when DCF state is not on.
Please describe at which situation which error code is uncorrect and which is expected.
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v2] net/ice: fix DCF state checking mechanism
2022-05-17 7:35 ` Zhang, Qi Z
@ 2022-05-18 6:36 ` Zhang, Peng1X
2022-05-18 6:45 ` Zhang, Qi Z
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Peng1X @ 2022-05-18 6:36 UTC (permalink / raw)
To: Zhang, Qi Z, Yang, Qiming, dev; +Cc: stable
Ok, because error phenomena happens during the period VF reset again and again
following situation will possible happen as following steps describe:
step 1. DCF state has been set to on after VF has reset.
step 2. A VF reset happen, kernel send an event to DCF and set STATE to pause.
step 3. Before DCF receive the event, it is possible a rule creation is ongoing,
then in virtual channel queue, the rule request is in front of the "re-connect", then it will be rejected.
step 4.But the DCF state is not set to pause, according to previous logic error code will be EINVAL,
while not EAGAIN.
In conclusion, in upper situation error code which should not be EINVAL and EAGAIN is expected.
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Tuesday, May 17, 2022 3:36 PM
> To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanism
>
>
>
> > -----Original Message-----
> > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > Sent: Wednesday, May 11, 2022 11:50 PM
> > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; dev@dpdk.org
> > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] net/ice: fix DCF state checking mechanism
> >
> > From: Peng Zhang <peng1x.zhang@intel.com>
> >
> > DCF state previous checking mechanism can not fully detect DCF state
> > whether is on or not,so PMD will report uncorrect error code in some
> > cases and mislead user.Fix DCF state checking mechanism which will
> > mention user resource temporarily unavailable when DCF state is not on.
>
>
> Please describe at which situation which error code is uncorrect and which is
> expected.
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v2] net/ice: fix DCF state checking mechanism
2022-05-18 6:36 ` Zhang, Peng1X
@ 2022-05-18 6:45 ` Zhang, Qi Z
2022-05-19 6:05 ` Zhang, Peng1X
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Qi Z @ 2022-05-18 6:45 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Wednesday, May 18, 2022 2:36 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanism
>
> Ok, because error phenomena happens during the period VF reset again and
> again following situation will possible happen as following steps describe:
> step 1. DCF state has been set to on after VF has reset.
> step 2. A VF reset happen, kernel send an event to DCF and set STATE to pause.
> step 3. Before DCF receive the event, it is possible a rule creation is ongoing,
> then in virtual channel queue, the rule request is in front of the "re-connect",
> then it will be rejected.
> step 4.But the DCF state is not set to pause, according to previous logic error
> code will be EINVAL, while not EAGAIN.
>
> In conclusion, in upper situation error code which should not be EINVAL and
> EAGAIN is expected.
Ok, Please send a new version
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v2] net/ice: fix DCF state checking mechanism
2022-05-18 6:45 ` Zhang, Qi Z
@ 2022-05-19 6:05 ` Zhang, Peng1X
0 siblings, 0 replies; 16+ messages in thread
From: Zhang, Peng1X @ 2022-05-19 6:05 UTC (permalink / raw)
To: Zhang, Qi Z, Yang, Qiming, dev; +Cc: stable
This patch is aim to fix the mentioned situation.
After having failed to create rule, error code is EINVAL or EAGAIN depends whether DCF is enabled and DCF state is on or not.
In this patch conduct DPDK DCF state by create or destroy rule successfully or not.
Before patch is applied, the steps of error phenomena:
step 1. DPDK DCF state has been set to on after VF has reset and multiple rules are creating.
step 2. A VF reset happen immediately, kernel send an event to DPDK DCF and set STATE to pause.
step 3. Before DPDK DCF receive the event, it is possible a rule creation is ongoing,
then in virtual channel queue, the rule request is in front of the "re-connect", then it will be rejected.
step 4. But the DPDK DCF state is not set to pause, error code will be set as EINVAL, not EAGAIN.
After patch is applied, the upper error should be fixed for the upper situation.
Because in step 3,because rule request is rejected, then create rule fail.
DPDK DCF state will be still pause state, and DPDK DCF is enabled.
According to the logic of conduct error code after create rule fail, error code is EAGAIN.
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, May 18, 2022 2:46 PM
> To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanism
>
>
>
> > -----Original Message-----
> > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > Sent: Wednesday, May 18, 2022 2:36 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanism
> >
> > Ok, because error phenomena happens during the period VF reset again
> > and again following situation will possible happen as following steps describe:
> > step 1. DCF state has been set to on after VF has reset.
> > step 2. A VF reset happen, kernel send an event to DCF and set STATE to
> pause.
> > step 3. Before DCF receive the event, it is possible a rule creation
> > is ongoing, then in virtual channel queue, the rule request is in
> > front of the "re-connect", then it will be rejected.
> > step 4.But the DCF state is not set to pause, according to previous
> > logic error code will be EINVAL, while not EAGAIN.
> >
> > In conclusion, in upper situation error code which should not be
> > EINVAL and EAGAIN is expected.
>
> Ok, Please send a new version
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3] net/ice: fix DCF state checking mechanism
2022-05-11 15:49 [PATCH v2] net/ice: fix DCF state checking mechanism peng1x.zhang
2022-05-13 9:56 ` Connolly, Padraig J
2022-05-17 7:35 ` Zhang, Qi Z
@ 2022-05-20 18:31 ` peng1x.zhang
2022-05-21 2:17 ` Zhang, Qi Z
2022-05-31 17:48 ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
2 siblings, 2 replies; 16+ messages in thread
From: peng1x.zhang @ 2022-05-20 18:31 UTC (permalink / raw)
To: qiming.yang, qi.z.zhang, dev; +Cc: Peng Zhang, stable
From: Peng Zhang <peng1x.zhang@intel.com>
DCF state previously checking mechanism cannot detect DCF state
correctly in given situation,so PMD will report incorrect error
code and mislead user. In this patch, DCF state checking mechanism
is fixed through create or delete rule successfully or not. Then
error code will be set as EAGAIN in given situation, while not EINVAL.
The given situation as following steps show:
step 1. DPDK DCF state has been set to on after VF has reset and multiple
rules are creating.
step 2. A VF reset happen immediately, kernel send an event to DPDK DCF
and set STATE to pause.
step 3. Before DPDK DCF receive the event, it is possible a rule creation
is ongoing,then in virtual channel queue, the rule request is in front of
the "re-connect", then it will be rejected.
step 4. But the DPDK DCF state is not set to pause, error code will be set
as EINVAL, not EAGAIN.
Fixes: 285f63fc6bb7 ("net/ice: track DCF state of PF")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
---
v3 Changes:
- Add the situation description, expected error code and incorrect error code in commit log.
v2 Changes:
- Modify DCF state checking mechanism.
drivers/net/ice/ice_dcf_parent.c | 3 ---
drivers/net/ice/ice_switch_filter.c | 20 ++++++--------------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index 2f96dedcce..5b02e0197f 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -121,7 +121,6 @@ ice_dcf_vsi_update_service_handler(void *param)
struct ice_dcf_hw *hw = reset_param->dcf_hw;
struct ice_dcf_adapter *adapter =
container_of(hw, struct ice_dcf_adapter, real_hw);
- struct ice_adapter *parent_adapter = &adapter->parent;
pthread_detach(pthread_self());
@@ -130,8 +129,6 @@ ice_dcf_vsi_update_service_handler(void *param)
rte_spinlock_lock(&vsi_update_lock);
if (!ice_dcf_handle_vsi_update_event(hw)) {
- __atomic_store_n(&parent_adapter->dcf_state_on, true,
- __ATOMIC_RELAXED);
ice_dcf_update_vf_vsi_map(&adapter->parent.hw,
hw->num_vfs, hw->vf_vsi_map);
}
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 36c9bffb73..3d36c63e97 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -403,13 +403,6 @@ ice_switch_create(struct ice_adapter *ad,
goto error;
}
- if (ice_dcf_adminq_need_retry(ad)) {
- rte_flow_error_set(error, EAGAIN,
- RTE_FLOW_ERROR_TYPE_ITEM, NULL,
- "DCF is not on");
- goto error;
- }
-
ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added);
if (!ret) {
filter_conf_ptr = rte_zmalloc("ice_switch_filter",
@@ -432,6 +425,9 @@ ice_switch_create(struct ice_adapter *ad,
filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED;
flow->rule = filter_conf_ptr;
+
+ if (ad->hw.dcf_enabled)
+ __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED);
} else {
if (ice_dcf_adminq_need_retry(ad))
ret = -EAGAIN;
@@ -490,13 +486,6 @@ ice_switch_destroy(struct ice_adapter *ad,
return -rte_errno;
}
- if (ice_dcf_adminq_need_retry(ad)) {
- rte_flow_error_set(error, EAGAIN,
- RTE_FLOW_ERROR_TYPE_ITEM, NULL,
- "DCF is not on");
- return -rte_errno;
- }
-
ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data);
if (ret) {
if (ice_dcf_adminq_need_retry(ad))
@@ -508,6 +497,9 @@ ice_switch_destroy(struct ice_adapter *ad,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"fail to destroy switch filter rule");
return -rte_errno;
+ } else {
+ if (ad->hw.dcf_enabled)
+ __atomic_store_n(&ad->dcf_state_on, true, __ATOMIC_RELAXED);
}
ice_switch_filter_rule_free(flow);
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v3] net/ice: fix DCF state checking mechanism
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
@ 2022-05-21 2:17 ` Zhang, Qi Z
2022-05-31 17:48 ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
1 sibling, 0 replies; 16+ messages in thread
From: Zhang, Qi Z @ 2022-05-21 2:17 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Saturday, May 21, 2022 2:31 AM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] net/ice: fix DCF state checking mechanism
>
> From: Peng Zhang <peng1x.zhang@intel.com>
>
> DCF state previously checking mechanism cannot detect DCF state correctly in
> given situation,so PMD will report incorrect error code and mislead user. In this
> patch, DCF state checking mechanism is fixed through create or delete rule
> successfully or not. Then error code will be set as EAGAIN in given situation,
> while not EINVAL.
We should not assume the error code is always EAGAIN if any rule is rejected by the kernel PF driver, this will also mislead the application.
We need the kernel driver to return a clear error code, then DCF pass them to the application.
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-05-31 17:48 ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
@ 2022-05-31 11:51 ` Zhang, Qi Z
2022-06-01 1:48 ` Zhang, Peng1X
2022-06-08 10:21 ` [PATCH v5] net/ice: add retry mechanism for DCF " peng1x.zhang
1 sibling, 1 reply; 16+ messages in thread
From: Zhang, Qi Z @ 2022-05-31 11:51 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Wednesday, June 1, 2022 1:48 AM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v4] net/ice: retry sending adminQ command after failure
>
> From: Peng Zhang <peng1x.zhang@intel.com>
>
> The origin design is if error happen during the step 3 of following given situation,
> it will return error directly without retry. While in current patch, it will retry
> again and again during certain time. If retry succeed, rule can be continuously
> created. It will improve success rate of creating rule under following given
> situation.
>
> The given situation as following steps show:
> step 1. Kernel PF and DCF are ready at the beginning.
> step 2. A VF reset happen, kernel send an event to DPDK DCF and set STATE to
> pause.
> step 3. Before DPDK DCF receive the event, it is possible a rule creation is
> ongoing and switch rules, recipe, or vsi list related adminQ operation is
> executing.
> step 4. Then result of operation is failure, it will lead to error return to DPDK
> DCF. DPDK DCF error code will be set as EINVAL, not EAGAIN.
>
> Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
> Fixes: 453d087ccaff ("net/ice/base: add common functions")
> Cc: stable@dpdk.org
>
> Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> ---
> v4 changes:
> - Add retry mechanism if fail to send adminQ command under given situation.
> v3 Changes:
> - Add the situation description, expected error code and incorrect error code
> - in commit log.
> v2 Changes:
> - Modify DCF state checking mechanism.
>
> drivers/net/ice/base/ice_common.c | 2 +- drivers/net/ice/base/ice_switch.c |
> 46 +++++++++++++++++++++++++++---- drivers/net/ice/base/ice_switch.h | 5
> ++++
> 3 files changed, 46 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ice/base/ice_common.c
> b/drivers/net/ice/base/ice_common.c
> index db87bacd97..013c255371 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16
> num_entries,
>
> cmd->num_entries = CPU_TO_LE16(num_entries);
>
> - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
this is the fix only for DCF, we don't need to retry in a PF driver context.
Better keep the same function name, but implements the retry mechanism inside the function, and should only be triggered when it is in a DCF context
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v4] net/ice: retry sending adminQ command after failure
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
2022-05-21 2:17 ` Zhang, Qi Z
@ 2022-05-31 17:48 ` peng1x.zhang
2022-05-31 11:51 ` Zhang, Qi Z
2022-06-08 10:21 ` [PATCH v5] net/ice: add retry mechanism for DCF " peng1x.zhang
1 sibling, 2 replies; 16+ messages in thread
From: peng1x.zhang @ 2022-05-31 17:48 UTC (permalink / raw)
To: qiming.yang, qi.z.zhang, dev; +Cc: Peng Zhang, stable
From: Peng Zhang <peng1x.zhang@intel.com>
The origin design is if error happen during the step 3 of following given
situation, it will return error directly without retry. While in current
patch, it will retry again and again during certain time. If retry succeed,
rule can be continuously created. It will improve success rate of creating
rule under following given situation.
The given situation as following steps show:
step 1. Kernel PF and DCF are ready at the beginning.
step 2. A VF reset happen, kernel send an event to DPDK DCF and set STATE
to pause.
step 3. Before DPDK DCF receive the event, it is possible a rule creation
is ongoing and switch rules, recipe, or vsi list related adminQ operation
is executing.
step 4. Then result of operation is failure, it will lead to error return
to DPDK DCF. DPDK DCF error code will be set as EINVAL, not EAGAIN.
Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
---
v4 changes:
- Add retry mechanism if fail to send adminQ command under given situation.
v3 Changes:
- Add the situation description, expected error code and incorrect error code
- in commit log.
v2 Changes:
- Modify DCF state checking mechanism.
drivers/net/ice/base/ice_common.c | 2 +-
drivers/net/ice/base/ice_switch.c | 46 +++++++++++++++++++++++++++----
drivers/net/ice/base/ice_switch.h | 5 ++++
3 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index db87bacd97..013c255371 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
cmd->num_entries = CPU_TO_LE16(num_entries);
- return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
+ return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
}
/**
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index d4cc664ad7..8db71f6edb 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -18,6 +18,9 @@
#define ICE_ETH_P_8021Q 0x8100
#define ICE_MPLS_ETHER_ID 0x8847
+#define ICE_DCF_ADMINQ_MAX_RETRIES 20
+#define ICE_DCF_ADMINQ_CHECK_TIME 2 /* msecs */
+
/* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
* struct to configure any switch filter rules.
* {DA (6 bytes), SA(6 bytes),
@@ -3296,7 +3299,7 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
desc.params.sw_rules.num_rules_fltr_entry_index =
CPU_TO_LE16(num_rules);
- status = ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
+ status = ice_aq_retry_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
if (opc != ice_aqc_opc_add_sw_rules &&
hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT)
status = ICE_ERR_DOES_NOT_EXIST;
@@ -3331,7 +3334,7 @@ ice_aq_add_recipe(struct ice_hw *hw,
buf_size = num_recipes * sizeof(*s_recipe_list);
- return ice_aq_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);
+ return ice_aq_retry_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);
}
/**
@@ -3373,7 +3376,7 @@ ice_aq_get_recipe(struct ice_hw *hw,
buf_size = *num_recipes * sizeof(*s_recipe_list);
- status = ice_aq_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);
+ status = ice_aq_retry_send_cmd(hw, &desc, s_recipe_list, buf_size, cd);
*num_recipes = LE16_TO_CPU(cmd->num_sub_recipes);
return status;
@@ -3462,7 +3465,7 @@ ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap,
ice_memcpy(cmd->recipe_assoc, r_bitmap, sizeof(cmd->recipe_assoc),
ICE_NONDMA_TO_NONDMA);
- return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+ return ice_aq_retry_send_cmd(hw, &desc, NULL, 0, cd);
}
/**
@@ -3486,7 +3489,7 @@ ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap,
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_recipe_to_profile);
cmd->profile_id = CPU_TO_LE16(profile_id);
- status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+ status = ice_aq_retry_send_cmd(hw, &desc, NULL, 0, cd);
if (!status)
ice_memcpy(r_bitmap, cmd->recipe_assoc,
sizeof(cmd->recipe_assoc), ICE_NONDMA_TO_NONDMA);
@@ -4119,7 +4122,6 @@ ice_update_vsi_list_rule(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi,
s_rule->pdata.vsi_list.index = CPU_TO_LE16(vsi_list_id);
status = ice_aq_sw_rules(hw, s_rule, s_rule_size, 1, opc, NULL);
-
exit:
ice_free(hw, s_rule);
return status;
@@ -9582,3 +9584,35 @@ void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
{
ice_rm_sw_replay_rule_info(hw, hw->switch_info);
}
+
+/**
+ * ice_aq_retry_send_cmd - helper function to retry sending FW Admin Queue commands
+ * @hw: pointer to the HW struct
+ * @desc: descriptor describing the command
+ * @buf: buffer to use for indirect commands (NULL for direct commands)
+ * @buf_size: size of buffer for indirect commands (0 for direct commands)
+ * @cd: pointer to command details structure
+ *
+ * Retry sending FW Admin Queue commands to the FW Admin Queue if fail to send and
+ * DCF function is enabled.
+ */
+enum ice_status
+ice_aq_retry_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
+ void *buf, u16 buf_size, struct ice_sq_cd *cd)
+{
+ enum ice_status status;
+ int i = 0;
+
+ for (;;) {
+ status = ice_aq_send_cmd(hw, desc, buf, buf_size, cd);
+ if (status == 0 || !hw->dcf_enabled)
+ break;
+
+ if (++i >= ICE_DCF_ADMINQ_MAX_RETRIES)
+ break;
+
+ rte_delay_ms(ICE_DCF_ADMINQ_CHECK_TIME);
+ }
+
+ return status;
+}
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index a2b3c80107..1a3fd5472f 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -552,4 +552,9 @@ enum ice_status
ice_update_recipe_lkup_idx(struct ice_hw *hw,
struct ice_update_recipe_lkup_idx_params *params);
void ice_change_proto_id_to_dvm(void);
+
+/* Retry sending adminQ command */
+enum ice_status
+ice_aq_retry_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
+ void *buf, u16 buf_size, struct ice_sq_cd *cd);
#endif /* _ICE_SWITCH_H_ */
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-05-31 11:51 ` Zhang, Qi Z
@ 2022-06-01 1:48 ` Zhang, Peng1X
2022-06-01 1:53 ` Zhang, Qi Z
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Peng1X @ 2022-06-01 1:48 UTC (permalink / raw)
To: Zhang, Qi Z, Yang, Qiming, dev; +Cc: stable
I see, so ice_aq_retry_send_cmd function will conduct whether DCF is enabled or not with
'hw->dcf_enabled'.
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Tuesday, May 31, 2022 7:52 PM
> To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
>
>
>
> > -----Original Message-----
> > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > Sent: Wednesday, June 1, 2022 1:48 AM
> > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; dev@dpdk.org
> > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > Subject: [PATCH v4] net/ice: retry sending adminQ command after
> > failure
> >
> > From: Peng Zhang <peng1x.zhang@intel.com>
> >
> > The origin design is if error happen during the step 3 of following
> > given situation, it will return error directly without retry. While in
> > current patch, it will retry again and again during certain time. If
> > retry succeed, rule can be continuously created. It will improve
> > success rate of creating rule under following given situation.
> >
> > The given situation as following steps show:
> > step 1. Kernel PF and DCF are ready at the beginning.
> > step 2. A VF reset happen, kernel send an event to DPDK DCF and set
> > STATE to pause.
> > step 3. Before DPDK DCF receive the event, it is possible a rule
> > creation is ongoing and switch rules, recipe, or vsi list related
> > adminQ operation is executing.
> > step 4. Then result of operation is failure, it will lead to error
> > return to DPDK DCF. DPDK DCF error code will be set as EINVAL, not EAGAIN.
> >
> > Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
> > Fixes: 453d087ccaff ("net/ice/base: add common functions")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> > ---
> > v4 changes:
> > - Add retry mechanism if fail to send adminQ command under given
> situation.
> > v3 Changes:
> > - Add the situation description, expected error code and incorrect
> > error code
> > - in commit log.
> > v2 Changes:
> > - Modify DCF state checking mechanism.
> >
> > drivers/net/ice/base/ice_common.c | 2 +-
> > drivers/net/ice/base/ice_switch.c |
> > 46 +++++++++++++++++++++++++++---- drivers/net/ice/base/ice_switch.h
> > | 5
> > ++++
> > 3 files changed, 46 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ice/base/ice_common.c
> > b/drivers/net/ice/base/ice_common.c
> > index db87bacd97..013c255371 100644
> > --- a/drivers/net/ice/base/ice_common.c
> > +++ b/drivers/net/ice/base/ice_common.c
> > @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16
> > num_entries,
> >
> > cmd->num_entries = CPU_TO_LE16(num_entries);
> >
> > - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> > + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
>
> this is the fix only for DCF, we don't need to retry in a PF driver context.
> Better keep the same function name, but implements the retry mechanism
> inside the function, and should only be triggered when it is in a DCF context
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-06-01 1:48 ` Zhang, Peng1X
@ 2022-06-01 1:53 ` Zhang, Qi Z
2022-06-01 2:46 ` Zhang, Peng1X
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Qi Z @ 2022-06-01 1:53 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Wednesday, June 1, 2022 9:49 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
>
> I see, so ice_aq_retry_send_cmd function will conduct whether DCF is
> enabled or not with 'hw->dcf_enabled'.
Why not just enable retry in ice_dcf_send_aq_cmd?
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Tuesday, May 31, 2022 7:52 PM
> > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > failure
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > Sent: Wednesday, June 1, 2022 1:48 AM
> > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > <qi.z.zhang@intel.com>; dev@dpdk.org
> > > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > > Subject: [PATCH v4] net/ice: retry sending adminQ command after
> > > failure
> > >
> > > From: Peng Zhang <peng1x.zhang@intel.com>
> > >
> > > The origin design is if error happen during the step 3 of following
> > > given situation, it will return error directly without retry. While
> > > in current patch, it will retry again and again during certain time.
> > > If retry succeed, rule can be continuously created. It will improve
> > > success rate of creating rule under following given situation.
> > >
> > > The given situation as following steps show:
> > > step 1. Kernel PF and DCF are ready at the beginning.
> > > step 2. A VF reset happen, kernel send an event to DPDK DCF and set
> > > STATE to pause.
> > > step 3. Before DPDK DCF receive the event, it is possible a rule
> > > creation is ongoing and switch rules, recipe, or vsi list related
> > > adminQ operation is executing.
> > > step 4. Then result of operation is failure, it will lead to error
> > > return to DPDK DCF. DPDK DCF error code will be set as EINVAL, not
> EAGAIN.
> > >
> > > Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
> > > Fixes: 453d087ccaff ("net/ice/base: add common functions")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> > > ---
> > > v4 changes:
> > > - Add retry mechanism if fail to send adminQ command under given
> > situation.
> > > v3 Changes:
> > > - Add the situation description, expected error code and incorrect
> > > error code
> > > - in commit log.
> > > v2 Changes:
> > > - Modify DCF state checking mechanism.
> > >
> > > drivers/net/ice/base/ice_common.c | 2 +-
> > > drivers/net/ice/base/ice_switch.c |
> > > 46 +++++++++++++++++++++++++++----
> > > drivers/net/ice/base/ice_switch.h
> > > | 5
> > > ++++
> > > 3 files changed, 46 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/net/ice/base/ice_common.c
> > > b/drivers/net/ice/base/ice_common.c
> > > index db87bacd97..013c255371 100644
> > > --- a/drivers/net/ice/base/ice_common.c
> > > +++ b/drivers/net/ice/base/ice_common.c
> > > @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16
> > > num_entries,
> > >
> > > cmd->num_entries = CPU_TO_LE16(num_entries);
> > >
> > > - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> > > + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
> >
> > this is the fix only for DCF, we don't need to retry in a PF driver context.
> > Better keep the same function name, but implements the retry mechanism
> > inside the function, and should only be triggered when it is in a DCF
> > context
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-06-01 1:53 ` Zhang, Qi Z
@ 2022-06-01 2:46 ` Zhang, Peng1X
2022-06-01 3:22 ` Zhang, Qi Z
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Peng1X @ 2022-06-01 2:46 UTC (permalink / raw)
To: Zhang, Qi Z, Yang, Qiming, dev; +Cc: stable
Because currently just focus on the following given situation, and use 'hw->dcf_enabled' it should only affect on DCF.
After having checked code 'ice_dcf_send_aq_cmd', it already have retry mechanism.
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, June 1, 2022 9:54 AM
> To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
>
>
>
> > -----Original Message-----
> > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > Sent: Wednesday, June 1, 2022 9:49 AM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > failure
> >
> > I see, so ice_aq_retry_send_cmd function will conduct whether DCF
> > is enabled or not with 'hw->dcf_enabled'.
>
> Why not just enable retry in ice_dcf_send_aq_cmd?
>
>
> > > -----Original Message-----
> > > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > > Sent: Tuesday, May 31, 2022 7:52 PM
> > > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > > <qiming.yang@intel.com>; dev@dpdk.org
> > > Cc: stable@dpdk.org
> > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > > failure
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > > Sent: Wednesday, June 1, 2022 1:48 AM
> > > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > > <qi.z.zhang@intel.com>; dev@dpdk.org
> > > > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > > > Subject: [PATCH v4] net/ice: retry sending adminQ command after
> > > > failure
> > > >
> > > > From: Peng Zhang <peng1x.zhang@intel.com>
> > > >
> > > > The origin design is if error happen during the step 3 of
> > > > following given situation, it will return error directly without
> > > > retry. While in current patch, it will retry again and again during certain
> time.
> > > > If retry succeed, rule can be continuously created. It will
> > > > improve success rate of creating rule under following given situation.
> > > >
> > > > The given situation as following steps show:
> > > > step 1. Kernel PF and DCF are ready at the beginning.
> > > > step 2. A VF reset happen, kernel send an event to DPDK DCF and
> > > > set STATE to pause.
> > > > step 3. Before DPDK DCF receive the event, it is possible a rule
> > > > creation is ongoing and switch rules, recipe, or vsi list related
> > > > adminQ operation is executing.
> > > > step 4. Then result of operation is failure, it will lead to error
> > > > return to DPDK DCF. DPDK DCF error code will be set as EINVAL, not
> > EAGAIN.
> > > >
> > > > Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
> > > > Fixes: 453d087ccaff ("net/ice/base: add common functions")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> > > > ---
> > > > v4 changes:
> > > > - Add retry mechanism if fail to send adminQ command under given
> > > situation.
> > > > v3 Changes:
> > > > - Add the situation description, expected error code and
> > > > incorrect error code
> > > > - in commit log.
> > > > v2 Changes:
> > > > - Modify DCF state checking mechanism.
> > > >
> > > > drivers/net/ice/base/ice_common.c | 2 +-
> > > > drivers/net/ice/base/ice_switch.c |
> > > > 46 +++++++++++++++++++++++++++----
> > > > drivers/net/ice/base/ice_switch.h
> > > > | 5
> > > > ++++
> > > > 3 files changed, 46 insertions(+), 7 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ice/base/ice_common.c
> > > > b/drivers/net/ice/base/ice_common.c
> > > > index db87bacd97..013c255371 100644
> > > > --- a/drivers/net/ice/base/ice_common.c
> > > > +++ b/drivers/net/ice/base/ice_common.c
> > > > @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16
> > > > num_entries,
> > > >
> > > > cmd->num_entries = CPU_TO_LE16(num_entries);
> > > >
> > > > - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> > > > + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
> > >
> > > this is the fix only for DCF, we don't need to retry in a PF driver context.
> > > Better keep the same function name, but implements the retry
> > > mechanism inside the function, and should only be triggered when it
> > > is in a DCF context
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-06-01 2:46 ` Zhang, Peng1X
@ 2022-06-01 3:22 ` Zhang, Qi Z
2022-06-01 5:35 ` Zhang, Peng1X
0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Qi Z @ 2022-06-01 3:22 UTC (permalink / raw)
To: Zhang, Peng1X, Yang, Qiming, dev; +Cc: stable
> -----Original Message-----
> From: Zhang, Peng1X <peng1x.zhang@intel.com>
> Sent: Wednesday, June 1, 2022 10:46 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
>
> Because currently just focus on the following given situation, and use 'hw-
> >dcf_enabled' it should only affect on DCF.
> After having checked code 'ice_dcf_send_aq_cmd', it already have retry
> mechanism.
If it is already retried, then why we need this patch?
Btw, we are talking about "retry virtual channel command from DCF to kernel PF" here, not the case "retry polling reply status of the a request".
>
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Wednesday, June 1, 2022 9:54 AM
> > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > failure
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > Sent: Wednesday, June 1, 2022 9:49 AM
> > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > > <qiming.yang@intel.com>; dev@dpdk.org
> > > Cc: stable@dpdk.org
> > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > > failure
> > >
> > > I see, so ice_aq_retry_send_cmd function will conduct whether DCF
> > > is enabled or not with 'hw->dcf_enabled'.
> >
> > Why not just enable retry in ice_dcf_send_aq_cmd?
> >
> >
> > > > -----Original Message-----
> > > > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > > > Sent: Tuesday, May 31, 2022 7:52 PM
> > > > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > > > <qiming.yang@intel.com>; dev@dpdk.org
> > > > Cc: stable@dpdk.org
> > > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command
> > > > after failure
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > > > Sent: Wednesday, June 1, 2022 1:48 AM
> > > > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > > > <qi.z.zhang@intel.com>; dev@dpdk.org
> > > > > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > > > > Subject: [PATCH v4] net/ice: retry sending adminQ command after
> > > > > failure
> > > > >
> > > > > From: Peng Zhang <peng1x.zhang@intel.com>
> > > > >
> > > > > The origin design is if error happen during the step 3 of
> > > > > following given situation, it will return error directly without
> > > > > retry. While in current patch, it will retry again and again
> > > > > during certain
> > time.
> > > > > If retry succeed, rule can be continuously created. It will
> > > > > improve success rate of creating rule under following given situation.
> > > > >
> > > > > The given situation as following steps show:
> > > > > step 1. Kernel PF and DCF are ready at the beginning.
> > > > > step 2. A VF reset happen, kernel send an event to DPDK DCF and
> > > > > set STATE to pause.
> > > > > step 3. Before DPDK DCF receive the event, it is possible a rule
> > > > > creation is ongoing and switch rules, recipe, or vsi list
> > > > > related adminQ operation is executing.
> > > > > step 4. Then result of operation is failure, it will lead to
> > > > > error return to DPDK DCF. DPDK DCF error code will be set as
> > > > > EINVAL, not
> > > EAGAIN.
> > > > >
> > > > > Fixes: 6bad5047be24 ("net/ice/base: return correct error code")
> > > > > Fixes: 453d087ccaff ("net/ice/base: add common functions")
> > > > > Cc: stable@dpdk.org
> > > > >
> > > > > Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> > > > > ---
> > > > > v4 changes:
> > > > > - Add retry mechanism if fail to send adminQ command under
> > > > > given
> > > > situation.
> > > > > v3 Changes:
> > > > > - Add the situation description, expected error code and
> > > > > incorrect error code
> > > > > - in commit log.
> > > > > v2 Changes:
> > > > > - Modify DCF state checking mechanism.
> > > > >
> > > > > drivers/net/ice/base/ice_common.c | 2 +-
> > > > > drivers/net/ice/base/ice_switch.c |
> > > > > 46 +++++++++++++++++++++++++++----
> > > > > drivers/net/ice/base/ice_switch.h
> > > > > | 5
> > > > > ++++
> > > > > 3 files changed, 46 insertions(+), 7 deletions(-)
> > > > >
> > > > > diff --git a/drivers/net/ice/base/ice_common.c
> > > > > b/drivers/net/ice/base/ice_common.c
> > > > > index db87bacd97..013c255371 100644
> > > > > --- a/drivers/net/ice/base/ice_common.c
> > > > > +++ b/drivers/net/ice/base/ice_common.c
> > > > > @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw,
> > > > > u16 num_entries,
> > > > >
> > > > > cmd->num_entries = CPU_TO_LE16(num_entries);
> > > > >
> > > > > - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> > > > > + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
> > > >
> > > > this is the fix only for DCF, we don't need to retry in a PF driver context.
> > > > Better keep the same function name, but implements the retry
> > > > mechanism inside the function, and should only be triggered when
> > > > it is in a DCF context
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH v4] net/ice: retry sending adminQ command after failure
2022-06-01 3:22 ` Zhang, Qi Z
@ 2022-06-01 5:35 ` Zhang, Peng1X
0 siblings, 0 replies; 16+ messages in thread
From: Zhang, Peng1X @ 2022-06-01 5:35 UTC (permalink / raw)
To: Zhang, Qi Z, Yang, Qiming, dev; +Cc: stable
Because under the following given situation, it still have some issue. To this given situation, it is sure that retry mechanism is necessary.
While is it confirm that under other situation retry mechanism is always better than without retry?
If modify 'ice_dcf_send_aq_cmd', it will affect the handling to AdminQ under DCF. It looks like it will affect much more than following given situation.
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, June 1, 2022 11:23 AM
> To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
>
>
>
> > -----Original Message-----
> > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > Sent: Wednesday, June 1, 2022 10:46 AM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>; dev@dpdk.org
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > failure
> >
> > Because currently just focus on the following given situation, and use
> > 'hw-
> > >dcf_enabled' it should only affect on DCF.
> > After having checked code 'ice_dcf_send_aq_cmd', it already have retry
> > mechanism.
>
>
> If it is already retried, then why we need this patch?
> Btw, we are talking about "retry virtual channel command from DCF to kernel
> PF" here, not the case "retry polling reply status of the a request".
>
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > > Sent: Wednesday, June 1, 2022 9:54 AM
> > > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > > <qiming.yang@intel.com>; dev@dpdk.org
> > > Cc: stable@dpdk.org
> > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after
> > > failure
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > > Sent: Wednesday, June 1, 2022 9:49 AM
> > > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > > > <qiming.yang@intel.com>; dev@dpdk.org
> > > > Cc: stable@dpdk.org
> > > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command
> > > > after failure
> > > >
> > > > I see, so ice_aq_retry_send_cmd function will conduct whether
> > > > DCF is enabled or not with 'hw->dcf_enabled'.
> > >
> > > Why not just enable retry in ice_dcf_send_aq_cmd?
> > >
> > >
> > > > > -----Original Message-----
> > > > > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > > > > Sent: Tuesday, May 31, 2022 7:52 PM
> > > > > To: Zhang, Peng1X <peng1x.zhang@intel.com>; Yang, Qiming
> > > > > <qiming.yang@intel.com>; dev@dpdk.org
> > > > > Cc: stable@dpdk.org
> > > > > Subject: RE: [PATCH v4] net/ice: retry sending adminQ command
> > > > > after failure
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Zhang, Peng1X <peng1x.zhang@intel.com>
> > > > > > Sent: Wednesday, June 1, 2022 1:48 AM
> > > > > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > > > > > <qi.z.zhang@intel.com>; dev@dpdk.org
> > > > > > Cc: Zhang, Peng1X <peng1x.zhang@intel.com>; stable@dpdk.org
> > > > > > Subject: [PATCH v4] net/ice: retry sending adminQ command
> > > > > > after failure
> > > > > >
> > > > > > From: Peng Zhang <peng1x.zhang@intel.com>
> > > > > >
> > > > > > The origin design is if error happen during the step 3 of
> > > > > > following given situation, it will return error directly
> > > > > > without retry. While in current patch, it will retry again and
> > > > > > again during certain
> > > time.
> > > > > > If retry succeed, rule can be continuously created. It will
> > > > > > improve success rate of creating rule under following given situation.
> > > > > >
> > > > > > The given situation as following steps show:
> > > > > > step 1. Kernel PF and DCF are ready at the beginning.
> > > > > > step 2. A VF reset happen, kernel send an event to DPDK DCF
> > > > > > and set STATE to pause.
> > > > > > step 3. Before DPDK DCF receive the event, it is possible a
> > > > > > rule creation is ongoing and switch rules, recipe, or vsi list
> > > > > > related adminQ operation is executing.
> > > > > > step 4. Then result of operation is failure, it will lead to
> > > > > > error return to DPDK DCF. DPDK DCF error code will be set as
> > > > > > EINVAL, not
> > > > EAGAIN.
> > > > > >
> > > > > > Fixes: 6bad5047be24 ("net/ice/base: return correct error
> > > > > > code")
> > > > > > Fixes: 453d087ccaff ("net/ice/base: add common functions")
> > > > > > Cc: stable@dpdk.org
> > > > > >
> > > > > > Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
> > > > > > ---
> > > > > > v4 changes:
> > > > > > - Add retry mechanism if fail to send adminQ command under
> > > > > > given
> > > > > situation.
> > > > > > v3 Changes:
> > > > > > - Add the situation description, expected error code and
> > > > > > incorrect error code
> > > > > > - in commit log.
> > > > > > v2 Changes:
> > > > > > - Modify DCF state checking mechanism.
> > > > > >
> > > > > > drivers/net/ice/base/ice_common.c | 2 +-
> > > > > > drivers/net/ice/base/ice_switch.c |
> > > > > > 46 +++++++++++++++++++++++++++----
> > > > > > drivers/net/ice/base/ice_switch.h
> > > > > > | 5
> > > > > > ++++
> > > > > > 3 files changed, 46 insertions(+), 7 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/net/ice/base/ice_common.c
> > > > > > b/drivers/net/ice/base/ice_common.c
> > > > > > index db87bacd97..013c255371 100644
> > > > > > --- a/drivers/net/ice/base/ice_common.c
> > > > > > +++ b/drivers/net/ice/base/ice_common.c
> > > > > > @@ -2127,7 +2127,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw,
> > > > > > u16 num_entries,
> > > > > >
> > > > > > cmd->num_entries = CPU_TO_LE16(num_entries);
> > > > > >
> > > > > > - return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
> > > > > > + return ice_aq_retry_send_cmd(hw, &desc, buf, buf_size, cd);
> > > > >
> > > > > this is the fix only for DCF, we don't need to retry in a PF driver context.
> > > > > Better keep the same function name, but implements the retry
> > > > > mechanism inside the function, and should only be triggered
> > > > > when it is in a DCF context
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5] net/ice: add retry mechanism for DCF after failure
2022-05-31 17:48 ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
2022-05-31 11:51 ` Zhang, Qi Z
@ 2022-06-08 10:21 ` peng1x.zhang
1 sibling, 0 replies; 16+ messages in thread
From: peng1x.zhang @ 2022-06-08 10:21 UTC (permalink / raw)
To: qiming.yang, qi.z.zhang, dev; +Cc: Peng Zhang, stable
From: Peng Zhang <peng1x.zhang@intel.com>
The origin design is if error happen during the step 3 of given situation,
it will return error directly without retry. While in current patch, it
will retry at every interval time during certain time. If retry succeed,
rule can be continuously created.
The given situation as following steps show:
step 1. Kernel PF and DPDK DCF are ready at the beginning.
step 2. A VF reset happen, kernel send an event to DCF and set STATE
to pause.
step 3. Before DCF receive the event, it is possible a rule creation is
ongoing and virtual channel command from DCF to kernel PF is executing.
step 4. Then result of command is failure, it will lead to error return
to DCF. Error code will be set as EINVAL, not EAGAIN.
Fixes: daa714d55c72 ("net/ice: handle AdminQ command by DCF")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng1x.zhang@intel.com>
---
v5 changes:
- Add retry mechanism for DCF if the result of sending virtual channel
command is failure.
v4 changes:
- Add retry mechanism if the result of sending adminQ queue command is
failure.
v3 Changes:
- Add the situation description, expected error code and incorrect error
code in commit log.
v2 Changes:
- Modify DCF state checking mechanism.
drivers/net/ice/ice_dcf.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 55ae68c456..008e7fbf27 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -474,7 +474,7 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
struct dcf_virtchnl_cmd desc_cmd, buff_cmd;
struct ice_dcf_hw *hw = dcf_hw;
int err = 0;
- int i = 0;
+ int i, j = 0;
if ((buf && !buf_size) || (!buf && buf_size) ||
buf_size > ICE_DCF_AQ_BUF_SZ)
@@ -501,25 +501,33 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
ice_dcf_vc_cmd_set(hw, &desc_cmd);
ice_dcf_vc_cmd_set(hw, &buff_cmd);
- if (ice_dcf_vc_cmd_send(hw, &desc_cmd) ||
- ice_dcf_vc_cmd_send(hw, &buff_cmd)) {
- err = -1;
- PMD_DRV_LOG(ERR, "fail to send OP_DCF_CMD_DESC/BUFF");
- goto ret;
- }
-
do {
- if (!desc_cmd.pending && !buff_cmd.pending)
+ if (ice_dcf_vc_cmd_send(hw, &desc_cmd) ||
+ ice_dcf_vc_cmd_send(hw, &buff_cmd)) {
+ err = -1;
+ PMD_DRV_LOG(ERR, "fail to send OP_DCF_CMD_DESC/BUFF");
+ goto ret;
+ }
+
+ i = 0;
+ do {
+ if (!desc_cmd.pending && !buff_cmd.pending)
+ break;
+
+ rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
+ } while (i++ < ICE_DCF_ARQ_MAX_RETRIES);
+
+ if (desc_cmd.v_ret == IAVF_SUCCESS && buff_cmd.v_ret == IAVF_SUCCESS)
break;
rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
- } while (i++ < ICE_DCF_ARQ_MAX_RETRIES);
-
+ } while (j++ < ICE_DCF_ARQ_MAX_RETRIES);
+
if (desc_cmd.v_ret != IAVF_SUCCESS || buff_cmd.v_ret != IAVF_SUCCESS) {
err = -1;
PMD_DRV_LOG(ERR,
- "No response (%d times) or return failure (desc: %d / buff: %d)",
- i, desc_cmd.v_ret, buff_cmd.v_ret);
+ "No response (%d times) or return failure (desc: %d / buff: %d)"
+ " after retry %d times cmd", i, desc_cmd.v_ret, buff_cmd.v_ret, j);
}
ret:
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-06-08 2:28 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 15:49 [PATCH v2] net/ice: fix DCF state checking mechanism peng1x.zhang
2022-05-13 9:56 ` Connolly, Padraig J
2022-05-17 7:35 ` Zhang, Qi Z
2022-05-18 6:36 ` Zhang, Peng1X
2022-05-18 6:45 ` Zhang, Qi Z
2022-05-19 6:05 ` Zhang, Peng1X
2022-05-20 18:31 ` [PATCH v3] " peng1x.zhang
2022-05-21 2:17 ` Zhang, Qi Z
2022-05-31 17:48 ` [PATCH v4] net/ice: retry sending adminQ command after failure peng1x.zhang
2022-05-31 11:51 ` Zhang, Qi Z
2022-06-01 1:48 ` Zhang, Peng1X
2022-06-01 1:53 ` Zhang, Qi Z
2022-06-01 2:46 ` Zhang, Peng1X
2022-06-01 3:22 ` Zhang, Qi Z
2022-06-01 5:35 ` Zhang, Peng1X
2022-06-08 10:21 ` [PATCH v5] net/ice: add retry mechanism for DCF " peng1x.zhang
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).