From patchwork Wed Jul 6 14:17:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Peng1X" X-Patchwork-Id: 113715 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93A77A0540; Wed, 6 Jul 2022 08:25:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FA3E40DF7; Wed, 6 Jul 2022 08:25:53 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 1A61640691 for ; Wed, 6 Jul 2022 08:25:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657088751; x=1688624751; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=sxVNmo0JdGCBcSjZsVuWc/wXB5hw79gi36OvYC+HIps=; b=D+udDXjiGY6PjQ2WnRmqFsVKIGIo3RACwaViGRJ+mPTZpe0q5OSCHn/G PsT9GgW42HWMdqZUD7s5zh2bU4QQcFjwWyHNiCVzw+e29SRx+jTEWqDFZ 2LWRpLZm3BIBak/85/Ofec5k+MMP2gTldljKb/FB9JDWaEU+fMyKTp/MG PgYCm25Yr10hg6HVaTbXP6MoJPyV9k+8Ld4KBvxeMNVzCYXgvZA3j94WK tsjEkNC3QHoQzhkSEOqzxVqAYVlAXsiGJGMSi/uhj3TDxbOkjgDmKtdLc broO0tOgTL07zvj9AVQwp5aS3rxkPm/X/KAh6R/p0HCo00fQhrJw55lmR w==; X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="309205064" X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="309205064" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 23:25:41 -0700 X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="567937311" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2022 23:25:40 -0700 From: peng1x.zhang@intel.com To: qiming.yang@intel.com, qi.z.zhang@intel.com, dev@dpdk.org Subject: [PATCH v6] net/ice: add retry mechanism for DCF after failure Date: Wed, 6 Jul 2022 22:17:09 +0800 Message-Id: <20220706141709.7681-1-peng1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Peng Zhang 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 receive designed error code 'VIRTCHNL_STATUS_ERR_RETRY' from kernel. 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 code 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 --- v6 changes: - Add retry mechanism for DCF if receive designed error code from kernel. 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/common/iavf/virtchnl.h | 1 + drivers/net/ice/ice_dcf.c | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index f123daec8e..e15e3a4439 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -49,6 +49,7 @@ enum virtchnl_status_code { VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39, VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40, VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53, + VIRTCHNL_STATUS_ERR_RETRY = -63, VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64, }; diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 885d58c0f4..d38c2afe8f 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_ERR_NOT_READY && buff_cmd.v_ret != IAVF_ERR_NOT_READY) 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: