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 DA25BA04F0; Tue, 17 Dec 2019 05:18:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5EDE334EF; Tue, 17 Dec 2019 05:18:34 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id A8D08235 for ; Tue, 17 Dec 2019 05:18:28 +0100 (CET) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (bgccx-dev-host-lnx35.bec.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 4F0251BE6AA; Mon, 16 Dec 2019 20:18:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 4F0251BE6AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1576556308; bh=MCqbCGspqvtzLA9X+Ucj2f06cYIVzJzpjGBHJtaEv9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7oO+64w85YfBCyFtzheaOzQtNPIHe2ih2VQzKNFDCS4lzVfaahrjHbx9S/0cIOKo Q7GK6unjfcrsQ19SM7M+zsaADQDbJSJ0rP4KbaQd3VIsf7+3rnzPwFVzz96w5ERR8e aDd1A1V6VyOxt+iGqmbxIHOa8EIiRUmAGgE/RBik= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Tue, 17 Dec 2019 09:47:50 +0530 Message-Id: <20191217041755.29232-2-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20191217041755.29232-1-somnath.kotur@broadcom.com> References: <20191217041755.29232-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 1/6] net/bnxt: fix link failure during port toggle by increasing link wait time X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Santoshkumar Karanappa Rastapur 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. Signed-off-by: Santoshkumar Karanappa Rastapur Reviewed-by: Somnath Kotur Signed-off-by: Somnath Kotur --- 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 bd8f660..257994d 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; @@ -657,7 +658,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 2c3129f..bb316b9 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 64f88e9..36905c2 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -859,7 +859,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; @@ -943,7 +943,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); @@ -1094,12 +1094,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) @@ -1117,7 +1119,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); @@ -1139,6 +1141,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; -- 1.8.3.1