From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 317FA7CEF for ; Tue, 5 Dec 2017 10:39:38 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id i2so22437457lfe.9 for ; Tue, 05 Dec 2017 01:39:38 -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=OqcijicWBLrzhBXn3knBHe+baMlNdzMqmMkVjbIwkAg=; b=Lgm9GmCJYmWLwkANIfzSrlHiq2tUbqve+QvqFpPRtrgxrXHAVDgkh5xAtasOlH4C5U gj6g2YiRy0COkdAO9yx5v9/2XgL32tCMo3MDKVEl7W+JE7Az/IX/NtdAWdLPIhPg0Ile DceakDPIkUZccE9igUR49FwWhWVwB/tWT80ZOncobzi54VOJkoblhZ1zKrQuGqqypfxV ICSbgdfOD7p9OR79RcBWW26uYHb+KDx93QpIuHdojmqzXu30yFTLzsrxC5awaCJ3YhWX SDgoN3IC1M/s78wA6XCkjVkhhZCEocTokFISmLrSamg2+vb3n8yeWJ7lgTNKg3QbFbCN v6Vw== 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=OqcijicWBLrzhBXn3knBHe+baMlNdzMqmMkVjbIwkAg=; b=MfFTJkSdxWymsZ0F81bJzrQZUSmx3Gfxdb1spMKNleP88GCZ40AmNGRZyvfyV0unBY nm6RBj+u03F+OTt5ZFcsUxPq+x7NGDOXx1PERsNmoO34uFfPj0kLnd59nO+5elrrKdCK L4z5WXnQVhW5VB5H8c8m394VHngneJt3k+EG7s7yw45I6JVXhUlb3ozaN4YyE/g7mcV5 XaavJiPRnifANo4zeLhjvf50pyE+C+rirGLpkj/rp/hDJR3Al6Uu3fsjCA3aDThIPaJf 3mMSzxzyM4l+Rjcyt6+g2m0MHxxQJAHn5r9HuEeuaIl5EPQ3oGjo9mHQZFEHG9A0zBaq KDNg== X-Gm-Message-State: AJaThX5y70RmoCl8r+4sTAKs2PGgpungte7yOdwsHC0yFKDs5m0r8QVD rdad8olSIWhDTjnvTHLvgoM2r7Nmd/Q= X-Google-Smtp-Source: AGs4zMYVn5E/UBzSGsIGjtao1sVZqjJQraarGWAnAp1z2e80wEA9P5Jgk/fcu1ZoMjDqypyPKvLlCQ== X-Received: by 10.46.116.1 with SMTP id p1mr9728457ljc.103.1512466777487; Tue, 05 Dec 2017 01:39:37 -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 p5sm3334975ljc.7.2017.12.05.01.39.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Dec 2017 01:39:36 -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: Tue, 5 Dec 2017 10:39:17 +0100 Message-Id: <1512466762-1982-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512466762-1982-1-git-send-email-tdu@semihalf.com> References: <1512141592-16695-1-git-send-email-tdu@semihalf.com> <1512466762-1982-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v3 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: Tue, 05 Dec 2017 09:39:38 -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 Acked-by: Jianbo Liu --- 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