When the command sent by VF to PF fails, iavf may need to run
different code paths according to the specific reason of the
failure (not supported or other reasons).

This patch adds support of identifying PF return error type.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")
Cc: sta...@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zh...@intel.com>
---
 drivers/net/iavf/iavf_vchnl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 45096cb..6586fc3 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -228,13 +228,19 @@
                        rte_delay_ms(ASQ_DELAY_MS);
                        /* If don't read msg or read sys event, continue */
                } while (i++ < MAX_TRY_TIMES);
-               /* If there's no response is received, clear command */
-               if (i >= MAX_TRY_TIMES  ||
-                   vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
-                       err = -1;
-                       PMD_DRV_LOG(ERR, "No response or return failure (%d)"
-                                   " for cmd %d", vf->cmd_retval, args->ops);
+
+               if (i >= MAX_TRY_TIMES) {
+                       PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
                        _clear_cmd(vf);
+                       err = -EIO;
+               } else if (vf->cmd_retval ==
+                          (uint32_t)VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
+                       PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
+                       err = -ENOTSUP;
+               } else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+                       PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
+                                   vf->cmd_retval, args->ops);
+                       err = -EINVAL;
                }
                break;
        }
-- 
1.8.3.1

Reply via email to