From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [RFC 03/14] bnxt: use rte_link_update Date: Fri, 14 Jul 2017 11:30:16 -0700 Message-ID: <20170714183027.16021-4-stephen@networkplumber.org> References: <20170714183027.16021-1-stephen@networkplumber.org> Cc: Stephen Hemminger To: dev@dpdk.org Return-path: Received: from mail-pg0-f42.google.com (mail-pg0-f42.google.com [74.125.83.42]) by dpdk.org (Postfix) with ESMTP id 21D41568A for ; Fri, 14 Jul 2017 20:30:40 +0200 (CEST) Received: by mail-pg0-f42.google.com with SMTP id u62so49286022pgb.3 for ; Fri, 14 Jul 2017 11:30:40 -0700 (PDT) In-Reply-To: <20170714183027.16021-1-stephen@networkplumber.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use new API to update link status, and fix incorrect return value. The link_update operation should have been returning -1 if link changed. Signed-off-by: Stephen Hemminger --- drivers/net/bnxt/bnxt_ethdev.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index c9d11228be46..4c79eb51fc22 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -469,20 +469,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) return 0; } -static inline int -rte_bnxt_atomic_write_link_status(struct rte_eth_dev *eth_dev, - struct rte_eth_link *link) -{ - struct rte_eth_link *dst = ð_dev->data->dev_link; - struct rte_eth_link *src = link; - - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) == 0) - return 1; - - return 0; -} - static void bnxt_print_link_info(struct rte_eth_dev *eth_dev) { struct rte_eth_link *link = ð_dev->data->dev_link; @@ -685,12 +671,9 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete) } while (!new.link_status && cnt--); out: - /* Timed out or success */ - if (new.link_status != eth_dev->data->dev_link.link_status || - new.link_speed != eth_dev->data->dev_link.link_speed) { - rte_bnxt_atomic_write_link_status(eth_dev, &new); + rc = _rte_eth_link_update(eth_dev, &new); + if (rc) bnxt_print_link_info(eth_dev); - } return rc; } -- 2.11.0