From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by dpdk.org (Postfix) with ESMTP id 0B534548B for ; Fri, 1 Dec 2017 16:20:08 +0100 (CET) Received: by mail-lf0-f65.google.com with SMTP id 94so12080763lfy.10 for ; Fri, 01 Dec 2017 07:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7w33SC9rzCMh13atE6OXqEnYU7jhaJ2x525BV3iu56o=; b=I+XIZNded5mw7x4I8wCDQ5wLMlslu/cPAKQlp22X3c/fvIOo2KU4PDCTUfCH5oPNnS bPlCXjyMzui2bLsC1F8lW6EtcU9ZhzDVS2nm68KFy73AUSLQd3hIuFt1HO33E/kV79ck aqK3nWig/8kubtrGqnt1klDtXrylYUPitkU7qOxWxvISJ4JCTWt0wmcQgQKuubUZOsEw rbI3Okqsce/9VpJNSym17wy6gTnRDiBx5GR1H1KrgtTM/V8mVRZC41TtnZW2+ioN/M9p Iz6T8HZgKlnnL5R4OuhzuCrKO24RBEiK65uZlVdYpiESmoy79MbEOUfxVuqj1Ibh/KhD WdYg== 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=7w33SC9rzCMh13atE6OXqEnYU7jhaJ2x525BV3iu56o=; b=XA36h6aPwPq3dH0p+/D+7AenIH6oSzVyECktlqFo1s+0moS9WoZWWjCF7pkL/BVsTC NNE8WAUxZBJQg2jmcZ5uPb83p6uuo3qXvT9i3rMGJE8qeHbMlEzPmRfHie8so5WkKR5T WtNp+yeh854MJ7DCl+7A5VsnbNCZz3wQrIk5PKJ1mq8DVbSJZ0NZhy1K39rT5JIkCzLt UqxaCDIDzQvhmG1r9pujbLgI2bjenZSPTA8zOZuTHXB48Fi3jrKzHnTdZ63DctDQpLaI RmyPZ8Rsy5Zcxkpyty8zRuwniGMjXO//HM1aolImskGYtefAnPad3PzlweiugL74nAlG 53xA== X-Gm-Message-State: AJaThX5d+NltJzzbU/CpMijfP720pSJHl/HoeFUj94puQpKAP/vpngBi 81CsBtTup/Ug6JcfV3ZpGYYonSddPqc= X-Google-Smtp-Source: AGs4zMaTUnBTWFsnC233Zfs9Y8xH7QFY3971oya/zuBmOHM83vnq+h6fkzZrFTqKLABl2SmqpJfepA== X-Received: by 10.46.46.23 with SMTP id u23mr2075203lju.187.1512141607457; Fri, 01 Dec 2017 07:20:07 -0800 (PST) Received: from tdu.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id j1sm1177674lfe.66.2017.12.01.07.20.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Dec 2017 07:20:06 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, jck@semihalf.com, dima@marvell.com, nsamsono@marvell.com, jianbo.liu@arm.com, Tomasz Duszynski Date: Fri, 1 Dec 2017 16:19:47 +0100 Message-Id: <1512141592-16695-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512141592-16695-1-git-send-email-tdu@semihalf.com> References: <1512048743-23749-1-git-send-email-tdu@semihalf.com> <1512141592-16695-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH 2/7] net/mrvl: query link status using library API 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, 01 Dec 2017 15:20:08 -0000 Up to now link status was updated unconditionally during link_up()/link_down() calls thus one was never sure about it's true status. Using dedicated library api makes sure the true link status is set. Signed-off-by: Tomasz Duszynski --- drivers/net/mrvl/mrvl_ethdev.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index a1ae2c1..47f12b8 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -361,8 +361,6 @@ mrvl_dev_set_link_up(struct rte_eth_dev *dev) if (ret) pp2_ppio_disable(priv->ppio); - dev->data->dev_link.link_status = ETH_LINK_UP; - return ret; } @@ -379,15 +377,8 @@ static int mrvl_dev_set_link_down(struct rte_eth_dev *dev) { struct mrvl_priv *priv = dev->data->dev_private; - int ret; - - ret = pp2_ppio_disable(priv->ppio); - if (ret) - return ret; - - dev->data->dev_link.link_status = ETH_LINK_DOWN; - return ret; + return pp2_ppio_disable(priv->ppio); } /** @@ -628,9 +619,10 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) * TODO * once MUSDK provides necessary API use it here */ + struct mrvl_priv *priv = dev->data->dev_private; struct ethtool_cmd edata; struct ifreq req; - int ret, fd; + int ret, fd, link_up; edata.cmd = ETHTOOL_GSET; @@ -670,6 +662,8 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) ETH_LINK_HALF_DUPLEX; dev->data->dev_link.link_autoneg = edata.autoneg ? ETH_LINK_AUTONEG : ETH_LINK_FIXED; + pp2_ppio_get_link_state(priv->ppio, &link_up); + dev->data->dev_link.link_status = link_up ? ETH_LINK_UP : ETH_LINK_DOWN; return 0; } -- 2.7.4