From: Andrew Rybchenko Subject: Re: [PATCH v2 09/15] sfc: use new rte_eth_linkstatus functions Date: Sat, 6 Jan 2018 14:10:25 +0300 Message-ID: <796ae17a-2b1c-3cf7-e59d-1e5b2af5dc67@solarflare.com> References: <20180106010656.9167-1-stephen@networkplumber.org> <20180106010656.9167-10-stephen@networkplumber.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit To: Stephen Hemminger , 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 B2ACB1322C for ; Sat, 6 Jan 2018 12:10:36 +0100 (CET) In-Reply-To: <20180106010656.9167-10-stephen@networkplumber.org> Content-Language: en-GB List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 01/06/2018 04:06 AM, Stephen Hemminger wrote: > Use the new API (_rte_eth_linkstatus_set) to handle link status update. > > Signed-off-by: Stephen Hemminger Many thanks. Good idea since the code is definitely shorter and easier to read/understand. The summary should be net/sfc:, not just sfc:. In fact it is applicable to all network driver patches. > --- > 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 a16dc27b380e..3e96536a9d60 100644 > --- a/drivers/net/sfc/sfc_ev.c > +++ b/drivers/net/sfc/sfc_ev.c > @@ -404,29 +404,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; It must be return B_FALSE as before the patch.. > } > > static const efx_ev_callbacks_t sfc_ev_callbacks = {