From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hh+j3NY33yxu/NQxl7P5ytFY1xSnvI2KxVu8DjaJzTQ=; b=g9ELuVCxmXPFeatzOqNQSQpXAwb9GzYpGuJy60oeCBy4qf5ToOq9tzF2lATuxAmToa xlRQC4vmoN75ClADMJE2KlXRJ/IwU2SpA36hVLSHKdRQr9UMrlB/y2DrsMrl2wqWAS8t rOPfVQ9HIZbqSLRI3CWcTxugTbfsf4RFi2XjLy61fdALYXa0uWScSqamUdEZ+Dp4UfCX zFp2rYzrVgftPFDho0ocZJqNyYtIir73BjjjHTU0sxCuMh2k5p0aagBLUkowkykstO5e GUmQX4Jj2OqsMBLH6hw7+TEpBHLCJYFBu3SVYTURyK/gFUdhcGR81ZM2iK4ARklg0ZdY 4/PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hh+j3NY33yxu/NQxl7P5ytFY1xSnvI2KxVu8DjaJzTQ=; b=UtxR0qbUW9J5P7OIaANkIv8kvyE//l7A7kyJHdcYTWj5zoBUOrsIi3v20sZ4mtAAfX 5t/wCLNhaqF9I24kA3GJP7/zAtxK7Xh6/zyXvZwBP7w766dPCPTcsoZeCHGt471cp8jA rH9mOFtm2VyKRl5+i2MyZL8Jb2i8kvwhLiAPypgwmG1cekXiqzuzb6Vbv0DpfR2GC96d yrCjPWZMF73seUjY20WCfsbsPh3MAP2efPO68WtCBuhEQEHUx5y8QnxmDTVD7mWmvAYv yjpiVpsSUOVL7agF/CoB2pHwLi4lP0fQjjNQRv+QWsjsmNEUg6xcE0HrRznhMwKTauiV H6AQ== X-Gm-Message-State: AIVw113PLISrMVidSP1La7AHd1w8y8Zpne9dN1aRcwLlyp6Spc2avyso xu0+zQ0K39Ooo92ccrSktw== X-Received: by 10.101.85.206 with SMTP id k14mr15930160pgs.153.1500057039210; Fri, 14 Jul 2017 11:30:39 -0700 (PDT) Received: from xeon-e3.wavecable.com (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id r9sm22711163pfi.114.2017.07.14.11.30.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 11:30:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 14 Jul 2017 11:30:16 -0700 Message-Id: <20170714183027.16021-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170714183027.16021-1-stephen@networkplumber.org> References: <20170714183027.16021-1-stephen@networkplumber.org> Subject: [dpdk-dev] [RFC 03/14] bnxt: use rte_link_update 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: , X-List-Received-Date: Fri, 14 Jul 2017 18:30:40 -0000 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