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 6B347A0351 for ; Mon, 21 Feb 2022 16:43:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67E7341147; Mon, 21 Feb 2022 16:43:15 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id AFD4640E5A for ; Mon, 21 Feb 2022 16:43:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645458192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMb5yqrIVe+AJyDUxqRZn4w7cEWbwxtz9jRlSX2ztiE=; b=QAtdPlyLgJvrGkbdprCknq1/e7POe+4DkKP+5mpUwQsCnARZGeZ8ex9OvPVwx4J+GGNh+c yAjNgdaR51El4JLXYLybvxK9vzF62jtqsW/S6cTjbpw/0UVwCmh2eL4jSWHNI5JkGqPCuc 2U7p0hKpQTXfCTYKZoaoBWYS7lrRukk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-361-6liQufuCNbutZ1FTgaG5vA-1; Mon, 21 Feb 2022 10:43:09 -0500 X-MC-Unique: 6liQufuCNbutZ1FTgaG5vA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04D7D100C663; Mon, 21 Feb 2022 15:43:08 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C4C57E131; Mon, 21 Feb 2022 15:43:06 +0000 (UTC) From: Kevin Traynor To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/ngbe: fix missed link interrupt' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:36:09 +0000 Message-Id: <20220221153625.152324-180-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/3698c17f425d80d0c3694f0f4996cb57e459c485 Thanks. Kevin --- >From 3698c17f425d80d0c3694f0f4996cb57e459c485 Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Wed, 9 Feb 2022 18:42:03 +0800 Subject: [PATCH] net/ngbe: fix missed link interrupt [ upstream commit 0360c23f648116b3101795e551b60fbba881247a ] When the port is started and stopped continuously and quickly, one interrupt cannot be handled in time, which will cause subsequent interrupts to be lost, so that link status will cannot be updated. Fixes: b9246b8fa280 ("net/ngbe: support link update") Signed-off-by: Jiawen Wu --- drivers/net/ngbe/ngbe_ethdev.c | 119 +++++++++++---------------------- drivers/net/ngbe/ngbe_ethdev.h | 1 + 2 files changed, 41 insertions(+), 79 deletions(-) diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index 180489ce38..8e31234442 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -90,5 +90,4 @@ static int ngbe_dev_misc_interrupt_setup(struct rte_eth_dev *dev); static int ngbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev); static void ngbe_dev_interrupt_handler(void *param); -static void ngbe_dev_interrupt_delayed_handler(void *param); static void ngbe_configure_msix(struct rte_eth_dev *dev); @@ -944,4 +943,7 @@ ngbe_dev_start(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); + /* Stop the link setup handler before resetting the HW. */ + rte_eal_alarm_cancel(ngbe_dev_setup_link_alarm_handler, dev); + /* disable uio/vfio intr/eventfd mapping */ rte_intr_disable(intr_handle); @@ -1133,4 +1135,6 @@ ngbe_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); + rte_eal_alarm_cancel(ngbe_dev_setup_link_alarm_handler, dev); + if ((hw->sub_system_id & NGBE_OEM_MASK) == NGBE_LY_M88E1512_SFP || (hw->sub_system_id & NGBE_OEM_MASK) == NGBE_LY_YT8521S_SFP) { @@ -1802,4 +1806,22 @@ ngbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) } +void +ngbe_dev_setup_link_alarm_handler(void *param) +{ + struct rte_eth_dev *dev = (struct rte_eth_dev *)param; + struct ngbe_hw *hw = ngbe_dev_hw(dev); + struct ngbe_interrupt *intr = ngbe_dev_intr(dev); + u32 speed; + bool autoneg = false; + + speed = hw->phy.autoneg_advertised; + if (!speed) + hw->mac.get_link_capabilities(hw, &speed, &autoneg); + + hw->mac.setup_link(hw, speed, true); + + intr->flags &= ~NGBE_FLAG_NEED_LINK_CONFIG; +} + /* return 0 means link status changed, -1 means not changed */ int @@ -1839,6 +1861,14 @@ ngbe_dev_link_update_share(struct rte_eth_dev *dev, } - if (!link_up) + if (!link_up) { + if (hw->phy.media_type == ngbe_media_type_fiber && + hw->phy.type != ngbe_phy_mvl_sfi) { + intr->flags |= NGBE_FLAG_NEED_LINK_CONFIG; + rte_eal_alarm_set(10, + ngbe_dev_setup_link_alarm_handler, dev); + } + return rte_eth_linkstatus_set(dev, &link); + } intr->flags &= ~NGBE_FLAG_NEED_LINK_CONFIG; @@ -2063,7 +2093,4 @@ ngbe_dev_interrupt_get_status(struct rte_eth_dev *dev) struct ngbe_interrupt *intr = ngbe_dev_intr(dev); - /* clear all cause mask */ - ngbe_disable_intr(hw); - /* read-on-clear nic registers here */ eicr = ((u32 *)hw->isb_mem)[NGBE_ISB_MISC]; @@ -2085,4 +2112,6 @@ ngbe_dev_interrupt_get_status(struct rte_eth_dev *dev) intr->flags |= NGBE_FLAG_NEED_LINK_UPDATE; + ((u32 *)hw->isb_mem)[NGBE_ISB_MISC] = 0; + return 0; } @@ -2137,5 +2166,4 @@ ngbe_dev_interrupt_action(struct rte_eth_dev *dev) { struct ngbe_interrupt *intr = ngbe_dev_intr(dev); - int64_t timeout; PMD_DRV_LOG(DEBUG, "intr action type %d", intr->flags); @@ -2152,83 +2180,16 @@ ngbe_dev_interrupt_action(struct rte_eth_dev *dev) rte_eth_linkstatus_get(dev, &link); - ngbe_dev_link_update(dev, 0); - - /* likely to up */ - if (link.link_status != RTE_ETH_LINK_UP) - /* handle it 1 sec later, wait it being stable */ - timeout = NGBE_LINK_UP_CHECK_TIMEOUT; - /* likely to down */ - else - /* handle it 4 sec later, wait it being stable */ - timeout = NGBE_LINK_DOWN_CHECK_TIMEOUT; - - ngbe_dev_link_status_print(dev); - if (rte_eal_alarm_set(timeout * 1000, - ngbe_dev_interrupt_delayed_handler, - (void *)dev) < 0) { - PMD_DRV_LOG(ERR, "Error setting alarm"); - } else { - /* remember original mask */ - intr->mask_misc_orig = intr->mask_misc; - /* only disable lsc interrupt */ - intr->mask_misc &= ~NGBE_ICRMISC_PHY; - - intr->mask_orig = intr->mask; - /* only disable all misc interrupts */ - intr->mask &= ~(1ULL << NGBE_MISC_VEC_ID); - } - } - - PMD_DRV_LOG(DEBUG, "enable intr immediately"); - ngbe_enable_intr(dev); - - return 0; -} - -/** - * Interrupt handler which shall be registered for alarm callback for delayed - * handling specific interrupt to wait for the stable nic state. As the - * NIC interrupt state is not stable for ngbe after link is just down, - * it needs to wait 4 seconds to get the stable status. - * - * @param param - * The address of parameter (struct rte_eth_dev *) registered before. - */ -static void -ngbe_dev_interrupt_delayed_handler(void *param) -{ - struct rte_eth_dev *dev = (struct rte_eth_dev *)param; - struct ngbe_interrupt *intr = ngbe_dev_intr(dev); - struct ngbe_hw *hw = ngbe_dev_hw(dev); - uint32_t eicr; - - ngbe_disable_intr(hw); - - eicr = ((u32 *)hw->isb_mem)[NGBE_ISB_MISC]; - if (eicr & NGBE_ICRMISC_VFMBX) - ngbe_pf_mbx_process(dev); - - if (intr->flags & NGBE_FLAG_NEED_LINK_UPDATE) { ngbe_dev_link_update(dev, 0); intr->flags &= ~NGBE_FLAG_NEED_LINK_UPDATE; ngbe_dev_link_status_print(dev); - rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, - NULL); + if (dev->data->dev_link.link_speed != link.link_speed) + rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_INTR_LSC, NULL); } - if (intr->flags & NGBE_FLAG_MACSEC) { - rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_MACSEC, - NULL); - intr->flags &= ~NGBE_FLAG_MACSEC; - } - - /* restore original mask */ - intr->mask_misc = intr->mask_misc_orig; - intr->mask_misc_orig = 0; - intr->mask = intr->mask_orig; - intr->mask_orig = 0; - - PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr); + PMD_DRV_LOG(DEBUG, "enable intr immediately"); ngbe_enable_intr(dev); + + return 0; } diff --git a/drivers/net/ngbe/ngbe_ethdev.h b/drivers/net/ngbe/ngbe_ethdev.h index bb96f6a5e7..8d500fd38c 100644 --- a/drivers/net/ngbe/ngbe_ethdev.h +++ b/drivers/net/ngbe/ngbe_ethdev.h @@ -342,4 +342,5 @@ void ngbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, void ngbe_config_vlan_strip_on_all_queues(struct rte_eth_dev *dev, int mask); +void ngbe_dev_setup_link_alarm_handler(void *param); void ngbe_read_stats_registers(struct ngbe_hw *hw, struct ngbe_hw_stats *hw_stats); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:48.440338631 +0000 +++ 0180-net-ngbe-fix-missed-link-interrupt.patch 2022-02-21 15:22:44.355704721 +0000 @@ -1 +1 @@ -From 0360c23f648116b3101795e551b60fbba881247a Mon Sep 17 00:00:00 2001 +From 3698c17f425d80d0c3694f0f4996cb57e459c485 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0360c23f648116b3101795e551b60fbba881247a ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org