From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E481DA0093 for ; Tue, 19 May 2020 15:06:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC9FA1D646; Tue, 19 May 2020 15:06:51 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id ED1441D655 for ; Tue, 19 May 2020 15:06:50 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id n18so3470500wmj.5 for ; Tue, 19 May 2020 06:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MxW1ILGjUtyZuTzImDDYTSfC8/9R9pHPmKCzyPXi2co=; b=uqUDqY6oDEW2yqOvTDvX87S9W7aU0tJOyzlE9bOiMMOedLiS168tscxPPIBgXRhavz liduhPS1T+iwqEoNQl0W0K3n2mK0pf9cMUtgdOeeR6VhUnMfVS9fnxwYwkinwUYrJoLI pWgDkYB57F4EOieQlA3R1Ybg9H57f+45vAZVCCjNAtzD/M+FsR2dnsTyemeY2sB1ExoC cMs1Vf0cAQDDkI3NM+/39Ior1rBweYOcZG2CC0+iZaCjneApDeXSmGM76BiRTaJIGtiL UKFSn56NqYXJi4+V2rJdZE1rTi6joj1TM0dAaqXAKGCc7qQnH8fHWgS8qiIrbKPBVN2c 4/FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MxW1ILGjUtyZuTzImDDYTSfC8/9R9pHPmKCzyPXi2co=; b=XOSmGVUd4l9Vkb9YkzGlikXmRuh0+vU2zEpS+jgLJNU4pbf7XlzTqK3kK4gSj4jLxB xxJqLeKtSXg8mnRRtXgJupxb8eBCfYR43OqjjdJPxubK1HLiU2kfE5MSDYKvvWizs5Oj 2WglNhpkWAwv2Lzy/D5MDQA4kc/MuIxHapc2pHJNLc3r3stzxGe4xNjfF0NUWGhA+dFC lLVDJDVdoDBvCn4tREeivBB0aQDMPxHIAy6dSZhMyQjjDe9htDy2jYJZ5N38KpMr1q9U A2oT3NrhLphFDE9/fc+dJTKgitFs83v9lG/lVbTIyWzdvrGrAIGYbD2/WoUhk5F3iqBh 3Amw== X-Gm-Message-State: AOAM5308k417jafKdf50CZY1OIqpbtIpt+HvKZ93b3CBBeckQM2vEy5a 0lLD1KEHjcj9OamPvgDheACzaz3oX6CRJAWQ X-Google-Smtp-Source: ABdhPJz3pY/SsNZEMH8iY2GmhlSJzvoBjvtLrqYKJFNxAqjjDLkbc1zcJLPowO2eQXbrn3tKXTs2HQ== X-Received: by 2002:a1c:a557:: with SMTP id o84mr5622594wme.165.1589893610683; Tue, 19 May 2020 06:06:50 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id f123sm3860315wmf.44.2020.05.19.06.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:06:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Tao Zhu Cc: Xiaolong Ye , Yu Jiang , dpdk stable Date: Tue, 19 May 2020 14:02:34 +0100 Message-Id: <20200519130549.112823-19-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ixgbe: fix link status inconsistencies' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. 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. Thanks. Luca Boccassi --- >From 4493efb719981e4053f526dcbbc2324e9054f01e Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 26 Feb 2020 20:06:37 +0800 Subject: [PATCH] net/ixgbe: fix link status inconsistencies [ upstream commit efa8c72f1ecf7b02239a0627c482b7ba9af66f40 ] Setting LINK UP or LINK DOWN is divided into two parts, with the main task done in a separate thread, which can take up to 9 seconds. If cancel the thread in execution, may cause state inconsistencies. Therefore, must wait for the previous setting to exit normally before setting the new state. Note: before using threads, use alarm to handle main tasks. When canceling alarm, the execution of alarm will not be interrupted. Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events") Signed-off-by: Tao Zhu Acked-by: Xiaolong Ye Tested-by: Yu Jiang --- drivers/net/ixgbe/ixgbe_ethdev.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3f66b490ed..2cedd1a273 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4140,16 +4140,35 @@ out: return ret_val; } +/* return 1: setup complete, return 0: setup not complete, and wait timeout*/ +static int +ixgbe_dev_wait_setup_link_complete(struct rte_eth_dev *dev) +{ +#define DELAY_INTERVAL 100 /* 100ms */ +#define MAX_TIMEOUT 90 /* 9s (90 * 100ms) in total */ + struct ixgbe_adapter *ad = dev->data->dev_private; + int timeout = MAX_TIMEOUT; + + while (rte_atomic32_read(&ad->link_thread_running) && timeout) { + msec_delay(DELAY_INTERVAL); + timeout--; + } + + + return !!timeout; +} + static void ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev) { struct ixgbe_adapter *ad = dev->data->dev_private; void *retval; - if (rte_atomic32_read(&ad->link_thread_running)) { + if (!ixgbe_dev_wait_setup_link_complete(dev)) { pthread_cancel(ad->link_thread_tid); pthread_join(ad->link_thread_tid, &retval); rte_atomic32_clear(&ad->link_thread_running); + PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!"); } } @@ -4259,7 +4278,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, if (link_up == 0) { if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; - if (rte_atomic32_test_and_set(&ad->link_thread_running)) { + if (ixgbe_dev_wait_setup_link_complete(dev) && + rte_atomic32_test_and_set(&ad->link_thread_running)) { if (rte_ctrl_thread_create(&ad->link_thread_tid, "ixgbe-link-handler", NULL, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:45.379117229 +0100 +++ 0019-net-ixgbe-fix-link-status-inconsistencies.patch 2020-05-19 14:04:44.128646777 +0100 @@ -1,8 +1,10 @@ -From efa8c72f1ecf7b02239a0627c482b7ba9af66f40 Mon Sep 17 00:00:00 2001 +From 4493efb719981e4053f526dcbbc2324e9054f01e Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 26 Feb 2020 20:06:37 +0800 Subject: [PATCH] net/ixgbe: fix link status inconsistencies +[ upstream commit efa8c72f1ecf7b02239a0627c482b7ba9af66f40 ] + Setting LINK UP or LINK DOWN is divided into two parts, with the main task done in a separate thread, which can take up to 9 seconds. If cancel the thread in execution, may cause state @@ -13,7 +15,6 @@ When canceling alarm, the execution of alarm will not be interrupted. Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events") -Cc: stable@dpdk.org Signed-off-by: Tao Zhu Acked-by: Xiaolong Ye @@ -23,10 +24,10 @@ 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c -index 13f5ac2357..2a8543fd73 100644 +index 3f66b490ed..2cedd1a273 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c -@@ -4143,16 +4143,35 @@ out: +@@ -4140,16 +4140,35 @@ out: return ret_val; } @@ -63,7 +64,7 @@ } } -@@ -4263,7 +4282,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, +@@ -4259,7 +4278,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, if (link_up == 0) { if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;