From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by dpdk.org (Postfix) with ESMTP id C26B529CB for ; Thu, 3 Nov 2016 01:24:31 +0100 (CET) Received: by mail-pf0-f182.google.com with SMTP id d2so20518367pfd.0 for ; Wed, 02 Nov 2016 17:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=versa-networks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=rvvve7qfkgTWfd/ik8q6PcO/3bgcbABF0IbJORGIKc8=; b=omvvqDIFXGFinAvY9+nf7BgBKOBbYc0wCJfywGvF5/tirCIuj8GtV+HNl0pavyQP9J 0b5QBaTvv2f/0sgu8Eb20WEq7maBixA+WuJIrZNXQsWK3csF+wwQkUlmmgs936yolpec R1IeXk1z4ZmFAdTvFajmYdWgVlUJeKYiJBlG0Nx/DozwjTqnXWtNoFHvZVrP27zJjQKh sM5/3YcLh+ZPXdxwwaHJ93PGgeVqfmTcbnE6Pu6+2X3LlipjCJcAdeDpBrnfwwyjwaIs Bhbb7xMcEO0c20LLHZNhdNUWO1JELlvtPicSDIufBKK5g8Sxb5BUgt4Hq3pQe9N+Ky9S I/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rvvve7qfkgTWfd/ik8q6PcO/3bgcbABF0IbJORGIKc8=; b=hGhx1kShWcQHwM88Mo63bwJzn5MKyWX8Zp4B9L+ahBPfBeVD8mZu3LEx/37XXJzAls sFQrkSMG9BQVG4dHUlr8CNI53TJuSD7J/m4XvOGLH1TyqbOiBpl32VJw6VpTbxDVQtvG B9yEMPTsuvIYsBT5FsRybzWSd6unP36z2+FBVOzl/JkU0DT3b35qpapGlhSFGtB8i4SU /H8Ad45G21fJ1OPPY3WzbYHJWbcn2o1zOGT75oqZBHHY8H3RDQ2itstd0Kj+ZUGv2B+H oZRDyRoCQ+Kw7wtk/scetcrQp9Yom+AxzrCgsi1EuqgOe/Ou96ZQj/rYID7mQ0fyvOeW tMjg== X-Gm-Message-State: ABUngvcY/RsXU1joeVHw3eSC/DokGnBycvhXbVma5McYdzjiRgkgHY1V0msUF+YMKP1FYsM6 X-Received: by 10.98.79.193 with SMTP id f62mr11692468pfj.149.1478132670453; Wed, 02 Nov 2016 17:24:30 -0700 (PDT) Received: from ananda-linux.versa-networks.com (70-35-56-62.static.wiline.com. [70.35.56.62]) by smtp.gmail.com with ESMTPSA id qy2sm7401344pab.27.2016.11.02.17.24.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Nov 2016 17:24:29 -0700 (PDT) From: Ananda Sathyanarayana To: wenzhuo.lu@intel.com Date: Wed, 2 Nov 2016 16:36:55 -0700 Message-Id: <1478129815-241504-1-git-send-email-ananda@versa-networks.com> X-Mailer: git-send-email 1.9.1 Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2] E1000: fix for forced speed/duplex config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 00:24:32 -0000 Fixed the formating/syntax issues reported >>From the code, it looks like, hw->mac.autoneg, variable is used to switch between calling either autoneg function or forcing speed/duplex function. But this variable is not modified in eth_em_start/eth_igb_start routines (it is always set to 1) even while forcing the link speed. Following discussion thread has some more information on this http://dpdk.org/ml/archives/dev/2016-October/049272.html Signed-off-by: Ananda Sathyanarayana --- drivers/net/e1000/em_ethdev.c | 12 ++++++++++++ drivers/net/e1000/igb_ethdev.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 7cf5f0c..aee3d34 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -639,6 +639,7 @@ eth_em_start(struct rte_eth_dev *dev) speeds = &dev->data->dev_conf.link_speeds; if (*speeds == ETH_LINK_SPEED_AUTONEG) { hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX; + hw->mac.autoneg = 1; } else { num_speeds = 0; autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0; @@ -674,6 +675,17 @@ eth_em_start(struct rte_eth_dev *dev) } if (num_speeds == 0 || (!autoneg && (num_speeds > 1))) goto error_invalid_config; + + /* Set/reset the mac.autoneg based on the link speed, + * fixed or not + */ + if (!autoneg) { + hw->mac.autoneg = 0; + hw->mac.forced_speed_duplex = + hw->phy.autoneg_advertised; + } else { + hw->mac.autoneg = 1; + } } e1000_setup_link(hw); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 4924396..2fddf0c 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1327,6 +1327,7 @@ eth_igb_start(struct rte_eth_dev *dev) speeds = &dev->data->dev_conf.link_speeds; if (*speeds == ETH_LINK_SPEED_AUTONEG) { hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX; + hw->mac.autoneg = 1; } else { num_speeds = 0; autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0; @@ -1362,6 +1363,17 @@ eth_igb_start(struct rte_eth_dev *dev) } if (num_speeds == 0 || (!autoneg && (num_speeds > 1))) goto error_invalid_config; + + /* Set/reset the mac.autoneg based on the link speed, + * fixed or not + */ + if (!autoneg) { + hw->mac.autoneg = 0; + hw->mac.forced_speed_duplex = + hw->phy.autoneg_advertised; + } else { + hw->mac.autoneg = 1; + } } e1000_setup_link(hw); -- 1.9.1