DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] net/txgbe: fix link status when device stopped
Date: Thu, 12 Aug 2021 10:00:18 +0800	[thread overview]
Message-ID: <20210812020020.12656-2-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210812020020.12656-1-jiawenwu@trustnetic.com>

When device is stopped, the port status is not changed and only the Tx
laser is turned off by hardware design.

Fixes: 0c061eadec59 ("net/txgbe: add link status change")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_type.h | 1 +
 drivers/net/txgbe/txgbe_ethdev.c    | 4 ++++
 drivers/net/txgbe/txgbe_ethdev_vf.c | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/drivers/net/txgbe/base/txgbe_type.h b/drivers/net/txgbe/base/txgbe_type.h
index 823c6756e7..d95467f9f8 100644
--- a/drivers/net/txgbe/base/txgbe_type.h
+++ b/drivers/net/txgbe/base/txgbe_type.h
@@ -781,6 +781,7 @@ struct txgbe_hw {
 	int api_version;
 	bool allow_unsupported_sfp;
 	bool need_crosstalk_fix;
+	bool dev_start;
 	struct txgbe_devargs devarg;
 
 	uint64_t isb_dma;
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index e62675520a..0063994688 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -1664,6 +1664,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
 		return -1;
 	hw->mac.start_hw(hw);
 	hw->mac.get_link_status = true;
+	hw->dev_start = true;
 
 	/* configure PF module if SRIOV enabled */
 	txgbe_pf_host_configure(dev);
@@ -1933,6 +1934,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
 
 	hw->adapter_stopped = true;
 	dev->data->dev_started = 0;
+	hw->dev_start = false;
 
 	return 0;
 }
@@ -2735,6 +2737,8 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,
 				txgbe_dev_setup_link_alarm_handler, dev);
 		}
 		return rte_eth_linkstatus_set(dev, &link);
+	} else if (!hw->dev_start) {
+		return rte_eth_linkstatus_set(dev, &link);
 	}
 
 	intr->flags &= ~TXGBE_FLAG_NEED_LINK_CONFIG;
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 0bae6ffd1f..18ed94bd27 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -628,6 +628,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev)
 		return err;
 	}
 	hw->mac.get_link_status = true;
+	hw->dev_start = true;
 
 	/* negotiate mailbox API version to use with the PF. */
 	txgbevf_negotiate_api(hw);
@@ -749,6 +750,7 @@ txgbevf_dev_stop(struct rte_eth_dev *dev)
 	}
 
 	adapter->rss_reta_updated = 0;
+	hw->dev_start = false;
 
 	return 0;
 }
-- 
2.21.0.windows.1




  reply	other threads:[~2021-08-12  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12  2:00 [dpdk-dev] [PATCH 0/3] Fixes for txgbe Jiawen Wu
2021-08-12  2:00 ` Jiawen Wu [this message]
2021-08-12  2:00 ` [dpdk-dev] [PATCH 2/3] net/txgbe: fix to read SFP module's SFF-8472 data Jiawen Wu
2021-08-12  2:00 ` [dpdk-dev] [PATCH 3/3] net/txgbe: fix L4 port mask in FDIR Jiawen Wu
2021-08-18 14:06 ` [dpdk-dev] [PATCH 0/3] Fixes for txgbe Ferruh Yigit

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=20210812020020.12656-2-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).