From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6820D20BD for ; Thu, 21 Feb 2019 03:30:57 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2019 18:30:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,393,1544515200"; d="scan'208";a="140320516" Received: from pgsmsx114.gar.corp.intel.com ([10.108.55.203]) by orsmga001.jf.intel.com with ESMTP; 20 Feb 2019 18:30:54 -0800 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.6]) by pgsmsx114.gar.corp.intel.com ([169.254.4.96]) with mapi id 14.03.0415.000; Thu, 21 Feb 2019 10:30:53 +0800 From: "Zhao1, Wei" To: Julien Meunier , "Zhang, Qi Z" , "Lu, Wenzhuo" , "Ananyev, Konstantin" CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 2/2] net/ixgbe: add support of loopback for X540/X550 Thread-Index: AQHUyWARmvHNFfiI30WNnGPXeZ82sKXpiCFA Date: Thu, 21 Feb 2019 02:30:53 +0000 Message-ID: References: <20190102160055.30301-1-julien.meunier@nokia.com> <20190220210531.48322-1-julien.meunier@nokia.com> <20190220210531.48322-2-julien.meunier@nokia.com> In-Reply-To: <20190220210531.48322-2-julien.meunier@nokia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 2/2] 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: Thu, 21 Feb 2019 02:30:58 -0000 Acked-by: Wei Zhao > -----Original Message----- > From: Julien Meunier [mailto:julien.meunier@nokia.com] > Sent: Thursday, February 21, 2019 5:06 AM > To: Zhao1, Wei ; Zhang, Qi Z ; > Lu, Wenzhuo ; Ananyev, Konstantin > > Cc: dev@dpdk.org > Subject: [PATCH v3 2/2] net/ixgbe: add support of loopback for X540/X550 >=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. >=20 > Signed-off-by: Julien Meunier > --- > v3: > - reorganize and merge common code > - restore MACC_FLU on stop > v2: > - disable / enable autoneg when loopback is requested for X540 / X550 > --- > drivers/net/ixgbe/ixgbe_ethdev.h | 7 +++--- > drivers/net/ixgbe/ixgbe_rxtx.c | 53 > ++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 55 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > b/drivers/net/ixgbe/ixgbe_ethdev.h > index 565c69c..99a5077 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -65,9 +65,10 @@ > #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 > disabled. */ > -#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. > +*/ > +/* X540-X550 specific loopback operations */ > +#define IXGBE_MII_AUTONEG_ENABLE 0x1000 /* Auto-negociation > enable (default =3D 1) */ >=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 c9a70a8..e92a70f 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -3168,12 +3168,44 @@ ixgbe_dev_tx_descriptor_status(void *tx_queue, > uint16_t offset) > return RTE_ETH_TX_DESC_FULL; > } >=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, bool enable) > { > + uint32_t macc; > + PMD_INIT_FUNC_TRACE(); > + > + u16 autoneg_reg =3D IXGBE_MII_AUTONEG_REG; > + > + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, > + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, > &autoneg_reg); > + macc =3D IXGBE_READ_REG(hw, IXGBE_MACC); > + > + if (enable) { > + /* datasheet 15.2.1: disable AUTONEG (PHY Bit 7.0.C) */ > + autoneg_reg |=3D IXGBE_MII_AUTONEG_ENABLE; > + /* datasheet 15.2.1: MACC.FLU =3D 1 (force link up) */ > + macc |=3D IXGBE_MACC_FLU; > + } else { > + autoneg_reg &=3D ~IXGBE_MII_AUTONEG_ENABLE; > + macc &=3D ~IXGBE_MACC_FLU; > + } > + > + hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, > + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, > autoneg_reg); > + > + IXGBE_WRITE_REG(hw, IXGBE_MACC, macc); } > + > void __attribute__((cold)) > ixgbe_dev_clear_queues(struct rte_eth_dev *dev) { > unsigned i; > struct ixgbe_adapter *adapter =3D > (struct ixgbe_adapter *)dev->data->dev_private; > + struct ixgbe_hw *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); >=20 > PMD_INIT_FUNC_TRACE(); >=20 > @@ -3194,6 +3226,14 @@ ixgbe_dev_clear_queues(struct rte_eth_dev > *dev) > ixgbe_reset_rx_queue(adapter, rxq); > } > } > + /* If loopback mode was enabled, reconfigure the link accordingly */ > + if (dev->data->dev_conf.lpbk_mode !=3D 0) { > + 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, false); > + } > } >=20 > void > @@ -5074,8 +5114,12 @@ ixgbe_check_supported_loopback_mode(struct > rte_eth_dev *dev) { > struct ixgbe_hw *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); >=20 > - if (dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_82599_TX_RX) > - if (hw->mac.type =3D=3D ixgbe_mac_82599EB) > + if (dev->data->dev_conf.lpbk_mode =3D=3D IXGBE_LPBK_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) > return 0; >=20 > return -ENOTSUP; > @@ -5172,6 +5216,11 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) > if (dev->data->dev_conf.lpbk_mode !=3D 0) { > 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, true); > } >=20 > #ifdef RTE_LIBRTE_SECURITY > -- > 2.10.2