From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150123.outbound.protection.outlook.com [40.107.15.123]) by dpdk.org (Postfix) with ESMTP id 448E51B736 for ; Thu, 7 Feb 2019 18:30:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ykIW7hk8qt4VnwHl3y4Jxceh0CobbAfuKXMp+TvVyZI=; b=mFBjCoDAgM8U9MLEAWbx5F71tADP3itc0nHf4zdt83pa0H/mVDxggCj28pdcBKiu7Ayi5oovnYgojKlHP4ztSU+AM5aI8duU1hNy50qdMvl4+9NblbZKENlJ7YMCSvkP1m3fwsNjIfzhF7pa+Lo4VCBgujv/2GKbWn5zPEA07H0= Received: from DB6PR07CA0009.eurprd07.prod.outlook.com (2603:10a6:6:2d::19) by DB6PR0701MB2840.eurprd07.prod.outlook.com (2603:10a6:4:70::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.14; Thu, 7 Feb 2019 17:30:38 +0000 Received: from AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by DB6PR07CA0009.outlook.office365.com (2603:10a6:6:2d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.11 via Frontend Transport; Thu, 7 Feb 2019 17:30:38 +0000 Authentication-Results: spf=pass (sender IP is 131.228.2.240) smtp.mailfrom=nokia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by AM5EUR03FT058.mail.protection.outlook.com (10.152.17.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17 via Frontend Transport; Thu, 7 Feb 2019 17:30:37 +0000 Received: from lfs-up-04.localdomain ([10.157.84.234]) by fihe3nok0734.emea.nsn-net.net (GMO) with ESMTP id x17HUbKp008870; Thu, 7 Feb 2019 17:30:37 GMT Received: by lfs-up-04.localdomain (Postfix, from userid 62146483) id 22051673B; Thu, 7 Feb 2019 19:30:37 +0200 (EET) From: Julien Meunier To: , , , CC: Date: Thu, 7 Feb 2019 19:30:05 +0200 Message-ID: <20190207173005.38372-2-julien.meunier@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20190207173005.38372-1-julien.meunier@nokia.com> References: <20190102160055.30301-1-julien.meunier@nokia.com> <20190207173005.38372-1-julien.meunier@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:CAL; SCL:-1; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(136003)(376002)(396003)(346002)(39860400002)(2980300002)(3190300001)(189003)(199004)(14444005)(26005)(68736007)(186003)(106002)(53936002)(336012)(47776003)(8936002)(42186006)(51416003)(86362001)(6266002)(1076003)(52956003)(478600001)(26826003)(76176011)(48376002)(4326008)(6666004)(356004)(2201001)(50466002)(305945005)(110136005)(8676002)(316002)(106466001)(81166006)(36756003)(486006)(16586007)(81156014)(103686004)(50226002)(2616005)(476003)(126002)(44832011)(446003)(97736004)(2906002)(11346002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB2840; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; AM5EUR03FT058; 1:Smdh1kwDh7cLuS0bPCinZYuPYFzMHPQ/89ZJL+kZVrFUhPZNVQaFSsnDRO/ye+7B3W1A++buGJ696lbwhWcgsFT8KABhj+pL+9L6YZr9wi7ieUGFXtdmZwXYKKlQZgZpsalBjE60BXwCMVRiaqoXIJn4J9Fd20JHXut1v+i1lik= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77cf376a-e993-4f34-d467-08d68d21f9a2 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4608076)(4709027)(2017052603328); SRVR:DB6PR0701MB2840; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2840; 3:zoEsMUOZDjTwi21/OpP4O7/MtllTR6+SLnBX9QQYOpehlQrPIkIg9SQIJF2mGRfDIEt9poQ6etZREvkLJhJ3by2ZqZvttdWh4iIjrDfAL9A2t2fazVW9dMkTnUFR6Fd1QwbwhmBvSzd2jx00XUT2D2szNaO74qCI/8AOKoTVCHFXqM2PREZhxQJ+o9i4W+bcKWmpxty2MsvUMv0x2DaaJaEgb+Mv5XqYCGiUTMRPovaVtFQ6MR8sLTYl9/Y4vsc2qBrsu3v0fBpVktsvG0rNAUqvhbrkb4TxqdSEhIxvqN5dDsBhuyAYfOiFZJ8zR3FsS9jp11iBezgJvK2stSUgoPBGmMI57eWh9JI2FKLNUe/koCqO+K5hEKXerBaye4l7; 25:l5qHSqiMxErLIiU690Ncxf1VqmwmXuQQDJeWu8N8/pO9us/2XxEgAqwyoeQzMlXFauOS9LztDieA1UaL8nIgW4b1emxuh7U35dqSSi42tmwCS0DcFdO751A+qjK+2yzPRhQCz89kSM1EOe1DiY0D8pcw1EO0UsfW+8n0Bbl86JNfCXCEc3ivM1++s48oSr/HSf4phH/ZwuWo1JHSCQqDkpxkJS5doigP7k8vwl/ntrqcTvdayAQbIW/tWoQAvpYumDfYl0WHYRwTnJW9mu5rF4blhByJTtBJX368afZV2gu/MwqI7MLJtTXnI7MSTauEY9gIhPsYDstPtglDRCtwew== X-MS-TrafficTypeDiagnostic: DB6PR0701MB2840: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2840; 31:VE96waZoWj4wXYVt0ZSnvMjEzaHETNACueRAZBXpUQakT+c+BOdMik22FQ+r9TaKqJnSanZKuZie1Zbw4IFJyqahaAuoxDYl4Wc3/vnxmu/GBZ9WALHH9z9p04gtcFUq7+FcOihFpTFnMU0zYIwuFjRt/ILE5mF8I9GfzJKR0zCuJeyC6ebJ50B9ovvsuemvFYyfUjm2bKQ2pPUeYen1onq8ulyzeKOwRG3djCB8vdY=; 20:30Kh6Cie/cmtprk6K5urb4xZUOQQZpHYimkuD/fGK8XB1DXQl6rloBxs4lROGySP+ROamgfuNo4+oxkMqvMj0IMDmfeftywZJeiAABHtzEw/H0I473AD9KIzQx6hmUV98BZoUK5QQ70+O78Qpw27C8M6tvsmMLQ2HIrhwXc9oEJ4ePofmO/JOaQWFJxxH4vilWHDMK2OVAUOMHL2pW6o505IaGKGCYHn1sT8BHplOF3gUZgUgSY8r5wcIokSoWJtS6sKFNXv4rXsOuJ22WEp/YOUxloGx8T99xwBGPRUesxlKaZFNxpjanUQkEh4WOFTQY8jbV6+Dpmw1VtrO4d27WQ4SOPPyWIgpVspsqk9YDfSA6UtNx8kejzebFXP2e3/QP0E1Lb4esPkYVOqqzPEAJAYU2LMzb069kIBHCCv62VLUuW5AMQryVgRgPDIB/XgxG4V1RlrqBih2oUXUiePzzRKxCb3KgrJJuNGwXL8fxu7b3fDZreMC1XYaHm/SBJ868pgiDXW00JCOZBmj84SnxswB6a/BhLg307rTMnmAQEHqzU9tYMWJ6re7s//0ojbNh18/yRl5Lm74erkq9mgghPStySeXPZeFBWmO9VFrw0= X-Microsoft-Antispam-PRVS: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2840; 4:I3CWXAtqozAsT1zppdq25O1ve0dP08uev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J9wQMS2xZYWRpT6jsjCyClCkfLGZiev4oDA5Mou2eypIe8?= =?us-ascii?Q?iGUmwLI8wGuzeaDN79TKhEXTZ2q8gTSk3R0ExGY7RkTJSFEZWMivPE+g0Oqc?= =?us-ascii?Q?sqB32Bu6U2Ie/ywfO22QM6ZkLZ+Dt80h5LLacF8Gr39JQYIuriGb6Njn1pbV?= =?us-ascii?Q?SMPIyPQ1aIsww+89obdJaEVjbMY9d3MO8fgExr2FKeE2+Cmh3jSsIIFNZNs6?= =?us-ascii?Q?pYW5RDREpIXDbjbrGa+s0Rj2Ei4Pduo8fO94OOK4N/ImBSwM+ppXFARSO3nu?= =?us-ascii?Q?vjruiUphvIBdh8inD9bWnFf0A8V05YmHqpufCqLbOy+jM9WiXjt1TGZZgXP9?= =?us-ascii?Q?ZX4VdQnCIWiokvE1EGzddOlV90CWRlME3d92dwaCSIWFupRduA9HBUX6C188?= =?us-ascii?Q?Mr0E7xsy/P3YwKlCi1FaGAMxZRGwDz5Ps2XSN8pCsXqvlZ4Kw2bbNZNM4H+s?= =?us-ascii?Q?n5/OpDCodjwplJ5+BXyJF8MB02heCevd3zMfi7xp3pe5gU8L6qVRcGG8LHh4?= =?us-ascii?Q?RrO7l0af+oYTVx0UWTqsXUnQ28/or+EEdyosw1E4CvGY+RqDRfIuhlA=3D?= =?us-ascii?Q?=3D?= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 5swnXQPeMApk1CxnOJrPl5ZOoTWindWG5N9V0eyXdoYHUqDpz2zWQ3Kumov79IC1ad0xKadTJCP6CpWnFKHHAZOAXsyO0UevyuH4qVr6OzLZtBnmBJFBarALDBLrSHI8TOxd2XSEm5e8XGaZsGsFVX++YuTtKH8t0j53WlR/34A6QDEf4G28htCaiaByZvWHIRR/4fJh18soVH0gp11Bzf3EpADCcntXXdxUH3l6bObVyvGirURgwD8RzczSkofrxI6sbBa48ThJtg1pmLt19UO9MOS4VmfIr4sn3TiqheiKBOydS8G9ymY6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 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77cf376a-e993-4f34-d467-08d68d21f9a2 X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2840 Subject: [dpdk-dev] [PATCH 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, 07 Feb 2019 17:30:40 -0000 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 the 82599. Signed-off-by: Julien Meunier --- v2: - disable / enable autoneg when loopback is requested for X540 / X550 --- drivers/net/ixgbe/base/ixgbe_type.h | 1 + drivers/net/ixgbe/base/ixgbe_x540.c | 26 ++++++++++++++++ drivers/net/ixgbe/base/ixgbe_x540.h | 2 ++ drivers/net/ixgbe/base/ixgbe_x550.c | 26 ++++++++++++++++ drivers/net/ixgbe/base/ixgbe_x550.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 5 ++- drivers/net/ixgbe/ixgbe_rxtx.c | 61 +++++++++++++++++++++++++++++++++++-- 7 files changed, 117 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h index 077b8f0..c4af31e 100644 --- a/drivers/net/ixgbe/base/ixgbe_type.h +++ b/drivers/net/ixgbe/base/ixgbe_type.h @@ -1649,6 +1649,7 @@ struct ixgbe_dmac_config { #define IXGBE_MII_5GBASE_T_ADVERTISE 0x0800 #define IXGBE_MII_100BASE_T_ADVERTISE 0x0100 /* full duplex, bit:8 */ #define IXGBE_MII_100BASE_T_ADVERTISE_HALF 0x0080 /* half duplex, bit:7 */ +#define IXGBE_MII_AUTONEG_ENABLE 0x1000 #define IXGBE_MII_RESTART 0x200 #define IXGBE_MII_AUTONEG_COMPLETE 0x20 #define IXGBE_MII_AUTONEG_LINK_UP 0x04 diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c index f00f0ea..a241d41 100644 --- a/drivers/net/ixgbe/base/ixgbe_x540.c +++ b/drivers/net/ixgbe/base/ixgbe_x540.c @@ -1032,3 +1032,29 @@ s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index) return IXGBE_SUCCESS; } + +/* + * ixgbe_setup_phy_link_x540 - Enable/disable the autoneg + * @hw: pointer to hardware structure + * enable: enable/disable the autoneg + **/ +s32 ixgbe_setup_phy_autoneg_x540(struct ixgbe_hw *hw, bool enable) +{ + s32 status = IXGBE_SUCCESS; + u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; + + DEBUGFUNC("ixgbe_setup_phy_autoneg_x540"); + + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); + + if (enable) + autoneg_reg |= IXGBE_MII_AUTONEG_ENABLE; + else + autoneg_reg &= ~IXGBE_MII_AUTONEG_ENABLE; + + hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); + + return status; +} diff --git a/drivers/net/ixgbe/base/ixgbe_x540.h b/drivers/net/ixgbe/base/ixgbe_x540.h index 231dfe5..ef939ce 100644 --- a/drivers/net/ixgbe/base/ixgbe_x540.h +++ b/drivers/net/ixgbe/base/ixgbe_x540.h @@ -34,5 +34,7 @@ void ixgbe_init_swfw_sync_X540(struct ixgbe_hw *hw); s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index); s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index); + +s32 ixgbe_setup_phy_autoneg_x540(struct ixgbe_hw *hw, bool enable); #endif /* _IXGBE_X540_H_ */ diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index a920a14..f4ee188 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -4652,3 +4652,29 @@ bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw) return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE); } + +/* + * ixgbe_setup_phy_link_x550 - Enable/disable the autoneg + * @hw: pointer to hardware structure + * enable: enable/disable the autoneg + **/ +s32 ixgbe_setup_phy_autoneg_x550(struct ixgbe_hw *hw, bool enable) +{ + s32 status = IXGBE_SUCCESS; + u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; + + DEBUGFUNC("ixgbe_setup_phy_autoneg_x550"); + + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); + + if (enable) + autoneg_reg |= IXGBE_MII_AUTONEG_ENABLE; + else + autoneg_reg &= ~IXGBE_MII_AUTONEG_ENABLE; + + hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); + + return status; +} diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h index 3bd98f2..dd4fa18 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.h +++ b/drivers/net/ixgbe/base/ixgbe_x550.h @@ -93,4 +93,5 @@ s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw); s32 ixgbe_led_on_t_X550em(struct ixgbe_hw *hw, u32 led_idx); s32 ixgbe_led_off_t_X550em(struct ixgbe_hw *hw, u32 led_idx); bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw); +s32 ixgbe_setup_phy_autoneg_x550(struct ixgbe_hw *hw, bool enable); #endif /* _IXGBE_X550_H_ */ 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 */ /* 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. */ #define IXGBE_MAX_JUMBO_FRAME_SIZE 0x2600 /* Maximum Jumbo frame size. */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index c9a70a8..1472d13 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -49,6 +49,8 @@ #include "ixgbe_ethdev.h" #include "base/ixgbe_dcb.h" #include "base/ixgbe_common.h" +#include "base/ixgbe_x540.h" +#include "base/ixgbe_x550.h" #include "ixgbe_rxtx.h" #ifdef RTE_LIBRTE_IEEE1588 @@ -3174,6 +3176,7 @@ ixgbe_dev_clear_queues(struct rte_eth_dev *dev) unsigned i; struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)dev->data->dev_private; + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); PMD_INIT_FUNC_TRACE(); @@ -3194,6 +3197,15 @@ 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 != 0) { + if (hw->mac.type == ixgbe_mac_X540) + ixgbe_setup_phy_autoneg_x540(hw, true); + else if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x || + hw->mac.type == ixgbe_mac_X550EM_a) + ixgbe_setup_phy_autoneg_x550(hw, true); + } } void @@ -5074,8 +5086,12 @@ ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX) - if (hw->mac.type == ixgbe_mac_82599EB) + if (dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_TX_RX) + if (hw->mac.type == ixgbe_mac_82599EB || + hw->mac.type == ixgbe_mac_X540 || + hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x || + hw->mac.type == ixgbe_mac_X550EM_a) return 0; return -ENOTSUP; @@ -5108,6 +5124,41 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw *hw) msec_delay(50); } +/* + * Set up link loopback for X540 mode Tx->Rx. + */ +static inline void __attribute__((cold)) +ixgbe_setup_loopback_link_x540(struct ixgbe_hw *hw) +{ + uint32_t macc; + PMD_INIT_FUNC_TRACE(); + + /* datasheet 15.2.1: disable AUTONEG (PHY Bit 7.0.C) */ + ixgbe_setup_phy_autoneg_x540(hw, false); + + /* datasheet 15.2.1: MACC.FLU = 1 (force link up) */ + macc = IXGBE_READ_REG(hw, IXGBE_MACC); + macc |= IXGBE_MACC_FLU; + IXGBE_WRITE_REG(hw, IXGBE_MACC, macc); +} + +/* + * Set up link loopback for X550 mode Tx->Rx. + */ +static inline void __attribute__((cold)) +ixgbe_setup_loopback_link_x550(struct ixgbe_hw *hw) +{ + uint32_t macc; + PMD_INIT_FUNC_TRACE(); + + /* datasheet 15.2.1: disable AUTONEG (PHY Bit 7.0.C) */ + ixgbe_setup_phy_autoneg_x550(hw, false); + + /* datasheet 15.2.1: MACC.FLU = 1 (force link up) */ + macc = IXGBE_READ_REG(hw, IXGBE_MACC); + macc |= IXGBE_MACC_FLU; + IXGBE_WRITE_REG(hw, IXGBE_MACC, macc); +} /* * Start Transmit and Receive Units. @@ -5172,6 +5223,12 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) if (dev->data->dev_conf.lpbk_mode != 0) { if (hw->mac.type == ixgbe_mac_82599EB) ixgbe_setup_loopback_link_82599(hw); + else if (hw->mac.type == ixgbe_mac_X540) + ixgbe_setup_loopback_link_x540(hw); + else if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_X550EM_x || + hw->mac.type == ixgbe_mac_X550EM_a) + ixgbe_setup_loopback_link_x550(hw); } #ifdef RTE_LIBRTE_SECURITY -- 2.10.2