From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0057.outbound.protection.outlook.com [104.47.0.57]) by dpdk.org (Postfix) with ESMTP id 2C1CA1B171 for ; Wed, 10 Jan 2018 15:40:46 +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=TB5PqQ2CLGw1+MzG6rFWILdNvWHsA4WYMDe5orxnbyQ=; b=jwoRa+qhkJhYNRkDMMegdDCbPMjy1fQbWuH/3zxE3pp5zP7tpz0cMTrxxcvm132q2Y9gkud4ZeJo33APvNZFy7qJbXazU0J1jOxLaBQQIvdy0MmIJGlaCs5aKck2Jxz2u121Nifk/rERDcQPwjDh8RpEHghDdWu+rIOiF4caX8Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR05MB3213.eurprd05.prod.outlook.com (2603:10a6:802:1b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 14:40:40 +0000 From: Moti Haimovsky To: ferruh.yigit@intel.com, stephen@networkplumber.org Cc: gaetan.rivet@6wind.com, dev@dpdk.org, Moti Haimovsky Date: Wed, 10 Jan 2018 16:40:22 +0200 Message-Id: <1515595223-36144-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515095458-186363-2-git-send-email-motih@mellanox.com> References: <1515095458-186363-2-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR06CA0155.eurprd06.prod.outlook.com (2603:10a6:7:16::42) To VI1PR05MB3213.eurprd05.prod.outlook.com (2603:10a6:802:1b::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf819cf7-1440-4ffa-c823-08d558381fe7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020052)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:VI1PR05MB3213; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3213; 3:GuD7KZkp/99BO3uxOqGZvderMBgbe0jUShnpoiQ5zuPWMacJEcNg9klRkUqcAZwaVIrbkB5uL4r8gnOLAK2B9zfzQnUcoo9X+hhDwCoXIUKgtudX0DuzXQYMHn4L7FTIADr10pV+pi71ymPsSk2xGqo5DTCAUf06YUzkwQikfHPGcfSpniObydzdgxTQJQtibUFMkWJRkfcY45iXGNVGD4aMOHNcHuy17nViWFo35fbge7brVML4SOd4jb671NBj; 25:1JQxaDJ3MfiCbIIKj8zLv0ijikhUZf6StolpkZXNfNdoFVfdscGzXSEZDCzz96KclqfXyZ953e96GBqp7+V+bMRFJ8P56kgCT4mAtX50gcdrVj6bnTMR+5ERIINVpeW40QQClpr77HCtW395CjS7se+6QuHPmlNeyZ/KnhVVeRG43KfLWNtYZLi77ncGcmJ2OPaTg/jpNoPcDaYb+d4QQa5/Td1sY6XYU9qKcGQ/Fgf+2G7Q06ppDZwW7+3rf8aGAVi1NmOmuK9FDmMY0M6tnhcHsNpLgu8HjSKkXtxqtQIuEvpP1WfrbbW0m6WnHbiaaB0u2WT018jcQBHvyaD29A==; 31:lDwZNZUrA9dF6JBU3BiVHl3x1DH24A+rcS8hQz2BmdvDO6ig20K696RmSkcDxArBaNT6Yf6lOdHcujK+Iq7g6C/uYyaVDAj5NvjavXCgLMVuGr7I3PaK3xt6yOp4y8GjoO0mWu3yAvysCWST36Y5xN4xFgTBLVoXFkAfKobd5SXnEZK4Gf5uOHhvO6N4EtoQl2/0JhlfV2M8XGMXeuOezgyGRhyDcp/nud88L/GD0t8= X-MS-TrafficTypeDiagnostic: VI1PR05MB3213: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3213; 20:PBSvFqbk69obzv3ep9+BrAokLb2g58uwz/sbW6R4HwkD3W/ARnYOvgUBScNiwTBSI7RwwRLnGJYU6VAknaQo/8TCbULct53Y4IYp0wi9wR5yj7WQgwuo3GSU2ObYmNbDTKQH/bzTgxYsqaGC14J9v/h7V3Dd4gFcjDiSzFtJVpRsi5kocRCGIjpDcj7ORP395eMKk4R/P/6RgjzyJU+kLSD9YocdC6XQw/W9B8o+2CoxIAeHRNWzg+4mIrSldJ7AGvJwxKKVCJJvOPOZ8rVjL+Ig5+CHE8NcuSo+bf6r+8SPmumNQZABGk/SB4LTsEcsl61XgSHgKjC5K48KPi0gTYDzCWlfSik6zqdCbhNxmTq3wVED7RGbMKb1r166UU5rfyApIEE66tRu4NIUbPqv4N/DFOId0TzU0xl9TKLhAnQEyrEimxKRi1RmjXIaQ7DrIJFwsXxm8ghNicR5CiqGtXruLwyOW7ZIKwlBbqs72RGZAPpdRSkHQPZG5jZi9lbF; 4:Ze2aPKI6mEJ4OegGW2A6xUMmD8qJqqf2gjmvuPtFmqco3Znp5VcWDaKgZvqt0C+Nk+KSJYoUdd7PrwtGhmA/Bol7Dhfu4gOQKUU4jFs8BBX2EtlXKQK+lcjqTx275IMnRs1gp2LxLDdSiWjX3UiPnsGYzDJ6ltnTZIkoMnfZNliehgsMJvXeN/vxobFY3njwha80Q3iqMfdDTzB+7FS5FcE406tU52LXg2q7wpCDg1IVU2SV0Y+pVfJmPMpN8P+R9wW9Ll2ZiUAqtwe6jurd385phm6VzXW25AtqiyGPpHphjLQWfUaVjq2cyU/+d+NW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231023)(944501119)(6055026)(6041268)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR05MB3213; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR05MB3213; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(396003)(346002)(39380400002)(39860400002)(199004)(189003)(5660300001)(66066001)(16586007)(7736002)(50226002)(68736007)(50466002)(305945005)(8936002)(81156014)(316002)(81166006)(16526018)(106356001)(8676002)(47776003)(105586002)(33026002)(21086003)(2950100002)(86362001)(6666003)(69596002)(107886003)(2906002)(76176011)(59450400001)(386003)(4326008)(97736004)(55016002)(53936002)(36756003)(52116002)(51416003)(478600001)(25786009)(7696005)(48376002)(4720700003)(3846002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3213; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:3; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB3213; 23:5+1ThjtVsf6eHE/M9FUUf2Tj7Ev7+vdQWY0A35few?= =?us-ascii?Q?xoqvdpLuKFLXpuYjUfId/2JCyuwmdyDXXN6De5daEmSNSLMbNVU9w+Mr8RlY?= =?us-ascii?Q?QzP6J09o7WkKGcnU/trNQlRN3ODYCvRF0ln98OVk10ZyEOWBZ8ApnT5YuZZZ?= =?us-ascii?Q?BD53CU6FQzGoJ0+aXQTIavAt0GiWluvB4f4OZ6/kMD8AI4oBw76Ym5dh3na4?= =?us-ascii?Q?2Mni7v8N7obZoSsnAcTGHHBPEM1JNjGw5VwtOTZpbCijpcRs+a7d89+1ET7/?= =?us-ascii?Q?o9eymFR01WKmDhYBRw2QCHrf0QTtF8ArTuXpUXStbEUv6A1zhVvh/vtt3U1G?= =?us-ascii?Q?ThuwC+7bILiOZVZ5bYtQGf0nEXte3YlMIrY9yvcXf0J3Ke8tcZfC7HWFopu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vtGuAmCJJ3BCUQ3gUJ+0tlowfb5Gmri9vgo9ny/J5eeJiShcGx32aCCLHH9kxlTya2/wpBbR+7Hsvz0eFrZjtkoCt1GJZHAnqBrBIFod0VsClc1GQDE+jCkZlFKpqDNDvlUX+In6YIVS/ykxLWEUwc1lGZZ7mhCgSLcEWNPeguu6I0a/Gof8o/MBjVqSEFfUfmcNmIiwPC+d4j3Y0tpmDfCPxgFI6BgqSqF7MHPy9BySZMssMI6lEyz5wfJIgJYWAvteBXOO0FfSycrnTdSzHaPBxTdjwh7tSIJ2JkKgQMkP8zhpPHxZIUzXRQoqc=; 5:z4Z8PNNbpKqvPx3vBM721tGJkf29sLUP709iSGl+Fm/QyJ9mIbwxuz0fKFGnzqCIS8knX19Ixar2iJGszPVJy701CA3QcOVleRlb5pE4RY2OFjNwvYN5DR3V7puW/JKoUEqubOciT22kd8/vjt0MY7SNg5iih+A1tBGwPqpyB5g=; 24:6H0j4naG0bo178ds+qi9mdn8qg/Tb3Kl51VNenU6dt90V5XDoS0UDlSXEClA+nu7vbihTg+a5IYVNplAwP6BNCIniBa70AzskwNCfN3tnTY=; 7:A/MhfnrlbkGBTQJJ7x+sUIyK5Z2QgcwX+tV1RafbM7FG0IvPGgDvSKy/4YdZ9hVuYWgPcQZJ+Rgwfh9QKbORbJ+DWAVgc5crVZsTIldFisSAkZlYiwuuaorRog8SMHqP2arzhURCy6luCbaDLrh9d5110bXucVngRvFXQ5OPFjiV8u61iL5DQErQ+gtdG5Gh0NIiY7wPG3WZ6l1qOs1jgp0v0BpOxedtHlHFEjefAphc2zWgZYYN44uoIsibHrIU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 14:40:40.9177 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf819cf7-1440-4ffa-c823-08d558381fe7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3213 Subject: [dpdk-dev] [PATCH V3 1/2] net/failsafe: convert to new Tx 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, 10 Jan 2018 14:40:46 -0000 Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit adds support for the new Tx offloads API. Signed-off-by: Moti Haimovsky --- V3: Modification according to inputs from Stephen Hemminger * Removed unnecessary initialization of tx_queue_offload_capa V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..fc1b85a 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include @@ -84,9 +85,18 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; uint8_t i; int ret; + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { + rte_errno = ENOTSUP; + ERROR("Some Tx offloads are not supported, " + "requested 0x%lx supported 0x%lx\n", + tx_offloads, supp_tx_offloads); + return -rte_errno; + } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -311,6 +321,22 @@ return ret; } +static bool +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; + uint64_t port_supp_offloads = PRIV(dev)->infos.tx_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_tx_queue_release(void *queue) { @@ -347,6 +373,22 @@ fs_tx_queue_release(txq); dev->data->tx_queues[tx_queue_id] = NULL; } + /* + * Don't verify queue offloads for applications which + * use the old API. + */ + if (tx_conf != NULL && + !!(tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) && + !fs_txq_are_offloads_valid(dev, tx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Tx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, tx_conf->offloads, + dev->data->dev_conf.txmode.offloads, + PRIV(dev)->infos.tx_offload_capa | + PRIV(dev)->infos.tx_queue_offload_capa); + return -rte_errno; + } txq = rte_zmalloc("ethdev TX queue", sizeof(*txq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -559,6 +601,8 @@ PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; PRIV(dev)->infos.tx_offload_capa &= default_infos.tx_offload_capa; + PRIV(dev)->infos.tx_queue_offload_capa &= + default_infos.tx_queue_offload_capa; PRIV(dev)->infos.flow_type_rss_offloads &= default_infos.flow_type_rss_offloads; } -- 1.8.3.1