net/ice: fix DCF state checking mechanism
PATCH v2 1/1 net/ice: fix DCF state checking mechanism
From: Peng Zhang <[email protected]>
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.
--- drivers/net/ice/ice_dcf_parent.c | 3 --- drivers/net/ice/ice_switch_filter.c | 20 ++++++-------------- 2 files changed, 6 insertions(+), 17 deletions(-)
drivers/net/ice/ice_dcf_parent.c +0 -3
@@ -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); }
drivers/net/ice/ice_switch_filter.c +6 -14
@@ -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);
Signature · 1 line
2.25.1
Quoted 101 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, May 11, 2022 4:50 PM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix DCF state checking mechanismFrom: Peng Zhang <[email protected]>
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")Signed-off-by Peng Zhang <[email protected]>--- drivers/net/ice/ice_dcf_parent.c | 3 --- drivers/net/ice/ice_switch_filter.c | 20 ++++++-------------- 2 files changed, 6 insertions(+), 17 deletions(-)drivers/net/ice/ice_dcf_parent.c +0
-3@@ -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); }drivers/net/ice/ice_switch_filter.c +4
-7@@ -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);drivers/net/ice/ice_switch_filter.c +0
-7}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) {drivers/net/ice/ice_switch_filter.c +3
-0if (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); }
Quoted 3 lines
ice_switch_filter_rule_free(flow);
--
2.25.1
Quoted 10 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, May 11, 2022 11:50 PM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix DCF state checking mechanism
Quoted 6 lines
From: Peng Zhang <[email protected]>
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.
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.
Quoted 30 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 17, 2022 3:36 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanismQuoted 8 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, May 11, 2022 11:50 PM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix DCF state checking mechanismQuoted 6 lines
From: Peng Zhang <[email protected]>
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.
Quoted 20 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, May 18, 2022 2:36 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanismOk, 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.
Quoted 2 lines
In conclusion, in upper situation error code which should not be EINVAL and EAGAIN is expected.
Ok, Please send a new version
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.
Quoted 33 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, May 18, 2022 2:46 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanismQuoted 8 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, May 18, 2022 2:36 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v2] net/ice: fix DCF state checking mechanismQuoted 4 lines
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 topause.
Quoted 8 lines
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
PATCH v3 1/1 net/ice: fix DCF state checking mechanism
In reply to [email protected]From: Peng Zhang <[email protected]>
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.
---
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(-)
drivers/net/ice/ice_dcf_parent.c +0 -3
@@ -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); }
drivers/net/ice/ice_switch_filter.c +6 -14
@@ -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);
Signature · 1 line
2.25.1
Quoted 10 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Saturday, May 21, 2022 2:31 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v3] net/ice: fix DCF state checking mechanism
Quoted 7 lines
From: Peng Zhang <[email protected]>
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.
PATCH v4 1/1 net/ice: retry sending adminQ command after failure
In reply to [email protected]From: Peng Zhang <[email protected]>
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.
---
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(-)
drivers/net/ice/base/ice_common.c +1 -1
@@ -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); }/**
drivers/net/ice/base/ice_switch.c +40 -6
91 lines not on this page · raw message
drivers/net/ice/base/ice_switch.h +5 -0
@@ -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_ */
Signature · 1 line
2.25.1
RE: [PATCH v4] net/ice: retry sending adminQ command after failure
Quoted 53 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureFrom: Peng Zhang <[email protected]>
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")Signed-off-by Peng Zhang <[email protected]>---
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(-)drivers/net/ice/base/ice_common.c +0
-0
drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, u16 · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
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'.
Quoted 76 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 31, 2022 7:52 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 27 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureFrom: Peng Zhang <[email protected]>
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.Quoted 8 lines
Fixes 6bad5047be24 ("net/ice/base: return correct error code")Fixes 453d087ccaff ("net/ice/base: add common functions")Signed-off-by Peng Zhang <[email protected]>---
v4 changes:
- Add retry mechanism if fail to send adminQ command under givensituation.
Quoted 20 lines
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(-)drivers/net/ice/base/ice_common.c +0
-0drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, u16 · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
RE: [PATCH v4] net/ice: retry sending adminQ command after failure
Quoted 10 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 9:49 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
Quoted 2 lines
I see, so
ice_aq_retry_send_cmdfunction will conduct whether DCF is enabled or not with 'hw->dcf_enabled'.
Why not just enable retry in ice_dcf_send_aq_cmd?
Quoted 80 lines
Quoted 37 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 31, 2022 7:52 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 26 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureFrom: Peng Zhang <[email protected]>
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, notEAGAIN.
Quoted 42 lines
Quoted 9 lines
Fixes 6bad5047be24 ("net/ice/base: return correct error code")Fixes 453d087ccaff ("net/ice/base: add common functions")Signed-off-by Peng Zhang <[email protected]>---
v4 changes:
- Add retry mechanism if fail to send adminQ command under givensituation.
Quoted 21 lines
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(-)drivers/net/ice/base/ice_common.c +0
-0drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, u16 · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
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.
Quoted 106 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, June 1, 2022 9:54 AM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 11 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 9:49 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureI see, so
ice_aq_retry_send_cmdfunction will conduct whether DCF is enabled or not with 'hw->dcf_enabled'.Why not just enable retry in
ice_dcf_send_aq_cmd?Quoted 20 lines
Quoted 20 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 31, 2022 7:52 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 9 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: Peng Zhang <[email protected]>
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.
Quoted 55 lines
Quoted 12 lines
Quoted 12 lines
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, notEAGAIN.
Quoted 42 lines
Quoted 9 lines
Fixes 6bad5047be24 ("net/ice/base: return correct error code")Fixes 453d087ccaff ("net/ice/base: add common functions")Signed-off-by Peng Zhang <[email protected]>---
v4 changes:
- Add retry mechanism if fail to send adminQ command under givensituation.
Quoted 21 lines
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(-)drivers/net/ice/base/ice_common.c +0
-0drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, u16 · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
RE: [PATCH v4] net/ice: retry sending adminQ command after failure
Quoted 10 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 10:46 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failure
Quoted 4 lines
Because currently just focus on the following given situation, and use 'hw-
Quoted 1 line
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".
Quoted 111 lines
Quoted 111 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, June 1, 2022 9:54 AM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 11 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 9:49 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureI see, so
ice_aq_retry_send_cmdfunction will conduct whether DCF is enabled or not with 'hw->dcf_enabled'.Why not just enable retry in
ice_dcf_send_aq_cmd?Quoted 20 lines
Quoted 20 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 31, 2022 7:52 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 9 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
From: Peng Zhang <[email protected]>
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.
Quoted 57 lines
Quoted 13 lines
Quoted 13 lines
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, notEAGAIN.
Quoted 43 lines
Quoted 10 lines
Fixes 6bad5047be24 ("net/ice/base: return correct error code")Fixes 453d087ccaff ("net/ice/base: add common functions")Signed-off-by Peng Zhang <[email protected]>---
v4 changes:
- Add retry mechanism if fail to send adminQ command under
givensituation.
Quoted 21 lines
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(-)drivers/net/ice/base/ice_common.c +0
-0drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
RE: [PATCH v4] net/ice: retry sending adminQ command after failure
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.
Quoted 142 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, June 1, 2022 11:23 AM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 9 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 10:46 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 5 lines
Because currently just focus on the following given situation, and use 'hw-
Quoted 1 line
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".Quoted 112 lines
Quoted 112 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, June 1, 2022 9:54 AM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 11 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 9:49 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureI see, so
ice_aq_retry_send_cmdfunction will conduct whether DCF is enabled or not with 'hw->dcf_enabled'.Why not just enable retry in
ice_dcf_send_aq_cmd?Quoted 20 lines
Quoted 20 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, May 31, 2022 7:52 PM
To: Zhang, Peng1X <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 9 lines
-----Original Message-----
From: Zhang, Peng1X <[email protected]>
Sent: Wednesday, June 1, 2022 1:48 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Cc: Zhang, Peng1X <[email protected]>; [email protected]
Subject: [PATCH v4] net/ice: retry sending adminQ command after failureQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
From: Peng Zhang <[email protected]>
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.
Quoted 58 lines
Quoted 13 lines
Quoted 13 lines
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, notEAGAIN.
Quoted 44 lines
Quoted 11 lines
Fixes 6bad5047be24 ("net/ice/base: return correct errorcode")
Fixes 453d087ccaff ("net/ice/base: add common functions")Signed-off-by Peng Zhang <[email protected]>---
v4 changes:
- Add retry mechanism if fail to send adminQ command under
givensituation.
Quoted 21 lines
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(-)drivers/net/ice/base/ice_common.c +0
-0drivers/net/ice/base/ice_common.c ice_aq_alloc_free_res(struct ice_hw *hw, · line 2131
Quoted 6 lines
drivers/net/ice/base/ice_common.c +1
-1@@ -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
PATCH v5 1/1 net/ice: add retry mechanism for DCF after failure
In reply to [email protected]From: Peng Zhang <[email protected]>
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.
---
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(-)
drivers/net/ice/ice_dcf.c +21 -13
@@ -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:
Signature · 1 line
2.25.1