From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f175.google.com (mail-pf0-f175.google.com [209.85.192.175]) by dpdk.org (Postfix) with ESMTP id C2C5C2B9D for ; Wed, 9 Aug 2017 05:47:06 +0200 (CEST) Received: by mail-pf0-f175.google.com with SMTP id c28so22520520pfe.3 for ; Tue, 08 Aug 2017 20:47:06 -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=QVOXGZ6u0PcpOVCGj6u3gH1xfiOMthBaBROpoPQqvRM=; b=ePaa9N2zp2oiCOigQMseDsCpHYGNb4Fp+gjFoLKr82LSi4guUq8MvRFDWHwK7PB4hE OMZDvoiWKddfnr7ObTJ6hbh1vknBqiAgmV8GjJznCn9cq3TNeCVq5+MIS8nVo6puVRKj PxPwricjp39SKgMo+yW83A+w9/SMtvVbu7bVKHrPyvVG2WoB7LWYeUe9pNdnwYjFX/Yn 8FkgEst0mA7o0QChWPvkGF2bzOwcIC1hCCdPuSRSxL89yHZXHhrmoQOi5sHu8gFv25qL rudC61bheX5Nof8cza5k8Wnu6VxjHY9KT2peIvIsFbK04Fc7AKJJ9kveQdK267/uQcSu gtcA== 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=QVOXGZ6u0PcpOVCGj6u3gH1xfiOMthBaBROpoPQqvRM=; b=kE8zgTj6yN+UW7TiethhB8HdivrpDZVrghdQ4iDAw8PFWwecMj0b9TWLOzfHDkbfh5 wA24KbuzNd9zsakQMNx+OIgTQEoXGJaaQWAb0p9Ica68RwUuMMV1+niUA49EG+342KW3 BIBOpeI1jrzSh5Raj+yg31CKjluh0e6F6QN7QNKeyZGZxHq5NVUZPxiTCPkd9JbaWNEv 8PInXhLrb5ODEfdkBJmpzoK6H7Hc6QX2iUGumMnU0bCvj1z2x26hquzoStG3OS8BaO7G 5mD7aHfKuz6QOKl4IwJR/V6jCloO7IVGNWAFwtfIlbxO1dpWwA0k7fdQyky3FnC8kUW9 vRKw== X-Gm-Message-State: AHYfb5j8+XgIANW/y55KiX3/SKb2iDfJ5Yi2sBIWUkQj3wqrgNrd9zvG WSrmhDqB9zn19wuqqGpEpA== X-Received: by 10.98.198.145 with SMTP id x17mr6852473pfk.272.1502250425641; Tue, 08 Aug 2017 20:47:05 -0700 (PDT) Received: from localhost.localdomain ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id q3sm5093921pfl.89.2017.08.08.20.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Aug 2017 20:47:04 -0700 (PDT) From: Yuanhan Liu To: Gowrishankar Muthukrishnan Cc: Nelio Laranjeiro , dpdk stable , Yuanhan Liu Date: Wed, 9 Aug 2017 11:43:50 +0800 Message-Id: <1502250240-6599-8-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502250240-6599-1-git-send-email-yliu@fridaylinux.org> References: <1502250240-6599-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/mlx5: fix inconsistent link status query' has been queued to LTS release 16.11.3 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: Wed, 09 Aug 2017 03:47:07 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.3 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/11/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 2c98d1a61318b9b52e9975aa68fc2d676582cf27 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 0aa274e..ca981a5 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. @@ -754,9 +755,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; @@ -769,15 +773,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; @@ -813,7 +825,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