From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) by dpdk.org (Postfix) with ESMTP id E4C409953 for ; Mon, 21 Aug 2017 11:37:09 +0200 (CEST) Received: by mail-pg0-f51.google.com with SMTP id t3so68851493pgt.0 for ; Mon, 21 Aug 2017 02:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6ADxf+HmdLYeFPYpvR8qK5BuVUCzcTs7gEzFunCn0YY=; b=KbRE9/ukMEHBLIpN6kaiFGydjm3e8rirbEkVmoWJhrwzBiFi6d1JpeSaY/rJMlC+P1 bSSUlWJmxFoSaI+S2pnQZymQEAeb7vtO1qU0wnQwrKJonYCqaZW1wwLUCe86VU8FeVb3 t3F/h34h+tJHuDC4Bb5wWFbzuUUdiSfDvnVK5eUcwrtONKck6DAmF2geJBvyVPVfeJGe MEL2yI4PkpjeELj598kWUVnXZXKTwlp/zs9j177OSQ4CVU9L6HnWQ6in+stlTouHR9u8 WJabIeCNRf8rtLZMEyeYuLbLg+xeHk5gk/LmcOHxORElhNUBqXr5QymMRiotYCnJ9cn2 1yxw== 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=6ADxf+HmdLYeFPYpvR8qK5BuVUCzcTs7gEzFunCn0YY=; b=fsYu2xiAWu2y75IKyxKu58jTDotRvOSWZE0fqzdvmTx5DT+kOttZTonVU2yvuz932x UMfx/MO/uzhjJ/6L/3gZIjhgtNi/D5EgnQFmkQmtVgrlpBl+K74DhH5zerzDvbtannLP Z3vIHG+CUW+O5HvHsPXFwzifCfKvlAWTh2K45hPkDsS0IQdlfZRNJwMnzrVTsqA6CTwz jRShUDHSrKmNf1KCTcXcKTP8JR6HO+qS6qZksFWhJ2TLUfa/r6nePad7PIERjS+jLPon oSznOW8jrm4mnpLf+WBgLF3qsJhyjdA6jNKNmEaiePv2rkZA/8cBfmYk+3eun6BgbtTc 37NQ== X-Gm-Message-State: AHYfb5ihT/xltS6u5FFZppHxldD9umYX7x4wJ+UF65S+qmjySf9yKdmB u+jY7cUh2DZlLb315QVpag== X-Received: by 10.99.94.66 with SMTP id s63mr16543313pgb.253.1503308228908; Mon, 21 Aug 2017 02:37:08 -0700 (PDT) Received: from localhost.localdomain ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id 69sm23355087pfh.186.2017.08.21.02.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Aug 2017 02:37:07 -0700 (PDT) From: Yuanhan Liu To: Gowrishankar Muthukrishnan Cc: Nelio Laranjeiro , dpdk stable , Yuanhan Liu Date: Mon, 21 Aug 2017 17:31:01 +0800 Message-Id: <1503307878-16728-47-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503307878-16728-1-git-send-email-yliu@fridaylinux.org> References: <1503307878-16728-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/mlx5: fix inconsistent link status query' has been queued to stable release 17.05.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 09:37:10 -0000 Hi, FYI, your patch has been queued to stable release 17.05.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 74df3a1d5a0e540a0c75c44ebbb1c7b38d348521 Mon Sep 17 00:00:00 2001 From: Gowrishankar Muthukrishnan Date: Tue, 25 Jul 2017 19:08:07 +0530 Subject: [PATCH] net/mlx5: fix inconsistent link status query [ upstream commit ef09a7fc762073d9980b93bbd6fcf83e6e6b4abf ] ETHTOOL_GLINKSETTINGS ioctl call in mlx5 pmd returns inconsistent link status due to which any application relying on it would not function correctly. Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds") Signed-off-by: Gowrishankar Muthukrishnan Acked-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_ethdev.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 3fd22cb..27ec3ef 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -119,6 +119,7 @@ struct ethtool_link_settings { #define ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT 38 #define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39 #endif +#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 (SCHAR_MAX) /** * Return private structure associated with an Ethernet device. @@ -806,9 +807,12 @@ static int mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) { struct priv *priv = mlx5_get_priv(dev); - struct ethtool_link_settings edata = { - .cmd = ETHTOOL_GLINKSETTINGS, - }; + __extension__ struct { + struct ethtool_link_settings edata; + uint32_t link_mode_data[3 * + ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32]; + } ecmd; + struct ifreq ifr; struct rte_eth_link dev_link; uint64_t sc; @@ -821,15 +825,23 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) memset(&dev_link, 0, sizeof(dev_link)); dev_link.link_status = ((ifr.ifr_flags & IFF_UP) && (ifr.ifr_flags & IFF_RUNNING)); - ifr.ifr_data = (void *)&edata; + memset(&ecmd, 0, sizeof(ecmd)); + ecmd.edata.cmd = ETHTOOL_GLINKSETTINGS; + ifr.ifr_data = (void *)&ecmd; if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) { DEBUG("ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS) failed: %s", strerror(errno)); return -1; } - dev_link.link_speed = edata.speed; - sc = edata.link_mode_masks[0] | - ((uint64_t)edata.link_mode_masks[1] << 32); + ecmd.edata.link_mode_masks_nwords = -ecmd.edata.link_mode_masks_nwords; + if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) { + DEBUG("ioctl(SIOCETHTOOL, ETHTOOL_GLINKSETTINGS) failed: %s", + strerror(errno)); + return -1; + } + dev_link.link_speed = ecmd.edata.speed; + sc = ecmd.edata.link_mode_masks[0] | + ((uint64_t)ecmd.edata.link_mode_masks[1] << 32); priv->link_speed_capa = 0; if (sc & ETHTOOL_LINK_MODE_Autoneg_BIT) priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG; @@ -865,7 +877,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT | ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT)) priv->link_speed_capa |= ETH_LINK_SPEED_100G; - dev_link.link_duplex = ((edata.duplex == DUPLEX_HALF) ? + dev_link.link_duplex = ((ecmd.edata.duplex == DUPLEX_HALF) ? ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX); dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); -- 2.7.4