From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00067.outbound.protection.outlook.com [40.107.0.67]) by dpdk.org (Postfix) with ESMTP id 7CCBB199AC for ; Wed, 17 Jan 2018 15:30:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Z32xa1b1Dfpi19b6hdYlhkfUayFER6gOds0xN9ZG8pk=; b=XJEhdCEOuN1LPUGgnXvB1shIYVllAaFNJRqvJF/0KEKQEQNojYKTpX3pyRtKJJ5upsCPDzdCPUFGves00FjnTPGl2BZ90WQ55jmFFZOY0Yrd/MXN7L2wNW8M10/Eh3Nc1D/Qd5dWXI1zcXrYGOR5EqS9S4GZTFvyYbnUgKT3tKs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:3::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 14:30:31 +0000 From: Moti Haimovsky To: ferruh.yigit@intel.com, stephen@networkplumber.org Cc: gaetan.rivet@6wind.com, dev@dpdk.org, Moti Haimovsky Date: Wed, 17 Jan 2018 16:30:13 +0200 Message-Id: <1516199413-134187-2-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516199413-134187-1-git-send-email-motih@mellanox.com> References: <1515595223-36144-1-git-send-email-motih@mellanox.com> <1516199413-134187-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1P189CA0024.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::37) To AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:3::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ecc2af13-0953-468b-f2ca-08d55db6dd6d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB3203; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3203; 3:aj8NOeHnznvOI7sENcIHLFcu8a4DCwDQt4+eGOUZh4jEiVSHYrtU9wVf3l7zvrSApuF7/bqhJ7+NK9h7tPj9H0FVWMx58zQXX9CkyI2rfN37RulHjhkuKAZkaq0tofjt4ysGmOGovjbZLMHRAin9jVDJMDG6lHvKSNrWJ2QvQ4TC/41W4ZHcNBeB+YroeonKCdqWLBRbSvwsx71nPGHuhbhs0p/2fpSL8OtLqvrCdnjnixWbg0VHP/leGbYn8hPe; 25:mU9YrYgLjLYQPsuuV9FOUnoT//7yQyiKNDFmUMUO3ctwVvTvfYCxCTtHQ6Pl5sojFsrLr8qVv+DwMTFDcAStwRvt6wKXGquzE57Kzg85fHFsgndlxoOAe4LrAhNU3aFxV9wUEtHfjL+5LK5tDBDoiB1Ur7acP2oTNEzoBuspJfhQuBx+U2uWKmxW0OM+2sJFk3KB+9VwJc5pcjQzwALGbiKbkpfMjPbmbaoRgK5IJWHaRR5LcfWMz4sMCZfIGKUm7MWGwcBMG9MRuxW6M/jPDWm20oUX6jUsTFd3ULdEUTt9FzFa16cjt4AEF640rOw1iy31mG6v0tua3FhuSDVXOQ==; 31:6XL/kMREqFySGBfklqy8IXgSHRmVUNCrHIYuMVTUIArvoUvhuwTmmsXwLDKaxRRl10Ju0now89jcF1LQuFNcy3PAr6nP7bR05b/4AbO/3Subl3hvEcq7kGKqTg88wHF3Bx0PUuxEPqmCCmKDrXKGr+zxGsoE5LrJEZkmu78STAWV/9pzZsJf35sxE4HtRQnplpE+CgunOBdt7NZ+65bIEy9oxGcTT3CdkkcBF+go3Ok= X-MS-TrafficTypeDiagnostic: AM4PR05MB3203: X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3203; 20:Ai+1KjtIl2T6UC2ztAVjkE3QZPvp+3I6s1aDVlRlTZ5dcbyIHN6Sqmp/+GfhJ6i634utmhRrt77Bpx+i2h2YClY53esxEampbF7d4AbT41/bMKw5PLkfmJ15OMLwwouSFxaogyCiGQ4cmwWKZxVFYJw22kEJ8DzsYbKCCeecw+8QgPlBiS8tw2047zr8z8V51tHgnYHDrltq9j58tAYL4v1H8BFxDPnaPyPBWZ8M4TVXsgB7iMUs4gdG0wONeUls8MHNoKaU2Ch81UYNWHPAgwyyxSEO03Fwuanry1SV5R6lDQ+8xWonD4ZVu9ZAoRJBBP6Xk1pOb3OcSd+0mp0g37ooJ9dg/obCA0T6t9u36U6X8WuVd1qmwouTi32+Pgwsy+sU7C6QaT36/JGrIcn5CmJlzT7rzg1GDsqMRrAD8IYySDgA7wco9vXZvcRvDUqU9UTngZr9AmS+d2s7ZUeIczLnsjG8YScTESz1nmvCOse2ZoVMHhU4cx51m9srkcnr; 4:frOB1+KtnOGLCSQqJaObdA9VKT5nIp0PcQDYrBzSyWbJjpyzbwuT+Z1yQpkej/Cd5m6xdFIAi3UyWLK/1cJeMV+BqwOLg1SXoXpC590M4T6iO8R94C1cPS38kIRBUY69F3jdcd2R4ENezlbQnRWswgbldSVrVVVrgY4PrcOvw9ebA8Nl6cni+E16vHD0y8HCRlrMFDIjb5SUWYPHxRU+jR0ygPLyFOg4uCPKoqL/3g5V/q22l6sEPIy6cYXiUJInrPW/+pVNoA7JS36LQ0A52Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501161)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:AM4PR05MB3203; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM4PR05MB3203; X-Forefront-PRVS: 0555EC8317 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(69596002)(8936002)(81156014)(97736004)(7736002)(36756003)(305945005)(55016002)(6116002)(86362001)(3846002)(50466002)(59450400001)(386003)(106356001)(81166006)(52116002)(8676002)(66066001)(76176011)(7696005)(51416003)(47776003)(2906002)(105586002)(48376002)(4326008)(107886003)(68736007)(25786009)(50226002)(6666003)(4720700003)(2950100002)(53936002)(16526018)(21086003)(478600001)(33026002)(5660300001)(16586007)(316002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3203; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR05MB3203; 23:FdZNzzdUqPrbL1IXL5r4xCRkCydxny8CDv4p7P0Yq?= =?us-ascii?Q?vM9n12Zcq07feT9fHwhRdya5UF9K3tNX2d/ac1ZNGUFa4qJbHnIA+2HDgWHW?= =?us-ascii?Q?GT4eqQCSUtXXLqOR5w+RBVRiM+4EAnVTf8nIpbV10vdVDTJligwr3E2BmniI?= =?us-ascii?Q?Ul4RO/Xws9wd4eCdnqbGFCSsrH6id5fGylGDl0BX3g4PVso/TQ1hUVEUqt4B?= =?us-ascii?Q?sE+C0RMk9aC3CQH/b+z3DrSVBnU0DqDWnSbZtf5g9eKwlVCuEuiw9VZDxwC+?= =?us-ascii?Q?xZQZDbZCM69gV9x6LcPyLj+KNIdNyorf1Tmvh+1bkjC/fWW89eokhelJsq5Z?= =?us-ascii?Q?xgiFT6A9aKdVTeK/p0q68wB0EwtXImQ/KaRio0nMnw2lfebEUHkTPT+m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i38rwV94oEv7UTmlSM0uw5Cx4f5ES67ehRZlRakR+YLYxecJtP2rSgdfvdHGpI55vjWZIO8KcIRGUoDWgy9iMmNb6YNxGSWvh1fzJjOMMeQrSAHr3S7Y8ddn5q4GTiEHBoAMiGPVImAjiiYGkHnmfR/SyG9QMxzvIdc/1A+mM4wXoBY1D1MCtw2J2Rh1pn5iL4CVLy3LxHCbvZbc9vPaStQqVf1Jqec28EFpvL0Zx/XZ/VlnOFtQlm1Nh8ISAoAwq6+IcgAJpVbIdmD7RoTBI4ni4s4HHtq1mMbuH7oyHPMV78BltneZuL0EV6pSWoQ2IuyWsE=; 5:VdgvySJmAGJ1l9+9CEIKDiPYnxXW4F80ze1k0qHtICpMViPewDUs7p/gRrRoXIAlh+ohnJaHK9oAWZFQ5ZgSqQ/B/gPLg7QQmJXvRijIBJySbWNSF3zUPsWMDMsBQpPYzuS3L6zU4eB3HTD23ckcCt1lpxmj7iujjVVPuPGBSdg=; 24:kmatf7xoLkLUfa+CvrWCL09CK/r5nWiJEC2510oXaOyFgGf5HqyLHVr79w3gezNr8pC/OploPLohE+4Cu5z/Vt+qo2pPm5DGa3Z39TRW6+k=; 7:m/UhYydg7IEtZv6iiTrUCO+GqeuEYB54C2SRdp75VYBg4Rzsuq1iHwOriAkJdGcAdy4Mii5poJRW4YuWOW3dGsluYBw4lNZizAFobF+MVBHMg57tONigIOWyyXIjoAqd4kRKPPt6HtadZ1hG+A/cqqiYZoVjBnmaMfSpIjRVZvEJfA6StZB/jdxbkWmYlqvVKOkXwrKddMlHPcAFbcHsJB2BWjJI+P43eolbH8KQ1qquD9qP/aGlL0QMynXaCHcV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 14:30:31.5694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecc2af13-0953-468b-f2ca-08d55db6dd6d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3203 Subject: [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx offloads API 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, 17 Jan 2018 14:30:33 -0000 Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit adds support for the new Rx offloads API. Signed-off-by: Moti Haimovsky --- V4: Modifications according to inputs from Gaetan Rivet in reply to 1515595223-36144-2-git-send-email-motih@mellanox.com V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 45 ++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 53a242e..a2c74f5 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -77,6 +77,13 @@ DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO, + .rx_queue_offload_capa = + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_QINQ_STRIP | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM | + DEV_RX_OFFLOAD_TCP_LRO, .tx_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, }; @@ -255,6 +262,25 @@ fs_dev_free_queues(dev); } +static bool +fs_rxq_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads; + uint64_t queue_supp_offloads; + uint64_t port_supp_offloads; + + port_offloads = dev->data->dev_conf.rxmode.offloads; + queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa; + port_supp_offloads = PRIV(dev)->infos.rx_offload_capa; + if ((offloads & (queue_supp_offloads | port_supp_offloads)) != + offloads) + return false; + /* Verify we have no conflict with port offloads */ + if ((port_offloads ^ offloads) & port_supp_offloads) + return false; + return true; +} + static void fs_rx_queue_release(void *queue) { @@ -292,6 +318,18 @@ fs_rx_queue_release(rxq); dev->data->rx_queues[rx_queue_id] = NULL; } + /* Verify application offloads are valid for our port and queue. */ + if (fs_rxq_offloads_valid(dev, rx_conf->offloads) == false) { + rte_errno = ENOTSUP; + ERROR("Rx queue offloads 0x%" PRIx64 + " don't match port offloads 0x%" PRIx64 + " or supported offloads 0x%" PRIx64, + rx_conf->offloads, + dev->data->dev_conf.rxmode.offloads, + PRIV(dev)->infos.rx_offload_capa | + PRIV(dev)->infos.rx_queue_offload_capa); + return -rte_errno; + } rxq = rte_zmalloc(NULL, sizeof(*rxq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -595,17 +633,22 @@ rte_memcpy(&PRIV(dev)->infos, &default_infos, sizeof(default_infos)); } else { - uint32_t rx_offload_capa; + uint64_t rx_offload_capa; + uint64_t rxq_offload_capa; rx_offload_capa = default_infos.rx_offload_capa; + rxq_offload_capa = default_infos.rx_queue_offload_capa; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { rte_eth_dev_info_get(PORT_ID(sdev), &PRIV(dev)->infos); rx_offload_capa &= PRIV(dev)->infos.rx_offload_capa; + rxq_offload_capa &= + PRIV(dev)->infos.rx_queue_offload_capa; } sdev = TX_SUBDEV(dev); rte_eth_dev_info_get(PORT_ID(sdev), &PRIV(dev)->infos); PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; + PRIV(dev)->infos.rx_queue_offload_capa = rxq_offload_capa; PRIV(dev)->infos.tx_offload_capa &= default_infos.tx_offload_capa; PRIV(dev)->infos.tx_queue_offload_capa &= -- 1.8.3.1