From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 9E1627CBE for ; Fri, 14 Jul 2017 20:30:54 +0200 (CEST) Received: by mail-pf0-f178.google.com with SMTP id q86so49079790pfl.3 for ; Fri, 14 Jul 2017 11:30:54 -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=ND889D2qfpNyvKxQ40xQEJ+n9RHpB4Feu95Qr5oFFhg=; b=y5M8LfiBVafNj8FVz6LH7co825NtDA83AV+X2RuqPvut3iAKePNlKsUaNaGE9Cc8GI h6B5K3ym9BLVM6Az100854zFoCNV+tXNQzw9jhSnDIGpTlvp0UhU52op/OxmWdGMC5ac h6NpaVkFGslkLQ23RywMa/9Y9TDZfl9X/Y2dDIx3R1MMMYOpHBseum+y2BE8Lf3GfTPD sMN1WEVrUNDzyUu9ZBn99t+ignU7MzVWHOVvEGc5aD5N+oszQvSIEU0mYARgWiDDWibf q9ZDtvrnDGDxsfQddtPEYUuwc+Ft4mLy512C5RKyZy8cKM9l4oj5QSRdINHbyjr8hoJ/ 0PGw== 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=ND889D2qfpNyvKxQ40xQEJ+n9RHpB4Feu95Qr5oFFhg=; b=gHC6JZv6Xj+9HoQ4SKRJi/NgZJ4kMiKOmowvRoFkrz2G/qdMyfSaEWIuwN/YsmFshU FjIUAeyHHuMe0CI8a7eeG+kIpQURaAqfOTi7YqucI+pwAf26YLzqLaC4rwUtaONQTVMQ fqqqRZ5pJvadrcA3W36L6bpeO+Mg8EWNbzodeMCEhBUYCTmJJ3Z2G397gfxts0MVbmYO kVbVhvXwhyHj4CeWg3XBuNJVEIDzM7hIsCtbESqditi2qOykTOPEx9tPzQx1qTXcXWHF IhlDSOzDNXDkFBANdLYo3J63tALwDpQ/PkiHNBp55yoZtGFaBVy+wEDiUAwP4WSW/vIJ /TPQ== X-Gm-Message-State: AIVw110+h1Xg1yPE6j7sqKT6SrYnO232CEj5Cu1yrbiBj44AQA0n5VzM cXhgfpc7Q9kuZhyzlvUxHw== X-Received: by 10.98.197.130 with SMTP id j124mr6574088pfg.117.1500057053459; Fri, 14 Jul 2017 11:30:53 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 11:30:51 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Fri, 14 Jul 2017 11:30:26 -0700 Message-Id: <20170714183027.16021-14-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 13/14] szedata: use _rte_eth_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:55 -0000 Yet another driver which was not returing correct value on link change. Signed-off-by: Stephen Hemminger --- drivers/net/szedata2/rte_eth_szedata2.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 9c0d57cc14c0..b81ba8e79c64 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -50,7 +50,6 @@ #include #include #include -#include #include "rte_eth_szedata2.h" #include "szedata2_iobuf.h" @@ -1171,9 +1170,7 @@ static int eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) { - struct rte_eth_link link; - struct rte_eth_link *link_ptr = &link; - struct rte_eth_link *dev_link = &dev->data->dev_link; + struct rte_eth_link link, old; struct pmd_internals *internals = (struct pmd_internals *) dev->data->dev_private; const volatile struct szedata2_ibuf *ibuf; @@ -1195,8 +1192,12 @@ eth_link_update(struct rte_eth_dev *dev, break; } + _rte_eth_link_read(dev, &old); + memset(&link, 0, sizeof(link)); + /* szedata2 uses only full duplex */ link.link_duplex = ETH_LINK_FULL_DUPLEX; + link.link_autoneg = ETH_LINK_SPEED_FIXED; for (i = 0; i < szedata2_ibuf_count; i++) { ibuf = ibuf_ptr_by_index(internals->pci_rsc, i); @@ -1210,14 +1211,11 @@ eth_link_update(struct rte_eth_dev *dev, } } - link.link_status = (link_is_up) ? ETH_LINK_UP : ETH_LINK_DOWN; + link.link_status = link_is_up ? ETH_LINK_UP : ETH_LINK_DOWN; - link.link_autoneg = ETH_LINK_SPEED_FIXED; + _rte_eth_link_write(dev, &link); - rte_atomic64_cmpset((uint64_t *)dev_link, *(uint64_t *)dev_link, - *(uint64_t *)link_ptr); - - return 0; + return (old.link_status == link.link_status) ? -1 : 0; } static int -- 2.11.0