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 60D1A5B16 for ; Fri, 14 Sep 2018 08:28:12 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 Sep 2018 09:32:27 +0300 Received: from dev-r630-05.mtbc.labs.mlnx (dev-r630-05.mtbc.labs.mlnx [10.12.205.160]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w8E6S92O019933; Fri, 14 Sep 2018 09:28:10 +0300 Received: from dev-r630-05.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-05.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w8E6S8gD118724; Fri, 14 Sep 2018 14:28:08 +0800 Received: (from xuemingl@localhost) by dev-r630-05.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w8E6S4W5118723; Fri, 14 Sep 2018 14:28:04 +0800 From: Xueming Li To: Shahaf Shuler , Yongseok Koh Cc: Xueming Li , dev@dpdk.org, adrien.mazarguil@6wind.com Date: Fri, 14 Sep 2018 14:27:57 +0800 Message-Id: <1536906477-118136-1-git-send-email-xuemingl@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1536216636-15673-1-git-send-email-xuemingl@mellanox.com> References: <1536216636-15673-1-git-send-email-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH v2] 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: Fri, 14 Sep 2018 06:28:12 -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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 34c5b95..7391ab8 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) { @@ -666,8 +667,9 @@ struct ethtool_link_settings { ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - if ((dev_link.link_speed && !dev_link.link_status) || - (!dev_link.link_speed && dev_link.link_status)) { + if (!priv->representor && + ((dev_link.link_speed && !dev_link.link_status) || + (!dev_link.link_speed && dev_link.link_status))) { rte_errno = EAGAIN; return -rte_errno; } @@ -698,7 +700,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 +709,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) { @@ -775,8 +778,9 @@ struct ethtool_link_settings { ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - if ((dev_link.link_speed && !dev_link.link_status) || - (!dev_link.link_speed && dev_link.link_status)) { + if (!priv->representor && + ((dev_link.link_speed && !dev_link.link_status) || + (!dev_link.link_speed && dev_link.link_status))) { rte_errno = EAGAIN; return -rte_errno; } -- 1.8.3.1