From patchwork Mon Jan 16 18:02:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 19460 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 CCE7C108F; Tue, 17 Jan 2017 02:06:10 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7593D106A for ; Tue, 17 Jan 2017 02:06:07 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 16 Jan 2017 17:06:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,241,1477983600"; d="scan'208";a="214103479" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.129.189]) by fmsmga004.fm.intel.com with ESMTP; 16 Jan 2017 17:06:05 -0800 From: Qi Zhang To: wenzhuo.lu@intel.com, helin.zhang@intel.com Cc: dev@dpdk.org, Qi Zhang Date: Mon, 16 Jan 2017 13:02:12 -0500 Message-Id: <1484589732-13537-1-git-send-email-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v2] net/ixgbe: fix interrupt block issue 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" When handle link status change interrupt, interrupt will be blocked until delayed handler finish, the duration is at least 1 second, this may cause following VF to PF mailbox traffic be blocked and sometimes PF can't ack to VF in time before VF think it's time out. This patch remove this limitation, interrupt will be enabled before interrupt handler finish, and a flag is used to prevent re-entering delayed handler. Fixes: 0a45657a6794 ("pci: rework interrupt handling") Signed-off-by: Qi Zhang --- v2: - rebase to dpdk-next-net drivers/net/ixgbe/ixgbe_ethdev.c | 19 +++++++++---------- drivers/net/ixgbe/ixgbe_ethdev.h | 2 ++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c66f432..f36ce89 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3762,7 +3762,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev, IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); int64_t timeout; struct rte_eth_link link; - int intr_enable_delay = false; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3778,7 +3777,7 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev, intr->flags &= ~IXGBE_FLAG_PHY_INTERRUPT; } - if (intr->flags & IXGBE_FLAG_NEED_LINK_UPDATE) { + if (intr->flags & IXGBE_FLAG_NEED_LINK_UPDATE && !intr->delay) { /* get the link status before link update, for predicting later */ memset(&link, 0, sizeof(link)); rte_ixgbe_dev_atomic_read_link_status(dev, &link); @@ -3795,20 +3794,16 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev, timeout = IXGBE_LINK_DOWN_CHECK_TIMEOUT; ixgbe_dev_link_status_print(dev); + intr->delay = true; - intr_enable_delay = true; - } - - if (intr_enable_delay) { if (rte_eal_alarm_set(timeout * 1000, ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0) PMD_DRV_LOG(ERR, "Error setting alarm"); - } else { - PMD_DRV_LOG(DEBUG, "enable intr immediately"); - ixgbe_enable_intr(dev); - rte_intr_enable(intr_handle); } + PMD_DRV_LOG(DEBUG, "enable intr immediately"); + ixgbe_enable_intr(dev); + rte_intr_enable(intr_handle); return 0; } @@ -3839,6 +3834,8 @@ ixgbe_dev_interrupt_delayed_handler(void *param) IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t eicr; + ixgbe_disable_intr(hw); + eicr = IXGBE_READ_REG(hw, IXGBE_EICR); if (eicr & IXGBE_EICR_MAILBOX) ixgbe_pf_mbx_process(dev); @@ -3861,6 +3858,8 @@ ixgbe_dev_interrupt_delayed_handler(void *param) intr->flags &= ~IXGBE_FLAG_MACSEC; } + intr->delay = false; + PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr); ixgbe_enable_intr(dev); rte_intr_enable(intr_handle); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 6695b68..b931108 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -200,6 +200,8 @@ struct ixgbe_hw_fdir_info { struct ixgbe_interrupt { uint32_t flags; uint32_t mask; + /* to prevent re-enter delayed handler */ + uint8_t delay; }; struct ixgbe_stat_mapping_registers {