From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>,
stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix link failure during port toggle
Date: Fri, 20 Dec 2019 18:29:35 -0800 [thread overview]
Message-ID: <20191221022937.54397-2-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20191217041755.29232-1-somnath.kotur@broadcom.com>
From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
We need to wait for up to 500ms to receive async event notification after
forcing link down. Similarly we need to wait for up to 10s for link to
come up after configuring the hardware for link up.
Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 10 ++++++----
drivers/net/bnxt/bnxt_cpr.c | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 18 +++++++++++++-----
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index ab18e8acd..ab0b8dde1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -231,9 +231,10 @@ struct bnxt_pf_info {
uint8_t evb_mode;
};
-/* Max wait time is 10 * 100ms = 1s */
-#define BNXT_LINK_WAIT_CNT 10
-#define BNXT_LINK_WAIT_INTERVAL 100
+/* Max wait time for link up is 10s and link down is 500ms */
+#define BNXT_LINK_UP_WAIT_CNT 200
+#define BNXT_LINK_DOWN_WAIT_CNT 10
+#define BNXT_LINK_WAIT_INTERVAL 50
struct bnxt_link_info {
uint32_t phy_flags;
uint8_t mac_type;
@@ -656,7 +657,8 @@ struct bnxt {
};
int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
-int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
+int bnxt_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete,
+ bool exp_link_status);
int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
int is_bnxt_in_error(struct bnxt *bp);
uint16_t bnxt_rss_ctxts(const struct bnxt *bp);
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 2c3129fe2..bb316b9e0 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -63,7 +63,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE:
/* FALLTHROUGH */
- bnxt_link_update_op(bp->eth_dev, 0);
+ bnxt_link_update(bp->eth_dev, 0, ETH_LINK_UP);
break;
case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD:
PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n");
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1b4ed293d..88df82b86 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -856,7 +856,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev);
- bnxt_link_update_op(eth_dev, 1);
+ bnxt_link_update(eth_dev, 1, ETH_LINK_UP);
if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
vlan_mask |= ETH_VLAN_FILTER_MASK;
@@ -940,7 +940,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
* During reset recovery, there is no need to wait
*/
if (!is_bnxt_in_error(bp))
- rte_delay_ms(BNXT_LINK_WAIT_INTERVAL * 2);
+ bnxt_link_update(eth_dev, 1, ETH_LINK_DOWN);
/* Clean queue intr-vector mapping */
rte_intr_efd_disable(intr_handle);
@@ -1086,12 +1086,14 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
return rc;
}
-int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
+int bnxt_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete,
+ bool exp_link_status)
{
int rc = 0;
struct bnxt *bp = eth_dev->data->dev_private;
struct rte_eth_link new;
- unsigned int cnt = BNXT_LINK_WAIT_CNT;
+ int cnt = exp_link_status ? BNXT_LINK_UP_WAIT_CNT :
+ BNXT_LINK_DOWN_WAIT_CNT;
rc = is_bnxt_in_error(bp);
if (rc)
@@ -1109,7 +1111,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
goto out;
}
- if (!wait_to_complete || new.link_status)
+ if (!wait_to_complete || new.link_status == exp_link_status)
break;
rte_delay_ms(BNXT_LINK_WAIT_INTERVAL);
@@ -1131,6 +1133,12 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
return rc;
}
+static int bnxt_link_update_op(struct rte_eth_dev *eth_dev,
+ int wait_to_complete)
+{
+ return bnxt_link_update(eth_dev, wait_to_complete, ETH_LINK_UP);
+}
+
static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
--
2.21.0 (Apple Git-122.2)
next prev parent reply other threads:[~2019-12-21 2:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 4:17 [dpdk-dev] [PATCH 0/6] bnxt patchset Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 1/6] net/bnxt: fix link failure during port toggle by increasing link wait time Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to use first valid profile if lossy profile not found Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow flush to sync with flow destroy routine Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix non matching flow hitting filter rule Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 5/6] net/bnxt: fix to keep the L2 filter intact so it can be reused Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 6/6] net/bnxt: fix to free l2 filters while clearing vnic flows/filters Somnath Kotur
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 0/5] bnxt patchset Ajit Khaparde
2019-12-21 2:50 ` Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 0/7] " Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 1/7] net/bnxt: fix link failure during port toggle Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 2/7] net/bnxt: fix to use first valid profile Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 3/7] net/bnxt: fix flow flush to sync with flow destroy Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 4/7] net/bnxt: fix non matching flow hitting filter rule Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 5/7] net/bnxt: fix to reuse an L2 filter Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 6/7] net/bnxt: add support for flow mark action Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 7/7] net/bnxt: fix to not overwrite error message Ajit Khaparde
2020-01-07 9:18 ` Ferruh Yigit
2020-01-07 21:50 ` Ajit Khaparde
2020-01-07 23:04 ` [dpdk-dev] [PATCH v3 0/7] bnxt patchset Ajit Khaparde
2019-12-21 2:29 ` Ajit Khaparde [this message]
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix to use first valid profile Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix flow flush to sync with flow destroy Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix non matching flow hitting filter rule Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix to reuse an L2 filter Ajit Khaparde
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=20191221022937.54397-2-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=santosh.rastapur@broadcom.com \
--cc=somnath.kotur@broadcom.com \
--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).