From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 3EE8C325F for ; Thu, 6 Sep 2018 08:50:56 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Sep 2018 09:55:00 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w866oquS018046; Thu, 6 Sep 2018 09:50:52 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w866ooRg015723; Thu, 6 Sep 2018 14:50:50 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w866olmd015722; Thu, 6 Sep 2018 14:50:47 +0800 From: Xueming Li To: Shahaf Shuler , Yongseok Koh Cc: Xueming Li , dev@dpdk.org, adrien.mazarguil@6wind.com Date: Thu, 6 Sep 2018 14:50:36 +0800 Message-Id: <1536216636-15673-1-git-send-email-xuemingl@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix wrong representor port link status 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, 06 Sep 2018 06:50:56 -0000 Current code uses PF links status for representor port, not the representor interface itself. This caused wrong representor port link status when toggling linterface up or down. Fixes: 5a4b8e2612c5 ("net/mlx5: probe all port representors") Cc: adrien.mazarguil@6wind.com Signed-off-by: Xueming Li --- drivers/net/mlx5/mlx5_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 34c5b95..08b22ce 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -627,7 +627,7 @@ struct ethtool_link_settings { int link_speed = 0; int ret; - ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); + ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", dev->data->port_id, strerror(rte_errno)); @@ -636,6 +636,7 @@ struct ethtool_link_settings { memset(&dev_link, 0, sizeof(dev_link)); dev_link.link_status = ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING)); + memset(&ifr, 0, sizeof(ifr)); ifr.ifr_data = (void *)&edata; ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { @@ -698,7 +699,7 @@ struct ethtool_link_settings { uint64_t sc; int ret; - ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 1); + ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr, 0); if (ret) { DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s", dev->data->port_id, strerror(rte_errno)); @@ -707,6 +708,7 @@ struct ethtool_link_settings { memset(&dev_link, 0, sizeof(dev_link)); dev_link.link_status = ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING)); + memset(&ifr, 0, sizeof(ifr)); ifr.ifr_data = (void *)&gcmd; ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr, 1); if (ret) { -- 1.8.3.1