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 0C4673237 for ; Thu, 30 Nov 2017 14:32:39 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id l81so7903225lfl.6 for ; Thu, 30 Nov 2017 05:32:39 -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=kBWfBJd0Anu4rp6fHWWvjbbhNjIuzGfzkw1Er918Zaw=; b=rNnfoeuE3rnvGnt9coVsI0s2nZriryR8TJxZdlA7/zLOeDMU4+Zab8RAay34K1//rc sS9zqgmXxDC052mvPb0pSSCDZr+JKmy9Qkqw3CFB0R7cnczp4zlFrtmq+UNbQtbL50du rzr/dFdtEeXnEXMZLeD1gWnKSqE66UAK1mXAqfLXfYUc/bNjHQ7VLEg0LYKEt3K4KN2c 2lxYD8vQrnml+GwAkEYvfqpyEBkwu95z7HePgbnciJEeB2VHlpmHpEAmfjttMkI2SZyt qpS5E6OL9Qce2Nz3pwQN1bMUx13EXWL8b8Rc7JuMWpxn2p0nNXMrYLpadIEK2eOK/W6v 40lA== 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=kBWfBJd0Anu4rp6fHWWvjbbhNjIuzGfzkw1Er918Zaw=; b=obdrPte3ZgsZb9neqqSgyQ+mT5GWalK664GZdGQg0wJLbXUnAJ41yPLxhH56uuTXvn k084LR76P/Xl0dgx5uyg730o8yB/u0gcny6m6Q1kZXgKyGnO7H6qinxqmX/UFyGlqjdR bNevwMvklyq0hsht6P4Gg+3NuHjZAasDDQh05VDMCJFP3Z7Lo47DG7rHSsg08pbAgyp7 SM7SBEpPvTbBMq7zuMG1XdWFXe7hx80Fogme91RV3sQ6MLqzrLJqyujvfi/JbFpvDTwh Y6Vhz9OCl35+et1BvjqHHNbUgGRJL6rpI2myElu915MfWb+MSAs3kJQhZPZ4oO0UmecB dk3Q== X-Gm-Message-State: AJaThX69yl5R6pd/h+jFj8YKDAiwRtX3Qz3EipVVq1GunEuSvbjj0Vq7 CtYFegEXiIVBV0ojGlmZcNBeXCAeiCA= X-Google-Smtp-Source: AGs4zMaNmYZuH3U5UKkfvffQOuSCTaSPVPK/6pmug6h6DeClMXNobuL3alsZvO4Nlf+qjNN/cc1jAg== X-Received: by 10.46.5.12 with SMTP id 12mr3083991ljf.116.1512048759166; Thu, 30 Nov 2017 05:32:39 -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 x27sm717277lfb.23.2017.11.30.05.32.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Nov 2017 05:32:38 -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: Thu, 30 Nov 2017 14:32:18 +0100 Message-Id: <1512048743-23749-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512048743-23749-1-git-send-email-tdu@semihalf.com> References: <1512048743-23749-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: Thu, 30 Nov 2017 13:32:40 -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 4fac797..e7703f7 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -366,8 +366,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; } @@ -384,15 +382,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); } /** @@ -633,9 +624,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; @@ -675,6 +667,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