From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C438BA0548; Wed, 8 Jun 2022 04:28:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E3934021F; Wed, 8 Jun 2022 04:28:53 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id D96294021D; Wed, 8 Jun 2022 04:28:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654655332; x=1686191332; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ornz4uW14ubz6haFX8XKv6Zm5G7hSvMR0KZyE36Nl0c=; b=LMakx6Di6RNbtXQYCDbs2tJugYOqb2r9Fr+diWRtq4Uk9UAbFMVfFwiH 3qrWIhBpEcG73wCfBcarNLhVQscB2owFaLUx8HL/mrcT1Yn59USQvxWoF pUBE0FrYKeutnBoyYBbkSDCBh2AEn/Uf8oSnyy40goqHIh6P9kJbnfLy3 zXlbovLnwKa8ZL0Vb5S27/4X7MFW/NibDBa1/7AftKdiDcZL5H7bZE478 BLVBvdoo+LV1Xot/u7WZy83Pf9RdvjrE5jtk2MLWkM8k2iGQrxFhNaKSL p0go/0lILP9eemM6SyeoGKKdvumj7ntl1owYytmg+f30OQoujy0d8BHc5 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="363118428" X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="363118428" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 19:28:50 -0700 X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="648355690" Received: from unknown (HELO localhost.localdomain) ([10.239.251.253]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 19:28:48 -0700 From: peng1x.zhang@intel.com To: qiming.yang@intel.com, qi.z.zhang@intel.com, dev@dpdk.org Cc: Peng Zhang , stable@dpdk.org Subject: [PATCH v5] net/ice: add retry mechanism for DCF after failure Date: Wed, 8 Jun 2022 10:21:25 +0000 Message-Id: <20220608102125.794566-1-peng1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531174827.357629-1-peng1x.zhang@intel.com> References: <20220531174827.357629-1-peng1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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