From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0078.outbound.protection.outlook.com [104.47.2.78]) by dpdk.org (Postfix) with ESMTP id C86FB7D30 for ; Wed, 10 Jan 2018 17:21:09 +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=BzNx06NsMLCG7U0RZkEpPa/yEaC8c8Oi+Agms7n9vrI=; b=vULyKCacDGUq5GcDkcNH5vkms9iTClxJiHyYPpjLwffPqdJfJcTAS2McJYOHJf1dCnGq2hZ+6Tv9f+HOGWsn4ul/IUBKYW/3yYS8JgV/rMvnPTeUr6NUmCDpKz8ZxrtjxyL1Fw3wEK4zatTImmDzJ0nJhCRDfTjzrA+qyuAJkUs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3206.eurprd05.prod.outlook.com (2603:10a6:6:1a::32) 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 16:21:07 +0000 From: Moti Haimovsky To: pascal.mazon@6wind.com Cc: ferruh.yigit@intel.com, dev@dpdk.org, Moti Haimovsky Date: Wed, 10 Jan 2018 18:20:48 +0200 Message-Id: <1515601248-39458-2-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515601248-39458-1-git-send-email-motih@mellanox.com> References: <1515093521-185221-3-git-send-email-motih@mellanox.com> <1515601248-39458-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR09CA0054.eurprd09.prod.outlook.com (2603:10a6:802:28::22) To DB6PR05MB3206.eurprd05.prod.outlook.com (2603:10a6:6:1a::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19976d1e-1378-4d8f-4820-08d558462819 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020053)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:DB6PR05MB3206; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3206; 3:dgcWCOtwP633DHUG6H6sI+9udXxV64ESH1p377J17cy+oRDSnMmWLYm/Yi1yJHNQ3AUZmWLmCI5D35S67nigZh+xMy4z+EYTsLe4dXSJeuZUl7DmbdixoSivPoiAdRtxKN+gWWiIdepIcHzlXYySg2O2yeYACQFdyUZS44PyC6QQLHyDI19zI3USsx2nhu5mB4VUELRQF3N/tg4PpLd4DENnxxSrUUGRUBNQUD121NDBueGWBoUbFbNDovDG7Hiu; 25:WSD2EiDQfCnr3kE33+tVDFdm9cdZWnmDxbPMObV+q25ff30Fu4fuxaMEJh60i0G1/NKTAukwVuw0zB4pSxhCID7ArVM7c30B3TriNKtyj5ZVFwXjmHdFkYrU3upHy1e5BOfiiJ/uq9Ft+DlzKevLQ6HMHaW+A2KHiwHbZaDfBl05KDC7573wWuEjw1fBMthwT0DEW8HI0fYK6BfGZebXlINczk4pwCwrXckXqD3JWvKvLIpFygkEw8KYenUFyJHESJd97Gk7gYnlUtq6dsVB1hae+4SqEeefBcH6o/ho/T8kEXqwjEwltZnVTgZ41dB5tpkXhEhbVSTB01egESO6sg==; 31:rUI8mPZvV8OpaTyvw5IhtUMBo16/X9+DT2WTmVJXobOJ7H+Cb1ZxUxMDhJTLusyKZL0oEWCyG/shNGvee1Q39ZlNN8wktDtFbETo8NtBprX2Jkor41cJ9xQnPIaJgM+n3UzNo8ooJKastUdzPU/QgI3KAaVAF3PugHVBdDoOghipTQMjL+HG1AOLILWl7H4Q9hYQr/gFwYjXLwgcpkKnGaRY3XDGC+ASzTA5aKQOnNI= X-MS-TrafficTypeDiagnostic: DB6PR05MB3206: X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3206; 20:s4q3qcWzcjgJ3cV4YoV/EStPFhge+Z8/p1TNiZH3u3tgoPutibO9jMgvIKFuP5zJhPnwuwLhPNq8KmWEFB6qKT58xvSARZD86cZ15KvAWg9YAdu9gy7jDGAef2TjXFvvBZBqkUv8Dlp2Rm+2E6tPm1mLTavPCslrnxR12D/kgOPj2SsRNJ4r2qM/NT6zquf7JGAUyxbGfkbrSQar5fV7lfC/yiA7kTfvRhaWxc/PZNey4QPwAQPC/HiJ4XaQNuloQ1c71mxCPJw+l5w5mUKnZ6d5CMDe8eIdyw5XW1qha/HO2n74KefvzFynz3afpYWYuWJmd6Qk9VzO5ICq1Rm3bESaRkcuxUl7phrMn0rKvLXVxfr6GDrdGgb0R0vLHKo46ZE1PLXzbF/bz6FvZDt1mXvWuzJxq/vCTKa1VDQITyP+KbIIBfnVxqifCUg8msZW1UQxmIsDd4j03ivbXck1fUmmVWwDQ0wG1ZaXaZxyQoh2BQCaWDiXsnL12GilaEU9; 4:tK7HwQPTqStO8BIvfsghimh7HpXa5yJ9Zw5gmge4prbXACmX6ofaAHDxkghtmhd77geO7kuustCgT5VUytjAUsItO7Oqq7Qirc4wDDEnkhEiP7xUhHOZfejzf2ysKdG4oITcdrdjD20w8a+YaCh9RR2Vd69pxe1NQL3UDt4cq0/ctZUG6HBI3zKSHm57OQIry29MDcOYim1of8ep5cG8S3To6uLkR1WUPGwvETvybCcArO7RHUUe1WgxXh/2Cb4OW6JKIslsoN76sTmOSrr0bQ== 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)(944501119)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:DB6PR05MB3206; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB6PR05MB3206; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(366004)(39860400002)(376002)(346002)(199004)(189003)(3846002)(2950100002)(33026002)(6916009)(97736004)(16586007)(5660300001)(6666003)(316002)(16526018)(4720700003)(48376002)(50466002)(47776003)(66066001)(21086003)(6116002)(86362001)(52116002)(76176011)(51416003)(7696005)(36756003)(478600001)(68736007)(55016002)(106356001)(105586002)(25786009)(386003)(7736002)(8936002)(4326008)(2351001)(2906002)(59450400001)(69596002)(50226002)(53936002)(2361001)(8676002)(81166006)(305945005)(107886003)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3206; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; DB6PR05MB3206; 23:Kk5lrI4gHd/6/Mv+rtAE+fHh3YmYExDM8OvmvYFN+?= =?us-ascii?Q?mo2lrKHMGvZJmH5HkpYod+1+Qjphpg/76Y8yKZWy2EWHGECIlg0U62erK98t?= =?us-ascii?Q?N+hv/TQLeLNOStHbemDFjGK+nJPzBuR9olsZaVLIoEnahyhpyP3WSyM230gF?= =?us-ascii?Q?gl64nuxlwz39mxk6LKVjGxy3JegNcHjs2C94iCHLjMXLF6cDuJegmpok1V5H?= =?us-ascii?Q?9BiD/OHFtMyflwiC7fO/SJjTno24gGF+65GI9l8w5Gscca4U0tncTBVTwRtW?= =?us-ascii?Q?j9WISO6EL8sP8L5xhnMV6G8YNqaI5LQcOBDDNZoe2B0ldF8jdeSECz0olHG3?= =?us-ascii?Q?FdTqJd/NX+fIPet2fQXSKY9Nmvom9WUUHjzu1EBYLHUvseWik0f4Dxm2YUTy?= =?us-ascii?Q?q7FXfs2IL0JUY47XAa9XTyEyiph12ttMt0GP708pk1LjUOHU2Eg2DgkueKF0?= =?us-ascii?Q?Xsqy4ubag1cH8URNQwOPyi0c1Snc7anR0rHYYOlRtmgpR4LzU5RJKjfPyCjQ?= =?us-ascii?Q?eHzidXJnmKtIhXGZqNKtXTD5EZILi0TpUFiRy3ATUddMqCr45HvcU8M1ThHg?= =?us-ascii?Q?LApUAV7fp1Ns82dWV9ZI6Q2feY/ggheWd14MyNtNTcnMZ3cjyj+4BpN43GG8?= =?us-ascii?Q?kUnbFvuBDF+ETRuyFxkqR4wv/vgSMJcyTjl6TgPccdjpSQ4YeCyl50J8q+bp?= =?us-ascii?Q?xlnXVRee2y5m8Y9VA539dLSRIKR3oMWeAPd3918d++akVjckytruhgnlDa9x?= =?us-ascii?Q?27UffDz7i5+8FLv8jGY9Ed//i60OK8AkwDcOx3PNsC1wyrJh+zIgQF76eOgC?= =?us-ascii?Q?IubZXdNlkyvmmWLsD0CtHv6QTJX/IJzH9echbYpBt0IA0iMdbL1WonzBO9jm?= =?us-ascii?Q?qp5wsxuUyiymSplT4mPmLDEAr1YOCDl3Yyju4gSeXCK441p/mzFBkPP5VtJq?= =?us-ascii?Q?HX6BpoWRnelwJ2ivdEH2EhMLidsgvW5E54UNq86KKh9hTlhuNmV6ct9zOOEF?= =?us-ascii?Q?2a1gPoP/vZtPd9Ma04B6StmXEgx9tn2h7UbIdaXANYPo7qtfEIYxDBTTvU4N?= =?us-ascii?Q?2go+msAqIrQT4bgJTR04NCedsHdAvz7LKn2tZtepOrA+1qfXytQ6zgpF59Gh?= =?us-ascii?Q?k6MrTFww8uEns8mFAcoF7zYDuHRsd1AtY4u/4FnFDEKrLZ/SobDkm1Oson9x?= =?us-ascii?Q?G+4a+jgI+RE5Nlfj9TdQW7iIysz4HfcG66dUVoFDWgCIuxYz6mYAsNRVw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3206; 6:VpdQS04wKf1SlgiVexkBIk1UQP6kar0Tp0+5NcLgDHHr8YL+y2YH8WM9gUuvcGiqlBA0ce6xUkpLS5vqL4NotR8q6ZQCtwNEnLHn8Rzh7BuaC2qun1Sx79MXzh+08DxLEYZQ8e1xxeyMVIvbajkjwQZt6CWh3CxK9RR5q9i7BCT5BCIy0shij4xX+zbXZBPn94KdAiXq1uk30sSCwP3hp7JO2mtyJbFhUpt4u8AHBMRSDQCYzSDq5Axf5lFySJasKjhlD03XCMoz58OHntq/jyUtVcQvoocL9z8U5GUBlqYynP2NZRwd+u4LiHy31/4gkcRHQiAd2qggi1WLKRQlNrM61E9+Dj4YuMF482B0OII=; 5:hOgAVYqRx40RrVK4JY6RBcVG4YNh0HanrlX3SsUfbpB8GfSihl/QJ3P8MEcxb/zZOUUjIU5DqSEK4OAGxarMyJaUFStPXIKJzTyDtrA2ZsJMKT65xKpEMRixT286lD7hv4BDKKucZ4kSPwCNom9pNYZh+Q1Q/6OfVMw4qENsEIc=; 24:wHGGSpJDhkFJEV5Wc7YfkpKBAqzUu+tR+cnFluf0G6cUjiySjKr51pMLDQU1+PR5OwMvR5EJYZG2XxW0XRyRj8OIXQQjUItRExhlFumZZ38=; 7:8C9V1f4JFh9Kg+rtw9tjt91ZSmCvPGmb6FiTaQuAFN/+qS5zf10lZtOcAOY72maJMVctkPIAd7JwkCf0r9U0F/j+otKO5kM0h7ZWS9v8LylXtuGXPXyq0dhJW/jcHY6UUNkbiEWHmUAjwPgpqUwaX3aKfFZyzA5HCmVxD19bMNnps9c2nZDOnJ1XKf5kN8xL021jD3BdHgNzUMcWsGDiPXdYwQFJzexBLn5M4gcaSLGmtHE6myiaXHqHbABZCTN/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 16:21:07.9306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19976d1e-1378-4d8f-4820-08d558462819 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3206 Subject: [dpdk-dev] [PATCH V4 2/2] net/tap: convert to 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, 10 Jan 2018 16:21:10 -0000 Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Moti Haimovsky --- V4: Modifications according to inputs from Pascal Mazon * Removed extra braces. V3: * Fixed coding style warnings V2: * Fixed coding style warnings --- drivers/net/tap/rte_eth_tap.c | 66 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 1a84adb..8e790d1 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -286,6 +286,43 @@ enum ioctl_mode { } } +static uint64_t +tap_rx_offload_get_port_capa(void) +{ + /* + * In order to support legacy apps, + * report capabilities also as port capabilities. + */ + return DEV_RX_OFFLOAD_SCATTER | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM; +} + +static uint64_t +tap_rx_offload_get_queue_capa(void) +{ + return DEV_RX_OFFLOAD_SCATTER | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM; +} + +static bool +tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; + uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa(); + uint64_t port_supp_offloads = tap_rx_offload_get_port_capa(); + + if ((offloads & (queue_supp_offloads | port_supp_offloads)) != + offloads) + return false; + if ((port_offloads ^ offloads) & port_supp_offloads) + return false; + return true; +} + /* Callback to handle the rx burst of packets to the correct interface and * file descriptor(s) in a multi-queue setup. */ @@ -310,8 +347,9 @@ enum ioctl_mode { int len; len = readv(rxq->fd, *rxq->iovecs, - 1 + (rxq->rxmode->enable_scatter ? - rxq->nb_rx_desc : 1)); + 1 + + (rxq->rxmode->offloads & DEV_RX_OFFLOAD_SCATTER ? + rxq->nb_rx_desc : 1)); if (len < (int)sizeof(struct tun_pi)) break; @@ -366,7 +404,7 @@ enum ioctl_mode { seg->next = NULL; mbuf->packet_type = rte_net_get_ptype(mbuf, NULL, RTE_PTYPE_ALL_MASK); - if (rxq->rxmode->hw_ip_checksum) + if (rxq->rxmode->offloads & DEV_RX_OFFLOAD_CHECKSUM) tap_verify_csum(mbuf); /* account for the receive frame */ @@ -727,12 +765,12 @@ enum ioctl_mode { dev_info->min_rx_bufsize = 0; dev_info->pci_dev = NULL; dev_info->speed_capa = tap_dev_speed_capa(); - dev_info->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM); + dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa(); + dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() | + dev_info->rx_queue_offload_capa; dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa(); - dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa | - tap_tx_offload_get_port_capa(); + dev_info->tx_offload_capa = tap_tx_offload_get_port_capa() | + dev_info->tx_queue_offload_capa; } static int @@ -1048,6 +1086,18 @@ enum ioctl_mode { return -1; } + /* Verify application offloads are valid for our port and queue. */ + if (!tap_rxq_are_offloads_valid(dev, rx_conf->offloads)) { + rte_errno = ENOTSUP; + RTE_LOG(ERR, PMD, + "%p: Rx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx\n", + (void *)dev, rx_conf->offloads, + dev->data->dev_conf.rxmode.offloads, + (tap_rx_offload_get_port_capa() | + tap_rx_offload_get_queue_capa())); + return -rte_errno; + } rxq->mp = mp; rxq->trigger_seen = 1; /* force initial burst */ rxq->in_port = dev->data->port_id; -- 1.8.3.1