From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130131.outbound.protection.outlook.com [40.107.13.131]) by dpdk.org (Postfix) with ESMTP id 9CD741B0F8 for ; Wed, 2 Jan 2019 17:01:15 +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=Nch9yY4Yj2tz2tbdooNsX0VWZsP81Tb8rvXGveSMrfc=; b=JBOP7g2W6vIgf1i+o4VKsTq1SsfB4Opughrd9L27ehX2xGJmcLhg5y/uXzQoPcRbAc+8EF8jrHr6o0vq7sRKJ7gIKpWPjndnUCtGcZd6a+ExCtZhQsdq/uhcKuBttno32LPRAsw4CkVXGTRk7/jFq983zKCfcdO7pHtMSivwX+k= Received: from HE1PR07CA0030.eurprd07.prod.outlook.com (2603:10a6:7:66::16) by DB6PR0701MB2774.eurprd07.prod.outlook.com (2603:10a6:4:24::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.5; Wed, 2 Jan 2019 16:01:14 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by HE1PR07CA0030.outlook.office365.com (2603:10a6:7:66::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.2 via Frontend Transport; Wed, 2 Jan 2019 16:01:14 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.241 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.241; helo=fihe3nok0735.emea.nsn-net.net; Received: from fihe3nok0735.emea.nsn-net.net (131.228.2.241) by DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18 via Frontend Transport; Wed, 2 Jan 2019 16:01:13 +0000 Received: from lfs-up-04.localdomain ([10.157.84.234]) by fihe3nok0735.emea.nsn-net.net (GMO) with ESMTP id x02G1CYZ017399; Wed, 2 Jan 2019 16:01:12 GMT Received: by lfs-up-04.localdomain (Postfix, from userid 62146483) id 11E9C5FA9; Wed, 2 Jan 2019 18:01:12 +0200 (EET) From: Julien Meunier To: , CC: Date: Wed, 2 Jan 2019 18:00:55 +0200 Message-ID: <20190102160055.30301-1-julien.meunier@nokia.com> X-Mailer: git-send-email 2.10.2 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.241; IPV:CAL; SCL:-1; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(376002)(136003)(346002)(39860400002)(396003)(2980300002)(3190300001)(189003)(199004)(53936002)(42186006)(110136005)(316002)(16586007)(86362001)(106466001)(50466002)(4326008)(5660300001)(52956003)(47776003)(44832011)(486006)(36756003)(6266002)(48376002)(106002)(50226002)(305945005)(2616005)(478600001)(356004)(2906002)(8936002)(6666004)(81166006)(26826003)(81156014)(51416003)(103686004)(8676002)(6346003)(186003)(97736004)(26005)(68736007)(14444005)(126002)(476003)(336012)(1076003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB2774; H:fihe3nok0735.emea.nsn-net.net; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DB5EUR03FT044; 1:X81uMrsp7PVBBxj2lH1KwMwyGAh1jsFEoK7MO8LJzjMuIxDDnT4Vt5sKIn7EVeB4bb4f48A6woTZf15Eqer7TMZ9IIydyUS0I7Nr3Xctw/+A6evpNkobJMp4IMlmAcTl MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfb1a8dd-3b20-4c78-36c1-08d670cb856d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4608076)(4709027)(2017052603328); SRVR:DB6PR0701MB2774; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 3:M2HWL/5HYT5ckxC6h72B8jbbWixpuW6lGqP9S1Lfm+qiKhfuSOJhuHJXPmTQJ/zWAwKXnVrcbSXnh1dcnTxCsjMfki6D9a8Sncz6kFptpODfeVhf4zOpvwdeQypdUeojUDdJ+gQrKPQb4aBSHeXCpsdZMgOTYJelZg2zk/C3j/P0FW9bGwNdwKVgdKf/tfIYhyD/ShDElJxwZbwXCwzUWIJTREbbSmQ1MhYKyJ/iy3Gknnr2gg00zoz984QM1c1L3uXI5tXaRd1QNBKl3btt+pzrRvWmpMBpUKFv1FhfJRUuqxGKSuloH68A6qRDd7nlB3TGT8Ea54qPofWaZ+v7JoF+YOSsw4GQFjAXt7ZjcLQ/oRiN4xxd9XaW2VMoi9Nq; 25:pS49cn1pCZQDAnCJYpEfZA1aByJhFS+yi+C3TqhLSLtCIyvF4E/YRiHSUWi1siokUcN1aV5SUQJUWgmg9b2XsjkDAkdKKIpNEuxzDUv0hKhY7/vyxPfW0Ru2cUz8Qo2gWjxh8P9vQ+WyXOYxHK+EtsBJPutao5cyuj0PJSIMakL6+QgrxCF8Q7CaRDEv/vTKAkoaJ5n6SIdfeZCRZKTWjBV6Cfm/voDRowLWyRfZy0zbbdrwC7CY/2ddV9JpqzqBiHwgu14OX6gL0pnDhdVf9Od+MmVrbZQb6VUT3cg3FqaG4umlF4NQH9oY2kiqRYaAnCNs34mN39UygKWKQRi9ow== X-MS-TrafficTypeDiagnostic: DB6PR0701MB2774: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 31:oUR5tp20qQ/nM19x7AkQ8c/vFVxzdZSREq02xLO6PeuLgGGqN3+S3DTK5EEctOQSIxZRI/YKdZILlSM2z7AvBhv5bqPDx2f//R5XIVfi5FOLPTKu6qhQewtZq7aR9Pi679frMQRpjNZuVtWSAywu/J7HTH9rpYPIjNV1P+hsV5hEEOGFgpJWwE1NWof9DhVtS1zNb1/K/JY2gnTjvg8OPAXGy5WQ9gWgtTEKW0r9B3w=; 20:0HOKxvBOWvQfAIQs1HPuEkroOdrQ+JyCYNxfin9ihiBhKv0Pd1YVQfUgsQLVrqNA36GvNwEt5RS000YDk7fBgtXUmFTWCFEIUw8TOSZUorAd2jqo9atl8hXd572RXKI+N29/4LFjAeYptHWCulmF2wlb2te++piJCVRP/sxdHU8OR2uhjN/YMAGeEHV4qkcCnkr6k9mygfvi42KJ1H5oFz2Zt/UDeGfpZanFjlFJS/0Hyb1ZZZhgzN88rfezBxi/CxJYn3OjMuDI0R8JifKbs8GCgyDoF2hWBrfbv/RJM868F7ifWYBGMdq0BWYV8i12VK7jkBPqYoXWsOVKzCz16+k1h2rR/Wb8PXG4MWHqKXu9N+w1KFb6EbcVitwNVDvTJpE9GRaoNCbh6WhyJubZmykI7JfDeQ/HlafIE+67P50PcNipjev4TOo7ZttIwfMds8WHmZ49iQnnyxkSUwlNUcf2vOFiIXkYHp5gGKumYGGaTiB1She3SGbqjc4LNSMxKMjja+uxwkE8S8AM1eCekq5w3/dWhSwbchD2JeLLG4MEppcxEOudobfiEYa4Ec/KqA/h9mDz7poR5z/UXFAOMG+nN4+UGq++SnbU2h8Iogo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(11241501185)(806100)(5005026)(6040522)(8220060)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:DB6PR0701MB2774; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0701MB2774; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 4:r+tjacHP4kYrG3DjuzLOHMRc7yz8KO9ZwlHlBI7MtZkuXF8kL9OBZqEfiel+gn7K1HZWhR5hJuvR7e7neBPTyLd4vxBywvq0XshmfvtjfDwEI1oi3sk84xa5KLMPr+Oe921aAvqWUzqgeRN1dhG9YZaAP0XJXQz5QpsyVcvOFigW5/zOWP0YKc/6Vdz93thkFdgwLcwBLSWefISk5Dv060lJ7v2kQG/xvrzuAz0gQ+75L/Zhc0QSBC7RTaRVNa+NPJqrqidgHIQm6HxD+db4IvNEkDf5d3y/LrXrlE4hlvr2vd6ppsaOusgkWbq1OFEP X-Forefront-PRVS: 0905A6B2C7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0701MB2774; 23:AmuTAHCXIwSXpg2wc86Zt0UHNMsQTO2G86eNi+7?= =?us-ascii?Q?F9ecR9EMbu6CttKs4wXY9zMtmMKmWV+4ipZIINc6nlBLviVXT7KlpD5RlIru?= =?us-ascii?Q?TxL9vDvB8spqZpqYre354I8xnvdjgtSPJFPhp5BDJh6s+m1IY4qFLL9TLvAo?= =?us-ascii?Q?eSsE22DiysGEyTsbaCzEqvKtuB9N18tG3JgPzCgnz0JG7ebr2lcAX16rVBkw?= =?us-ascii?Q?pThPb6UXQnPTRDj2IdEqi1ErKkJu669yEE5AIZfNmDzm7zV2FSC1HiHcaR9i?= =?us-ascii?Q?X84MGJcy56bEMZgZXBt9Vcy7KsL8aQZnLL3C6rimlBBkcBdcAuxvmU12A1+V?= =?us-ascii?Q?C0jj6o/q66HQoZOLx3lMIRYsnBLl8S76yHxFnc0YKUWvk3LtPEOywvZWUvzY?= =?us-ascii?Q?qWutZDe7gvxPs7fmr1Xk9/ftx2TPiuuBB30IiMInMemoCD1m4dxrUddAWQxZ?= =?us-ascii?Q?PY38i39L+IlgVshdP/b8JmvfxVNmklmz/YBQWEm2Q4PlAl11hq6F9j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NFyGWCz1mvS73JJ5BC3wc/3xRHYxSq34yRMx8//A7o3QkaI/nnaCGyLBQJmMVcGGcMEraZtovipBAUJ X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 6:Z38xzRNB2hMF6yo/4+s1J5Hlor9KGOInj6O6ZLOEMWc7V06a7pvAMr8eqJKLDI0EWtaXslD779DzIuPZgkJrqzh6lBNgzvnqbK68ro/MLNmKbuSoJNeagqeMK0EfSc7ckQIA4ROW1qcQFMJDcwGhI6LahFOoChuS43j29hn34zhVuMgZ5vduAH4HEwvNdcFcVEgcbcNgoCAH1xdooleTXZQJLcIa25m52kS2IgxveZgoDB5VLpmLBu4tMDg2f13pgTfqcvkEd9Y+jNpwrP6De6oXPlmIRxrvH0rQ9kSMplZaeSnXmWps/OwRpo9JeCPWZEqe+YiQgyNp+FnR2OFZuWAAn7CJk94VHseBDrZmvzfpXgrcjpjssPubcojtP18OEaIxnrAiTes2qKJh6V/uQhwptPv5Iz4+gV5uYoutfGrSiX4sfhoJj3CF81pTzrvaZ3gL3zJhc6K4ZsmopbLd9w==; 5:TFz36zDbHfmeR5r/9HfQc5RZLXplpuKJpJfL8fkASFVX82fbAVCNQc081f4z5IwaPRXT8v8lucKK/4GvP/jTQttZGHkbLyt6e8OpCorp67RFq8XXykjBAZBG2dOH/qI0r0m/tKpdJpIi8ER/M+iPH3xohWqE8w+XkVuJKewirazcRgC3V2bS9hp2lQzwC8+Arh4/6n7JyMX5QA1v5Vx5Eg==; 7:JL+8Sl4zecA7OpeG40PztoXjRenrYypKwmk8CZ45kqx/TV0K/D77VdxKY4C4KbRYTeMYopMEOKzsWNzrA6zS8LfSEKVIqvUtY62JhSeVOe93rpfpNl62CVtkUa70bE2myxyGQ4mZsL+QntumsZOQlw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2019 16:01:13.6828 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfb1a8dd-3b20-4c78-36c1-08d670cb856d 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.241]; Helo=[fihe3nok0735.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2774 Subject: [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: Wed, 02 Jan 2019 16:01:15 -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 --- 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(-) 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; } - /* Skip link setup if loopback mode is enabled for 82599. */ - if (hw->mac.type == ixgbe_mac_82599EB && - dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX) + /* Skip link setup if loopback mode is enabled. */ + 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) && + dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_TX_RX) goto skip_link_setup; 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 */ /* 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 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 &= ~IXGBE_HLREG0_JUMBOEN; /* - * If loopback mode is configured for 82599, set LPBK bit. + * If loopback mode is configured, set LPBK bit. */ - if (hw->mac.type == ixgbe_mac_82599EB && - dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_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) && + dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_TX_RX) hlreg0 |= IXGBE_HLREG0_LPBK; else hlreg0 &= ~IXGBE_HLREG0_LPBK; @@ -5088,6 +5092,29 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw *hw) msec_delay(50); } +/* + * 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 = 1 (force link up) */ + macc = IXGBE_READ_REG(hw, IXGBE_MACC); + macc |= 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); +} + /* * Start Transmit and Receive Units. @@ -5148,10 +5175,16 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) rxctrl |= IXGBE_RXCTRL_RXEN; hw->mac.ops.enable_rx_dma(hw, rxctrl); - /* If loopback mode is enabled for 82599, set up the link accordingly */ - if (hw->mac.type == ixgbe_mac_82599EB && - dev->data->dev_conf.lpbk_mode == 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 == IXGBE_LPBK_TX_RX) { + if (hw->mac.type == ixgbe_mac_82599EB) + ixgbe_setup_loopback_link_82599(hw); + else if (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) + ixgbe_setup_loopback_link_x540_x550(hw); + } #ifdef RTE_LIBRTE_SECURITY if ((dev->data->dev_conf.rxmode.offloads & -- 2.10.2