From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 1513C1B1A9 for ; Tue, 23 Jan 2018 00:55:14 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id i66so8343263pfd.7 for ; Mon, 22 Jan 2018 15:55:14 -0800 (PST) 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=bOpzc1oKt2nagVzwLSLzrs+6zGaYsPT0T7DfD+mCd48=; b=oIlkNGEqAikixvO9J9gYSyGKzXAYVIurLr2mDz7iO529gXdASYR9FicazInhLJMYZw QVA/gwZ7fzAsHlykwnBg3MrC7sextNl8cxsbCs8cQE8kmYxDoqMkBgWnRsatv95r8c0A 8tCf61pAIBUsUh8XpdcbyaluNc7618njzOEf2yhxb3fFkLoxLC8pUEdMm/knHCQfimXf pUl0PMRt3Y5VSXDdT8P5NHI+DWzcG9hhVONJT4AOvFrle53E5Y8djfgM0dthoKWRlB5k NWGqcBQ5BhCejJZ/LQfSLteDQfW2VSxj2czNntLf0bNUMK6Lq9Se5uCBvTuvzL3Sl8aK toFQ== 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=bOpzc1oKt2nagVzwLSLzrs+6zGaYsPT0T7DfD+mCd48=; b=EegHsOmZe01SEuYizZTgs8pYDnGKdYsBD3KWVPIKLBde46YonxeGNeBetBgJZLErgb CmXTnUuuk9N/EXToYBamiAYD9UhclXsjvsv03nV8NVh3RtPyKWZno3/s+AbhZNCA4jiL kI/Oj6/Ftf9kXvy3w6sJ0sm5nFZSiLBGc0kIX7FJkrXlpVEAbo3C+KVAVLoHtn0EXhxh Ns7AO4qgTzaFGNn1hltmKNnNpdswHZ2AyiLzM4Y9dO/AlipSzHHudFpuMLYK9SV3p9VE MhmsbRCxoeWwFshljrJeEmiGSiU+VHpXVWme9oJG7akcvv6sAwBBrd4KPKeLGPYN6kjA kv3w== X-Gm-Message-State: AKwxytdYlNS1GZJsFRw3YXzg88fBbIHxqf0tlE4HpmiU09svn+DJJit4 dz17W3c3v3RwX9lUciCDnB4d4agp93w= X-Google-Smtp-Source: AH8x224pjFXgm4LU3XwMJWKU3sbendSt6zL4JWFg0ojr5o6sVQm5X4phI3LhgkC5Ljq3vI79AN9vyQ== X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr4180861plk.212.1516665313645; Mon, 22 Jan 2018 15:55:13 -0800 (PST) Received: from xeon-e3.lan (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id a24sm1623825pff.160.2018.01.22.15.55.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 15:55:12 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 22 Jan 2018 15:54:52 -0800 Message-Id: <20180122235458.28562-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180122235458.28562-1-stephen@networkplumber.org> References: <20180122235458.28562-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v7 09/15] net/sfc: use new rte_eth_linkstatus functions 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: Mon, 22 Jan 2018 23:55:15 -0000 Use the new API (_rte_eth_linkstatus_set) to handle link status update. Signed-off-by: Stephen Hemminger --- drivers/net/sfc/sfc_ethdev.c | 21 +++------------------ drivers/net/sfc/sfc_ev.c | 20 ++------------------ 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 89a452907621..01a2c608915e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -236,22 +236,12 @@ static int sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) { struct sfc_adapter *sa = dev->data->dev_private; - struct rte_eth_link *dev_link = &dev->data->dev_link; - struct rte_eth_link old_link; struct rte_eth_link current_link; sfc_log_init(sa, "entry"); -retry: - EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t)); - *(int64_t *)&old_link = rte_atomic64_read((rte_atomic64_t *)dev_link); - if (sa->state != SFC_ADAPTER_STARTED) { sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, ¤t_link); - if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link, - *(uint64_t *)&old_link, - *(uint64_t *)¤t_link)) - goto retry; } else if (wait_to_complete) { efx_link_mode_t link_mode; @@ -259,21 +249,16 @@ sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) link_mode = EFX_LINK_UNKNOWN; sfc_port_link_mode_to_info(link_mode, ¤t_link); - if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link, - *(uint64_t *)&old_link, - *(uint64_t *)¤t_link)) - goto retry; } else { sfc_ev_mgmt_qpoll(sa); - *(int64_t *)¤t_link = - rte_atomic64_read((rte_atomic64_t *)dev_link); + rte_eth_linkstatus_get(dev, ¤t_link); } - if (old_link.link_status != current_link.link_status) + if (rte_eth_linkstatus_set(dev, ¤t_link)) sfc_info(sa, "Link status is %s", current_link.link_status ? "UP" : "DOWN"); - return old_link.link_status == current_link.link_status ? 0 : -1; + return 0; } static void diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 7abe61ae5ff1..273a92ccb222 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -382,27 +382,11 @@ sfc_ev_link_change(void *arg, efx_link_mode_t link_mode) { struct sfc_evq *evq = arg; struct sfc_adapter *sa = evq->sa; - struct rte_eth_link *dev_link = &sa->eth_dev->data->dev_link; struct rte_eth_link new_link; - uint64_t new_link_u64; - uint64_t old_link_u64; - - EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t)); sfc_port_link_mode_to_info(link_mode, &new_link); - - new_link_u64 = *(uint64_t *)&new_link; - do { - old_link_u64 = rte_atomic64_read((rte_atomic64_t *)dev_link); - if (old_link_u64 == new_link_u64) - break; - - if (rte_atomic64_cmpset((volatile uint64_t *)dev_link, - old_link_u64, new_link_u64)) { - evq->sa->port.lsc_seq++; - break; - } - } while (B_TRUE); + if (rte_eth_linkstatus_set(sa->eth_dev, &new_link)) + evq->sa->port.lsc_seq++; return B_FALSE; } -- 2.15.1