From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id A62962D13 for ; Fri, 12 Jan 2018 08:45:51 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 5117998007C; Fri, 12 Jan 2018 07:45:50 +0000 (UTC) Received: from [192.168.38.17] (84.52.114.114) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 12 Jan 2018 07:45:44 +0000 To: Ferruh Yigit , Bruce Richardson , Konstantin Ananyev CC: , Stephen Hemminger References: <20180108174514.14688-1-stephen@networkplumber.org> <20180111170658.2809-1-ferruh.yigit@intel.com> <20180111170658.2809-9-ferruh.yigit@intel.com> From: Andrew Rybchenko Message-ID: <2c9a2b1d-0b0f-7a5d-0cfc-3dd64868d62d@solarflare.com> Date: Fri, 12 Jan 2018 10:45:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180111170658.2809-9-ferruh.yigit@intel.com> Content-Language: en-GB X-Originating-IP: [84.52.114.114] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23590.003 X-TM-AS-Result: No--12.965400-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1515743151-rJitrFpAtbVG Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4 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: Fri, 12 Jan 2018 07:45:51 -0000 On 01/11/2018 08:06 PM, Ferruh Yigit wrote: > From: Stephen Hemminger > > Use the new API (_rte_eth_linkstatus_set) to handle link status update. > > Signed-off-by: Stephen Hemminger > --- > drivers/net/sfc/sfc_ethdev.c | 27 +++++++-------------------- > drivers/net/sfc/sfc_ev.c | 23 ++++------------------- > 2 files changed, 11 insertions(+), 39 deletions(-) <...> > diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c > index 7abe61ae5..242b1fae4 100644 > --- a/drivers/net/sfc/sfc_ev.c > +++ b/drivers/net/sfc/sfc_ev.c > @@ -382,29 +382,14 @@ 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); > + if (_rte_eth_linkstatus_set(sa->eth_dev, &new_link) == 0) > + return B_FALSE; > > - 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); > - > - return B_FALSE; > + evq->sa->port.lsc_seq++; > + return B_TRUE; > } > > static const efx_ev_callbacks_t sfc_ev_callbacks = { I've provided review notes for the callback a couple of times already, but it is ignored. The callback returns B_FALSE before the change and it must be preserved. The return value must not depend on link status changes. lsc_seq should be incremented in the case of any changes in link, not up/down changes only and it should be preserved.