patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: taox.zhu@intel.com
Cc: konstantin.ananyev@intel.com, wenzhuo.lu@intel.com, dev@dpdk.org,
	stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/ixgbe: fix link status inconsistencies
Date: Sun, 29 Mar 2020 12:14:32 +0800
Message-ID: <20200329041432.GD29805@intel.com> (raw)
In-Reply-To: <20200226120637.13109-1-taox.zhu@intel.com>

On 02/26, taox.zhu@intel.com wrote:
>From: Zhu Tao <taox.zhu@intel.com>
>
>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: 819d0d1d57 ("net/ixgbe: fix blocking system events")
>Cc: stable@dpdk.org
>
>Signed-off-by: Zhu Tao <taox.zhu@intel.com>
>---
> 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 23b3f5b0c..2c5797635 100644
>--- a/drivers/net/ixgbe/ixgbe_ethdev.c
>+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
>@@ -4143,16 +4143,35 @@ ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
> 	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!");
> 	}
> }
> 
>@@ -4263,7 +4282,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.17.1
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel, Thanks.

      parent reply	other threads:[~2020-03-29  4:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 12:06 [dpdk-stable] " taox.zhu
2020-03-03  2:00 ` Zhu, TaoX
2020-03-19  2:43   ` Zhu, TaoX
2020-03-29  4:14 ` Ye Xiaolong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200329041432.GD29805@intel.com \
    --to=xiaolong.ye@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=stable@dpdk.org \
    --cc=taox.zhu@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git