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 95F0C43EA2 for ; Thu, 18 Apr 2024 15:53:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CFB240647; Thu, 18 Apr 2024 15:53:17 +0200 (CEST) Received: from mail-ej1-f100.google.com (mail-ej1-f100.google.com [209.85.218.100]) by mails.dpdk.org (Postfix) with ESMTP id A1384402DC for ; Thu, 18 Apr 2024 15:53:16 +0200 (CEST) Received: by mail-ej1-f100.google.com with SMTP id a640c23a62f3a-a5565291ee7so94872666b.2 for ; Thu, 18 Apr 2024 06:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1713448396; x=1714053196; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=99EkEXoADGp35ztea/DScD8wHxV+lZrBFpUscb/WQbE=; b=Q648RXfPn23v6RQ4JPz43A6up4zTVzcIaGdsOc4EBLt6bS/LqD+Vn2wojJQ22qT6Tp eZ+hye0VtxXMbFjgMAns4ESbXEgf5fvg9Y854I3kCYHbF5gqz8eVdbcVYWc/rIMG93+D 84Pfd3T+8XB4aqw1IP1bHvYsD0QV5UA3clGIJgsBFZItaOh4UDlXmLyCj/RHnrBCspzB OgA91oY0RDC5k0FbGgiXGBkFIksdZ8OxMHhxyLeT54TXdUVrsoTVA5+yicVeV435bIsz ahARayPrblCjVWnqnC9RrtNGxMPVTjIMHEvml6ERYe/EjWVohWg5IrKj4nlAShHFKZ0d m3sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713448396; x=1714053196; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=99EkEXoADGp35ztea/DScD8wHxV+lZrBFpUscb/WQbE=; b=nBdgZDgTH/IMN+SVBC/4FYKDMCg/A8iYiO/Neh1aC32X2FXw/RbNefmGRWkJ0grapS WC2OUwTuUwT1WKWHgl3PdvOvgZtTZbTrDKWJp972eoznzRONr36e9qyAaEbeLXsyvgci jB7zszfu98M0ZgTtc4HHZvDapemS3khdrzvgRY+aHiRXkPghOJu5zhI/kW8gwHZvIDra oEjgAPiPLnimqWWcMAQN4VtO7hgwPp7sdFu2tknl6dRfFgqLmc7no7/jxPOZQCCQxbhZ WJ87LUwwaCm+S0FugujYirywMJWtr/L92pu3pf6dwFfEZjqXvutN78TdGfgIz0nypQnm NaZA== X-Forwarded-Encrypted: i=1; AJvYcCVan1dFco4Tk30oT/xhuKFskw2b7N5wKICIGwKFDVZPygEO/ud+dauJB30PZTeo8QxEiJ4oxmJ3lVUBJ+YPXFU= X-Gm-Message-State: AOJu0Yx+FXHVOY5IuB3CJ10QUylK9kACZWi956AOJd3xysMnRAMnvClU bTljXR8sXfQZOwplHgzKoARht5XR6b5spXLoKKkr6u7A5dx9iDFZW39O4gBp/unbPKrkGehrYS4 vTyLyLsceQihRb8IKhqMeMihY7lf2ok8I X-Google-Smtp-Source: AGHT+IHzP2AAeh1qtn8SbiQ9OqQSEq91rmqLbeoOcb7k9rkJBelv06QQf88ALB0g8zf0Ytg0lVsAv7RmosVg X-Received: by 2002:a17:906:4686:b0:a52:33b1:80a with SMTP id a6-20020a170906468600b00a5233b1080amr1787736ejr.10.1713448396193; Thu, 18 Apr 2024 06:53:16 -0700 (PDT) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id cs21-20020a170906dc9500b00a51c764c93esm31713ejc.83.2024.04.18.06.53.15; Thu, 18 Apr 2024 06:53:16 -0700 (PDT) X-Relaying-Domain: 6wind.com Received: from localhost (dio.dev.6wind.com [10.17.1.86]) by smtpservice.6wind.com (Postfix) with ESMTP id BDE366011D; Thu, 18 Apr 2024 15:53:15 +0200 (CEST) From: edwin.brossette@6wind.com To: dev@dpdk.org Cc: olivier.matz@6wind.com, Edwin Brossette , stable@dpdk.org Subject: [PATCH] net/ixgbe: don't create a delayed interrupt handler if one already exists Date: Thu, 18 Apr 2024 15:53:07 +0200 Message-Id: <20240418135307.3270094-1-edwin.brossette@6wind.com> X-Mailer: git-send-email 2.35.0.4.g44a5d4affccf In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Edwin Brossette Since link state may need some time to stabilize after a link state change, we cannot update the link state right after one occurs. So link state change interrupts (lsc) are handled after a delay. To do this, an alarm to call a delayed handler is programmed. This delayed handler is tasked with updating the link after a variable delay of one to four seconds which should be enough time for the link state to become stable again. However, a problem can occur with some models of network cards. For example, ixgbe_mac_X550EM_x may trigger this interrupt twice because another interrupt signal is received on the General Purpose Interrupt pin SPD0, which has the same interrupt handler. In such a case, the delayed interrupt handler would be programmed to be executed twice. Since we save the original interrupt mask value to restore it after the delayed handler is done with its work, we end up overwritting its value after the second alarm is programmed. Even worse: when restoring it the first time, the saved original mask variable is reset to 0, so we end up completely disabling all interrupts when trying to restore this mask after the second time the delayed handler is executed. Add a check on the interrupt mask value when programming the alarm for the delayed handler. If the bit for lsc interrupts is unset, it means an alarm was already programmed for the delayed handler. In this case, skip the alarm creation. Fixes: 9b667210700e ("net/ixgbe: fix blocked interrupts") Cc: stable@dpdk.org Signed-off-by: Edwin Brossette --- drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c61c52b2966b..52cafcbc965f 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4667,14 +4667,20 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev) timeout = IXGBE_LINK_DOWN_CHECK_TIMEOUT; ixgbe_dev_link_status_print(dev); - if (rte_eal_alarm_set(timeout * 1000, - ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0) - PMD_DRV_LOG(ERR, "Error setting alarm"); - else { - /* remember original mask */ - intr->mask_original = intr->mask; - /* only disable lsc interrupt */ - intr->mask &= ~IXGBE_EIMS_LSC; + + /* Don't program delayed handler if LSC interrupt is disabled. + * It means one is already programmed. + */ + if (intr->mask & IXGBE_EIMS_LSC){ + if (rte_eal_alarm_set(timeout * 1000, + ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0) + PMD_DRV_LOG(ERR, "Error setting alarm"); + else { + /* remember original mask */ + intr->mask_original = intr->mask; + /* only disable lsc interrupt */ + intr->mask &= ~IXGBE_EIMS_LSC; + } } } -- 2.35.0.4.g44a5d4affccf