From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50110.outbound.protection.outlook.com [40.107.5.110]) by dpdk.org (Postfix) with ESMTP id 5223F1B6F1 for ; Thu, 7 Feb 2019 18:30:31 +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=//YKDbQvKqjT/89I59L56ugSgmrlOlaJIgswWgpYu6U=; b=kLNuZVpB9TNzXmwpeNpa2Q1fzthd/gakKFIzRptiLn7AwDWTxcFj9/HZP1WC6gi97HVuO+dWHs5QZ76CrU59EYo8nSp3wfcPTNIn8y9XMvmQo2dBct0XT8R2iy56oJYtnPaB8I+mrobA2x716rgBAvNx6A+k32NDzgFVR5xElhc= Received: from AM3PR07CA0070.eurprd07.prod.outlook.com (2603:10a6:207:4::28) 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.1622.9; Thu, 7 Feb 2019 17:30:30 +0000 Received: from DB5EUR03FT056.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by AM3PR07CA0070.outlook.office365.com (2603:10a6:207:4::28) 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:29 +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 DB5EUR03FT056.mail.protection.outlook.com (10.152.21.124) 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:29 +0000 Received: from lfs-up-04.localdomain ([10.157.84.234]) by fihe3nok0735.emea.nsn-net.net (GMO) with ESMTP id x17HUSSW003589; Thu, 7 Feb 2019 17:30:29 GMT Received: by lfs-up-04.localdomain (Postfix, from userid 62146483) id DBC75673B; Thu, 7 Feb 2019 19:30:28 +0200 (EET) From: Julien Meunier To: , , , CC: Date: Thu, 7 Feb 2019 19:30:04 +0200 Message-ID: <20190207173005.38372-1-julien.meunier@nokia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20190102160055.30301-1-julien.meunier@nokia.com> References: <20190102160055.30301-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)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(3190300001)(189003)(199004)(1076003)(26005)(2906002)(6346003)(68736007)(26826003)(2616005)(11346002)(446003)(476003)(305945005)(106466001)(478600001)(126002)(336012)(486006)(356004)(6666004)(103686004)(36756003)(186003)(51416003)(76176011)(97736004)(8676002)(52956003)(50466002)(8936002)(48376002)(47776003)(316002)(53936002)(81166006)(44832011)(14444005)(110136005)(81156014)(86362001)(50226002)(42186006)(2201001)(16586007)(4326008)(6266002)(106002); 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; DB5EUR03FT056; 1:SdXBVAH9GzHSvuLVZYUlBqIU5MwOz1ByQm0lc0Om0epD9v7ywmX4Jk+tNgAF526JAX2Ec9AksjlqxRFaCGM1mT6cax90jg/kxGXocH8kysuouhR+Lqlga+QlFR7h7OhM/g/EJWUTx0wnxBO8M6Wu+dlW66i95XlxTz6GP6BaCyI= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c002d23b-cef1-4cb3-daf4-08d68d21f4b2 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4608076)(4709027)(2017052603328); SRVR:DB6PR0701MB2774; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 3:/jWSyTx5FYnam9/rDcKRWzgHg63MT+U9PLt0ZG6x49USOl6QqZoUdxBukaJEe0pOvTEPbdoRtYeTC3bttCBJCLFnwmvxUP9mLJgsT7LbRV2y9cFV2Z33ucOZbcfLSn8wYiQMu6oejS+/ZJZHoIeOyvtjIgR9NZphsdFJkXDLilJ87EJN01DE30xXqqc3MbrYMd6TV7AFJhe5QkHR5HDMVOrwd1R3X3qxkjdBUJvBQMFj9ilYsSbBF4K2s0ae6MNmwRqtZOIczK4W3yogyLxge5odqzs+dZl0PorCMr/3y8nDOypQz4L0vBa3w8nJnF6fv5Z2pOnFq3EpCvSAQr0nlf/y5r6J1jTxovRS+L4akSRl/cdrcmNe7SfXcnllfCIA; 25:u4czXukjIVveV03+JjG+jmgCoXUKvRjjxFZFWJqrJY04OMEo8y3trylw2o15VwwG9fRkdGHy2zXm8CsGvpHEmL3sCXHHsBMyOJhrSPrET8diZvk3vSy82tenEgPQdQI5NUuJna9tm0w7mdBpAZU2gSoZCD3qfrUvscCSuC7wUG5H3ldNuHgW8dHcgsbu+FXstC1KTkywolSR6mFth3PcddgwBNARZJSasCr18+gLeg1b1iDSp5Tm9ps4I6wneZRj2J/hb95vVFgEnY80TTgvZnhkBMoFs/5OJEoDaZq+i3Or4YzOTxCgdFWQJm3LSj+ar/rTdTSIxbE9aclLoeTnQw== X-MS-TrafficTypeDiagnostic: DB6PR0701MB2774: X-Microsoft-Exchange-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u9dwMBmv+zGiFL57E9IS2NkvcQ5tRV2bzu0nJNI6iHzhzcU6VOArFVDBhObgAzVvP2jYKc+otv2Y2hrv3h2Gs5ADmfqqBIAhOuoXksiBKCAuAtjdEg8dpi/DHIEGS+FQTj15pFfuapwpHFQ+hdpzeL+wYmusy0L/FfA= X-Forefront-PRVS: 0941B96580 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0701MB2774; 23:YDYF8a3OpNdspwMjPzuekHryJhyJm2zgNHNRSjz?= =?us-ascii?Q?gb8smgpy9GI+v0aIN0ehasjacDBbvZHHYJNl+uT2X58/PmEfbrOwrutKsJG6?= =?us-ascii?Q?6Df4DtSFWwGGrh4rZKi6UxIcD+xi5t39cB9V7IT/XqjSXWE9Ir8G1fx+mXCo?= =?us-ascii?Q?skRED8ue/X016JYbEiK2EYTudg7EHo5Wprpl5W+kmH0+gNHB99Mq8qDRW271?= =?us-ascii?Q?xC9mIeK/X3xATsv+m9DTeNRO16/FjUjj6L1ubIvrHjbYJ9IqB+1wD8RtQdG4?= =?us-ascii?Q?gx2fuzPCBbYlwkvzBoGb3BFNw9s+ciwr/orBzpvh6FBs7rsYOvAmwfIBhEDe?= =?us-ascii?Q?9Rk3uRaPSMFMInFrAdMhYtDInfjql/3Nm+PeodSHmkNLz5z3Rg4t5EvwzIOJ?= =?us-ascii?Q?XYJD86U2lnVFc8X+m1ywn/3wWM374+Lu+S/dMFZTCFUJZQmzQ0dObmx2oRFC?= =?us-ascii?Q?YQkGqz4RfuBj0oieaCkKqXBykYNfVMp9K7+ZrlqUwBuPIajEcI2M3z7rnM/3?= =?us-ascii?Q?J/pXtwndnQx3MHOpfst1YWD9QybAcFQCLQRYregNtemh64QWUZQDhf6/8QIE?= =?us-ascii?Q?kZ5IunWLxAC0YfYVwK3TLOBI9tzqgREp0LWJzlBtmXlGOYEm7en/NAeRXVxN?= =?us-ascii?Q?I3o34f4vlxexwp2YBTxY0qSKruGDdeCHqbzCX9tlumwfVnm28yOeslYjtrU+?= =?us-ascii?Q?CYI1cfNoiBOtwiovZftTzLYgZ0JVVfQFgkPsJ0uyg5M+qHpSAYKtrJtn5q1v?= =?us-ascii?Q?Kbc5CXT2Wpa+8oan06qStzvPZEdecBK1cYwIq1oaXXEPcehvgFO4jStARVzB?= =?us-ascii?Q?SOTTvRDDtPDKyO6D0onLXNgsMjs5ndZRO38nTvI+WhiOw35LQE8akd/wGK7j?= =?us-ascii?Q?gNYDV5hILooVP2xS/3KgOn4wBON9cRLws4axkThW52Z5bxQhMHd06WyyXwDS?= =?us-ascii?Q?5FZBZ96Tt7uFrnFCF6HER0kAxQWQnWKCnAYrZNl7k5zEWQ3LX7sLdmFkk1/9?= =?us-ascii?Q?4gYk4oXAeXMMwbA2MIINFunuSGnNFCe7tgSiYhG0tkIY0Rm110QqbKtYIkZG?= =?us-ascii?Q?pCvui5r+I0xNh4uziXQbcsVGjHCFnRblQtgZ6FeY0N2PEiI5YiFwP3IEVpWD?= =?us-ascii?Q?4wPHbBWuqckICVDQcITuuoLe0Ctlbx+gmbm+1O8H4hqOisyW66LS6pzNziYh?= =?us-ascii?Q?CTpiCzcuOeAqJ/II=3D?= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: uTFDZJJfFmct2wc4o/laUCl9oNkGrS8dvcA+C+Nu68YtpRfTcpgBA+LCLqXUd7Ks0e1OT/RKQH/S6z1C5hvkDAC8HRZszFeBZct8x7d8WZPxGfSsEZshPOpNlGwLCwCvtLlrDXoHzyw4xQJng0V337R7cDmDoxnRLLNxcDX+XLmtNoaHsU03X7+iITSiyM7s2KGXwApPCK4vbYSH82o7u6lN2drcu23G8frdUqNzeHvn5mkQQg2vKKE8zr5PFDIyAjYTOYQT7T4na57nO4hi59Wjo3wiLckg5UwL1af7MkDNSkorUxbXkFdFs7aonufqUlpuK8KxZOYv44lTUIIk3ZNVs/hFncldifBvUMXOGQ/6SxkmNQO1H70/wc0bsUJT7ogFSlOvzb/lWQkzTbNHUdnHC6MZfA25WnkYm52wHVQ= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2774; 6:Eg9px46T5Ah5+zNumE1QlhAgvBW+7z/8yM0NUGo/QkpK/MQ4HPZkFh5mziO+4Gr7Fw6dIDuwaBKOhEHLhnoMI7KIf5t7RYGwidah+TvxusV0z11OpVBcrAJXHA1rUPqehfkipK8PRU7o0PEbn45WrRVEOEylFFDt0aeVNZMPOZ09MDUSHTit1B9lfD9zdHXBAvJDV9YIJB34E2t3czrpSbVYriPaXAY2pU224gsR7kFX4S/j8g7Bsgf/fC6KZw1x0Qemy6+0swdwe4vi/g1xOUXOZIIgUCovBxruyuwYIlXvGTajOMUQn8umA6/DsEQnCRo+AR+l00NRWSdc2OE+XNXqemApyKJYBlDbq4sEMVC3CZEe11H87+b6VYja+3EPSSTcHKxo5w7M4QJP+YuUDZy35CM5tllEAQM6O4ZIK/TgTtZO7f64FAxUjC3XhJaX0TEXcIO1DLREc9bI465BAw==; 5:BCJwu7WbS6ZojUNWe2YlWJ3YfXC3I+o+0WMxnFt9nnVcosclADOlgr0x2TvJcApgYcfmRrhFQA47c6rc9MDPpZLjjsXEgQeQFErjalykZcEPRR4iPmWvAInofZsfa+GEXaC686y8CXICEKWB4xTMi4STBM/lBVqANIkRMZZ6wn1Ojrc7k17273vwixKJC3Q5tpxh+4N6foOmNi54hEsOCQ==; 7:gNih6Y8xxWSqlAa51SU54l744OyVEpwRgc5DPEDKJVI53XMhjeWd2Lt9G/lpbPY/7Fy8GecxCL6TrCPNCPQarVn50KC4ICukcg8RYx3jtZTJcCTUKrQSl1im30l808zABjFkMpBILrigM3mjtRvJFA== X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2019 17:30:29.6461 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c002d23b-cef1-4cb3-daf4-08d68d21f4b2 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 1/2] net/ixgbe: do not start on unsupported loopback mode 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:31 -0000 Only TX->RX loopback is supported currently on 82599EB. If a user wants to apply an another loopback configuration (!= IXGBE_LPBK_82599_TX_RX), ixgbe PMD ignores it and continues the configuration without raising any error. Let's robustify this part by checking if the requested loopback mode is correct for the current device, before starting it. If it is not valid, PMD will refuse to start. Signed-off-by: Julien Meunier --- v2: - factorize code - check if loopback is really supported --- drivers/net/ixgbe/ixgbe_ethdev.c | 13 +++++++++---- drivers/net/ixgbe/ixgbe_rxtx.c | 37 +++++++++++++++++++++++++++++-------- drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7493110..558f60b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2652,10 +2652,15 @@ 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) - goto skip_link_setup; + /* Skip link setup if loopback mode is enabled. */ + if (dev->data->dev_conf.lpbk_mode != 0) { + err = ixgbe_check_supported_loopback_mode(dev); + if (err < 0) { + PMD_INIT_LOG(ERR, "Unsupported loopback mode"); + goto error; + } else + goto skip_link_setup; + } if (ixgbe_is_sfp(hw) && hw->phy.multispeed_fiber) { err = hw->mac.ops.setup_sfp(hw); diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 9a79d18..c9a70a8 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4879,13 +4879,18 @@ 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 (dev->data->dev_conf.lpbk_mode != 0) { + rc = ixgbe_check_supported_loopback_mode(dev); + if (rc < 0) { + PMD_INIT_LOG(ERR, "Unsupported loopback mode"); + return rc; + } hlreg0 |= IXGBE_HLREG0_LPBK; - else + } else { hlreg0 &= ~IXGBE_HLREG0_LPBK; + } IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); @@ -5062,6 +5067,21 @@ ixgbe_dev_tx_init(struct rte_eth_dev *dev) } /* + * Check if requested loopback mode is supported + */ +int +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) + return 0; + + return -ENOTSUP; +} + +/* * Set up link for 82599 loopback mode Tx->Rx. */ static inline void __attribute__((cold)) @@ -5148,10 +5168,11 @@ 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 != 0) { + if (hw->mac.type == ixgbe_mac_82599EB) + ixgbe_setup_loopback_link_82599(hw); + } #ifdef RTE_LIBRTE_SECURITY if ((dev->data->dev_conf.rxmode.offloads & diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 39378f7..2d8011d 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -276,6 +276,8 @@ void ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq); */ void ixgbe_set_rx_function(struct rte_eth_dev *dev); +int ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev); + uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t ixgbe_recv_scattered_pkts_vec(void *rx_queue, -- 2.10.2