From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 232781B463 for ; Mon, 7 Jan 2019 07:53:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jan 2019 22:53:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,450,1539673200"; d="scan'208";a="123829347" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 06 Jan 2019 22:53:46 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 6 Jan 2019 22:53:46 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 6 Jan 2019 22:53:45 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.150]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.160]) with mapi id 14.03.0415.000; Mon, 7 Jan 2019 14:53:43 +0800 From: "Zhang, Qi Z" To: Julien Meunier , "Ananyev, Konstantin" , "Lu, Wenzhuo" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: add support of loopback for X540/X550 Thread-Index: AQHUorRw+EcoZrYRZkqgxnEKm2mhi6WjVbtQ Date: Mon, 7 Jan 2019 06:53:43 +0000 Message-ID: <039ED4275CED7440929022BC67E70611533167EC@SHSMSX103.ccr.corp.intel.com> References: <20190102160055.30301-1-julien.meunier@nokia.com> In-Reply-To: <20190102160055.30301-1-julien.meunier@nokia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmEyMmIzYjAtYWI0Yy00MDNiLWJmZDItZTVlYWRmMmUyNjc2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaWFicFVaMmh6VmxXZmo1b2hZMU94aEFGNmpjTFIzQ3N0dlpQSVI0QVwvV2FWWCs3bENlcGhwSERcL3lxQzNycU5ZIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: add support of loopback for X540/X550 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: Mon, 07 Jan 2019 06:53:47 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Julien Meunier > Sent: Thursday, January 3, 2019 12:01 AM > To: Ananyev, Konstantin ; Lu, Wenzhuo > > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] net/ixgbe: add support of loopback for X540/X= 550 >=20 > Loopback mode is also supported on X540 and X550 NICs, according to their > datasheet (section 15.2). The way to set it up is a little different of t= he 82599. Thanks for enable this. one question is, Datasheet also mentioned that auto negotiation should be d= isabled but I didn't see any related change with it. Would you share more insight on this? >=20 > Signed-off-by: Julien Meunier > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++++++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 5 ++--- > drivers/net/ixgbe/ixgbe_rxtx.c | 47 > ++++++++++++++++++++++++++++++++++------ > 3 files changed, 49 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > b/drivers/net/ixgbe/ixgbe_ethdev.c > index 7493110..7eb3303 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -2652,9 +2652,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev) > goto error; > } >=20 > - /* Skip link setup if loopback mode is enabled for 82599. */ > - if (hw->mac.type =3D=3D ixgbe_mac_82599EB && > - dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_82599_TX_RX) > + /* Skip link setup if loopback mode is enabled. */ > + if ((hw->mac.type =3D=3D ixgbe_mac_82599EB || > + hw->mac.type =3D=3D ixgbe_mac_X540 || > + hw->mac.type =3D=3D ixgbe_mac_X550 || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_x || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_a) && > + dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_TX_RX) > goto skip_link_setup; >=20 > if (ixgbe_is_sfp(hw) && hw->phy.multispeed_fiber) { diff --git > a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h > index 565c69c..c60a697 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -65,9 +65,8 @@ > #define IXGBE_QUEUE_ITR_INTERVAL_DEFAULT 500 /* 500us */ >=20 > /* Loopback operation modes */ > -/* 82599 specific loopback operation types */ > -#define IXGBE_LPBK_82599_NONE 0x0 /* Default value. Loopback is disabl= ed. > */ > -#define IXGBE_LPBK_82599_TX_RX 0x1 /* Tx->Rx loopback operation is > enabled. */ > +#define IXGBE_LPBK_NONE 0x0 /* Default value. Loopback is disabled. */ > +#define IXGBE_LPBK_TX_RX 0x1 /* Tx->Rx loopback operation is enabled. > +*/ >=20 > #define IXGBE_MAX_JUMBO_FRAME_SIZE 0x2600 /* Maximum Jumbo > frame size. */ >=20 > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxt= x.c > index 9a79d18..0ef7fdf 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -4879,10 +4879,14 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) > hlreg0 &=3D ~IXGBE_HLREG0_JUMBOEN; >=20 > /* > - * If loopback mode is configured for 82599, set LPBK bit. > + * If loopback mode is configured, set LPBK bit. > */ > - if (hw->mac.type =3D=3D ixgbe_mac_82599EB && > - dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_82599_TX_RX) > + if ((hw->mac.type =3D=3D ixgbe_mac_82599EB || > + hw->mac.type =3D=3D ixgbe_mac_X540 || > + hw->mac.type =3D=3D ixgbe_mac_X550 || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_x || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_a) && > + dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_TX_RX) > hlreg0 |=3D IXGBE_HLREG0_LPBK; > else > hlreg0 &=3D ~IXGBE_HLREG0_LPBK; > @@ -5088,6 +5092,29 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw > *hw) > msec_delay(50); > } >=20 > +/* > + * Set up link loopback for X540 / X550 mode Tx->Rx. > + */ > +static inline void __attribute__((cold)) > +ixgbe_setup_loopback_link_x540_x550(struct ixgbe_hw *hw) { > + uint32_t macc; > + PMD_INIT_FUNC_TRACE(); > + > + /* datasheet 15.2.1: MACC.FLU =3D 1 (force link up) */ > + macc =3D IXGBE_READ_REG(hw, IXGBE_MACC); > + macc |=3D IXGBE_MACC_FLU; > + IXGBE_WRITE_REG(hw, IXGBE_MACC, macc); > + > + /* Restart link */ > + IXGBE_WRITE_REG(hw, > + IXGBE_AUTOC, > + IXGBE_AUTOC_LMS_10G_LINK_NO_AN | IXGBE_AUTOC_FLU); > + > + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); > + msec_delay(50); > +} > + >=20 > /* > * Start Transmit and Receive Units. > @@ -5148,10 +5175,16 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) > rxctrl |=3D IXGBE_RXCTRL_RXEN; > hw->mac.ops.enable_rx_dma(hw, rxctrl); >=20 > - /* If loopback mode is enabled for 82599, set up the link accordingly *= / > - if (hw->mac.type =3D=3D ixgbe_mac_82599EB && > - dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_82599_TX_RX) > - ixgbe_setup_loopback_link_82599(hw); > + /* If loopback mode is enabled, set up the link accordingly */ > + if (dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_TX_RX) { > + if (hw->mac.type =3D=3D ixgbe_mac_82599EB) > + ixgbe_setup_loopback_link_82599(hw); > + else if (hw->mac.type =3D=3D ixgbe_mac_X540 || > + hw->mac.type =3D=3D ixgbe_mac_X550 || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_x || > + hw->mac.type =3D=3D ixgbe_mac_X550EM_a) > + ixgbe_setup_loopback_link_x540_x550(hw); > + } >=20 > #ifdef RTE_LIBRTE_SECURITY > if ((dev->data->dev_conf.rxmode.offloads & > -- > 2.10.2