From patchwork Fri Jul 28 11:39:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xiaoyun" X-Patchwork-Id: 27245 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6A0C79141; Fri, 28 Jul 2017 05:50:30 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3F2789135; Fri, 28 Jul 2017 05:50:28 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2017 20:50:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.40,423,1496127600"; d="scan'208"; a="1156250193" Received: from dpdk-lixiaoyun.sh.intel.com ([10.67.111.94]) by orsmga001.jf.intel.com with ESMTP; 27 Jul 2017 20:50:26 -0700 From: Xiaoyun Li To: jingjing.wu@intel.com Cc: dev@dpdk.org, Xiaoyun Li , stable@dpdk.org Date: Fri, 28 Jul 2017 19:39:39 +0800 Message-Id: <1501241979-15767-1-git-send-email-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500921763-115209-1-git-send-email-xiaoyun.li@intel.com> References: <1500921763-115209-1-git-send-email-xiaoyun.li@intel.com> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix PF notify issue when VF not up X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch modifies PF notify error to warning when not starting up VF and modifies VF state to active when VF reset is completed. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Xiaoyun Li --- v2 changes: * add VF state modification when VF reset is done. --- drivers/net/i40e/i40e_pf.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index b4cf57f..5d5d24a 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -152,22 +152,23 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) val |= I40E_VPGEN_VFRTRIG_VFSWR_MASK; I40E_WRITE_REG(hw, I40E_VPGEN_VFRTRIG(vf_id), val); I40E_WRITE_FLUSH(hw); - } #define VFRESET_MAX_WAIT_CNT 100 - /* Wait until VF reset is done */ - for (i = 0; i < VFRESET_MAX_WAIT_CNT; i++) { - rte_delay_us(10); - val = I40E_READ_REG(hw, I40E_VPGEN_VFRSTAT(vf_id)); - if (val & I40E_VPGEN_VFRSTAT_VFRD_MASK) - break; - } + /* Wait until VF reset is done */ + for (i = 0; i < VFRESET_MAX_WAIT_CNT; i++) { + rte_delay_us(10); + val = I40E_READ_REG(hw, I40E_VPGEN_VFRSTAT(vf_id)); + if (val & I40E_VPGEN_VFRSTAT_VFRD_MASK) { + vf->state = I40E_VF_ACTIVE; + break; + } + } - if (i >= VFRESET_MAX_WAIT_CNT) { - PMD_DRV_LOG(ERR, "VF reset timeout"); - return -ETIMEDOUT; + if (i >= VFRESET_MAX_WAIT_CNT) { + PMD_DRV_LOG(ERR, "VF reset timeout"); + return -ETIMEDOUT; + } } - /* This is not first time to do reset, do cleanup job first */ if (vf->vsi) { /* Disable queues */ @@ -267,8 +268,12 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf, ret = i40e_aq_send_msg_to_vf(hw, abs_vf_id, opcode, retval, msg, msglen, NULL); if (ret) { - PMD_INIT_LOG(ERR, "Fail to send message to VF, err %u", - hw->aq.asq_last_status); + if (vf->state == I40E_VF_INACTIVE) + PMD_DRV_LOG(WARNING, "Warning! VF %u is inactive now!", + abs_vf_id); + else + PMD_INIT_LOG(ERR, "Fail to send message to VF, err %u", + hw->aq.asq_last_status); } return ret;