From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70100.outbound.protection.outlook.com [40.107.7.100]) by dpdk.org (Postfix) with ESMTP id 5AF611F28 for ; Wed, 20 Feb 2019 22:05:37 +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=apMogoX5L2288zp2urQPvkS1iuSLpOT/yWHVMYOoEOw=; b=m2zNnqJQQMidTzANy0JMkWzM2m9KMUl5YU84C5xiLANQURN8NEUS9DHSzxjyhyLHfUpzldpKN43oZXzB7J+PBkP/CzKKhw/oG+3I3YyDer/ydcnvfcbmj/ysAd5ZGgj4O2vn2cP25U/AXk9zmuKC9haapJ3XecV4K1H1R64ngZc= Received: from DB6PR07CA0081.eurprd07.prod.outlook.com (2603:10a6:6:2b::19) by VI1PR0701MB2847.eurprd07.prod.outlook.com (2603:10a6:800:85::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.14; Wed, 20 Feb 2019 21:05:35 +0000 Received: from DB5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::208) by DB6PR07CA0081.outlook.office365.com (2603:10a6:6:2b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.5 via Frontend Transport; Wed, 20 Feb 2019 21:05:35 +0000 Authentication-Results: spf=pass (sender IP is 131.228.2.241) 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.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 DB5EUR03FT023.mail.protection.outlook.com (10.152.20.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.11 via Frontend Transport; Wed, 20 Feb 2019 21:05:34 +0000 Received: from lfs-up-04.localdomain ([10.157.84.234]) by fihe3nok0735.emea.nsn-net.net (GMO) with ESMTP id x1KL5YWF013047; Wed, 20 Feb 2019 21:05:34 GMT Received: by lfs-up-04.localdomain (Postfix, from userid 62146483) id 2109D9FCD; Wed, 20 Feb 2019 23:05:34 +0200 (EET) From: Julien Meunier To: , , Wenzhuo Lu , Konstantin Ananyev CC: Date: Wed, 20 Feb 2019 23:05:30 +0200 Message-ID: <20190220210531.48322-2-julien.meunier@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20190220210531.48322-1-julien.meunier@nokia.com> References: <20190102160055.30301-1-julien.meunier@nokia.com> <20190220210531.48322-1-julien.meunier@nokia.com> 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)(396003)(376002)(136003)(39860400002)(346002)(2980300002)(3190300001)(199004)(189003)(186003)(97736004)(44832011)(14444005)(476003)(126002)(47776003)(5660300002)(81156014)(106466001)(478600001)(81166006)(103686004)(52956003)(446003)(50226002)(8676002)(11346002)(305945005)(4326008)(1076003)(26826003)(2906002)(6266002)(86362001)(26005)(42186006)(356004)(8936002)(53936002)(6666004)(51416003)(316002)(50466002)(36756003)(16586007)(336012)(110136005)(106002)(486006)(76176011)(68736007)(2616005)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB2847; H:fihe3nok0735.emea.nsn-net.net; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b042abee-2ee4-403a-854d-08d697772832 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4608103)(4709054)(2017052603328); SRVR:VI1PR0701MB2847; X-MS-TrafficTypeDiagnostic: VI1PR0701MB2847: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2847; 20:+GuQLJSXFHLHz9RHNUfrsSljGo9VBvB+2vJf8ahL+IoEwpxR5T073ztdLYbaqT3w2MOcGj/VL/tbFxVlXXH7tpCDkFNKCETPyEOgXvk2dhVmsLIwFstdQQVoodW5k7Llm4JX3gKh2kVpur/zGf5KiSN/8xVIhPjLbA/nIYTTFfbV/jAF7TS7gWDuIAAo1eot+m7A5g5QjQOLnMygpxIE1Pzqp7YLmEsY5Dpu9ARDKwYfNlzdW8EgyxQmjpfcJIrDnlXNqTE0oaE/3sWJ1ywjliLzsakBJ2+gI+ydYYIcoxwdGImcSJOYVIWVuWljZxAyIZb22srZ2pWyVxfQ1gpfz3fTHNvv7Sc+BUGuL95tRyL0NLLd9ldzz7Obt7hePE6eSjpXoyeV+vJL5aJrmnHOjnf07sSol6+01TX30p72s94NC8Xd2ZJTgWIxQQs5lRpp41HgDAa1+MCOlmKpuKrHGwScRdxWrJ5q9ui4gbHOyslEaHS1x5/PxjLplcmJPAumMgS8YVZuQ7jjZgasSDh+LdbtitnTkTG3FcVDWPYdTXM1vyYgb8HiY3nqFeB9RlNt1Yh34N4WjRJ5PlboWbHqpjtjCJ5m84W+Jb/viPy8JaU= X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0954EE4910 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0701MB2847; 23:ls7bf9n1myYwojEqQqlAGtHXlZCZUknx/D3Rq/m?= =?us-ascii?Q?3ddaHfuFfDNCOvpwkP+Jzs6EETzXvumXb88x9Ev0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hlq701KOyn/siysBvDp7ICWoxGttdwIogtZCtKabD7S3FvNzJ+J?= =?us-ascii?Q?3NOUzeWphYE/3YaO0vgRqxxtzlYhgv8bfQ+wfpkFuramhEbRVbuI43RtZ8ph?= =?us-ascii?Q?cFUB8nARbsCikD4XOSTehLj+sYRzjWLSMeJiRKDymxDwP2luyd+QIAzz6Y/E?= =?us-ascii?Q?3SC21u9YLtB2ldE4P0N6AFiuaMhK7AsRgeCTFqZfo7PNhAyFAl/2U/h+QmBI?= =?us-ascii?Q?oDhxPioda0vu6U94=3D?= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: YUxalFFZKTxXIvU2pgRRJMXiC7ZC7WLmHJOQkvNHCZWuCQjyR7n7432vBt/7hBBI8fHB7pzmhofADvRNc7KuI3ZxIvi9m6GQ6+v4eU0ND51Xst2O/bmKYpDyMtaIU66J1jcoK2JkDugD2jFX/WvZJWNwVc9KIcPG6tZW6zaUJAfUWrvK+xUN9dBU0xxjoKzpIb4b4vuAQ8bbimIfESYAepEF5HLfthmk8KAoceOVJVmpoYNYrD9aauYZYvLqEwsVCN824enpepyr54/qcONWJyMfnQ04t1ej5hZlIeix63IuFK31nyK2NDEx6iu3F48L/U84o4y8b2l0+GQelild3lLZJ5WFQQVPy/2almMypPnmxbGj/bbTDK8/8Yx8GaSxVEaRgPNi3D117LHN5OiVy8jkqvcygmR2oMKXxH8feMI= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2019 21:05:34.9004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b042abee-2ee4-403a-854d-08d697772832 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: VI1PR0701MB2847 Subject: [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: Wed, 20 Feb 2019 21:05:37 -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 --- 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(-) 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 */ /* 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 = 1) */ #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..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; } +/* + * 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 = IXGBE_MII_AUTONEG_REG; + + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); + macc = IXGBE_READ_REG(hw, IXGBE_MACC); + + if (enable) { + /* datasheet 15.2.1: disable AUTONEG (PHY Bit 7.0.C) */ + autoneg_reg |= IXGBE_MII_AUTONEG_ENABLE; + /* datasheet 15.2.1: MACC.FLU = 1 (force link up) */ + macc |= IXGBE_MACC_FLU; + } else { + autoneg_reg &= ~IXGBE_MII_AUTONEG_ENABLE; + macc &= ~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 = (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 +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 != 0) { + 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, false); + } } void @@ -5074,8 +5114,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; @@ -5172,6 +5216,11 @@ 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 || + 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, true); } #ifdef RTE_LIBRTE_SECURITY -- 2.10.2