From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <mcooper@hexiscyber.com>
Received: from mail.keywcorp.com (mail.keywcorp.com [63.138.81.90])
 by dpdk.org (Postfix) with ESMTP id 4BBD958DD
 for <dev@dpdk.org>; Thu,  8 Jan 2015 17:25:46 +0100 (CET)
From: "Marc E. Cooper" <mcooper@hexiscyber.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: Port link speed and link duplex always set to auto-negotiate &
 manual link speed configuration of 100Mb link speed not possible
Thread-Index: AQHQK188a+tV0NV7TU62VoEuqWgYwpy2aMWA
Date: Thu, 8 Jan 2015 16:26:29 +0000
Message-ID: <D0D41902.3938%mcooper@hexiscyber.com>
References: <D0D418B0.3935%mcooper@hexiscyber.com>
In-Reply-To: <D0D418B0.3935%mcooper@hexiscyber.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Content-Type: text/plain; charset="iso-8859-1"
Content-ID: <EFC431E048E35B47B3E1C78B856BE541@keywcorp.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: [dpdk-dev] Port link speed and link duplex always set to
 auto-negotiate & manual link speed configuration of 100Mb link speed not
 possible
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Jan 2015 16:25:46 -0000

I believe there are defects in the code supporting manual configuration of
port link speed and link duplex to values other than auto-negotiate.  The
TESTPMD application from DPDK version 1.8.0 was executed on 2 different
systems having 4x1G NICs with the following Ethernet controllers:

* Intel Corporation 82576 Gigabit Network Connection (rev 01)
* Intel Corporation I350 Gigabit Network Connection (rev 01)

There appears to be two issues in the code:

* "hw->mac.autoneg=B2 is always set to true (1).  The force speed and duple=
x
code path is not followed.
* "hw->mac.forced_speed_duplex" is never set.  A forced link speed
configuration will always default to 10Mb regardless of whether configured
for 100Mb or 10Mb.  For example, e1000_phy_force_speed_duplex_setup() will
always configure link speed to 10mb since it checks for the following
condition "if (mac->forced_speed_duplex & E1000_ALL_100_SPEED)=B2.

Changes are needed within =B3igb_ethdev.c=B2 and =B3em_ethdev.c=B2 within
=B3lib/librte_pmd_e1000=B2.  The switch statements that setup link speed an=
d
link duplex within these files need to manually set "hw->mac.autoneg" and
"hw->mac.forced_speed_duplex" as shown below:

[root@box librte_pmd_e1000]# pwd
/home/marc/dpdk/dpdk-1.8.0/lib/librte_pmd_e1000
[root@box librte_pmd_e1000]# diff  -p igb_ethdev.c.orig igb_ethdev.c
*** igb_ethdev.c.orig	2015-01-08 09:59:52.937215791 -0500
--- igb_ethdev.c	2015-01-08 10:01:44.073730592 -0500
*************** eth_igb_start(struct rte_eth_dev *dev)
*** 871,876 ****
--- 871,878 ----
  			hw->phy.autoneg_advertised =3D ADVERTISE_10_FULL;
  		else
  			goto error_invalid_config;
+               hw->mac.autoneg =3D 0;
+               hw->mac.forced_speed_duplex |=3D hw->phy.autoneg_advertised=
;
  		break;
  	case ETH_LINK_SPEED_100:
  		if (dev->data->dev_conf.link_duplex =3D=3D ETH_LINK_AUTONEG_DUPLEX)
*************** eth_igb_start(struct rte_eth_dev *dev)
*** 881,886 ****
--- 883,890 ----
  			hw->phy.autoneg_advertised =3D ADVERTISE_100_FULL;
  		else
  			goto error_invalid_config;
+               hw->mac.autoneg =3D 0;
+               hw->mac.forced_speed_duplex |=3D hw->phy.autoneg_advertised=
;
  		break;
  	case ETH_LINK_SPEED_1000:
  		if ((dev->data->dev_conf.link_duplex =3D=3D ETH_LINK_AUTONEG_DUPLEX) ||
*************** eth_igb_start(struct rte_eth_dev *dev)
*** 888,893 ****
--- 892,899 ----
  			hw->phy.autoneg_advertised =3D ADVERTISE_1000_FULL;
  		else
  			goto error_invalid_config;
+               hw->mac.autoneg =3D 0;
+               hw->mac.forced_speed_duplex |=3D hw->phy.autoneg_advertised=
;
  		break;
  	case ETH_LINK_SPEED_10000:
  	default:
[root@box librte_pmd_e1000]#


After only setting hw->mac.autoneg =3D 0 in the switch statement cases
described above I experimented with configuring the peer (switch) ports
for 100Mb full duplex.  Within TESTPMD the ports were also configured for
100Mb full duplex using =B3port config all speed 100 duplex full=B2.  The
links failed to establish.  I enabled debug statements within
=B3e1000_phy_force_speed_duplex_setup()=B2 found in
=B3lib/librte_pmd_e1000/e1000/e1000_phy.c=B2 to display whether 100mb or 10=
mb
was being forced.  It was observed that 10Mb was being forced when the
link speed was manually configured for 100Mb.  Setting
=B3hw->mac.force_speed_duplex=B2 as shown above seemed to resolve this issu=
e
and the links came up.
=20

Are these known issues?

-Marc