From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00080.outbound.protection.outlook.com [40.107.0.80]) by dpdk.org (Postfix) with ESMTP id 631801B169 for ; Thu, 4 Jan 2018 20:19: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=6xFJ9xAcmZAVun9/eEjY+Wsi1vqzqzhoDe+Fj7hfkNM=; b=wmcITnAKdUSQI1tWL0lIo5ELTTL6gAWz4LKrA8x0fRCEKWHYvGzRbg+BoIQ9DC0pMBRK/18QtMZ5ixzpwUiVxYfgKEnOuyT9hp68bY5igJB9J8/iDgduy9jlmTn8pQ9NGDYGZhWFdu87cAyZ1OxkfW4gq2SM6qgsn2j98YBINeY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3212.eurprd05.prod.outlook.com (2603:10a6:7:35::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 4 Jan 2018 19:19:08 +0000 From: Moti Haimovsky To: pascal.mazon@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 4 Jan 2018 21:18:41 +0200 Message-Id: <1515093521-185221-3-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515093521-185221-1-git-send-email-motih@mellanox.com> References: <1515093521-185221-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB6PR1001CA0037.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::23) To HE1PR05MB3212.eurprd05.prod.outlook.com (2603:10a6:7:35::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3081ae99-ad1c-4c22-a145-08d553a80773 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060); SRVR:HE1PR05MB3212; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3212; 3:sd1XosH5MnxFWqe7rvTBhxMQVZZQRnLeXCv38SredeGrSCR8fBmil0T2nGS6aLYTSzl23bTjiWc3BsfwBOY509mcgCBu25e9Nj5yoJcqAwhro3lGwh5Un+LCYXa6nWNmK3kH/Enqxaw/G0LxCX/aJInRIqulo7alMEGCtTEIfr775S7XDOAT4s10YViLyn70XVH6H5VxMdEks8AI9DIGp4yLG8C9wBkENf2ZH5kM9PTRUrDIkkgl8qvdZB2CuoT+; 25:6SVPcCD2+CLeh+e5BTWu5XxEPeUmWkf0m3I8O1duoFn/hhBh1dUL1dXAUOgVXd6ns61ScgdTdi2EIeL4A87KraHstfZfqmF81iNrTf1EtalaZr5IP+cbKoa/Jf8o7bQR7cvi5xp5NKlXSL/QLtF6G/psUwaXVanPUKmzuXbQH3P4L9IoLx4ZwZO1Nw8LUEvkWKkTbGKs7pI0L1r/NC5L3W8m879oJoTwPayEV6J8nKH45I/Chg4PhnS+R3tilqfjlXgrDOy3MVsxhv9s6/IHZa8gYhs3fVznGsrFlXfnhkG9c5VqLa4od5gXP3yI/19tUwr/5F70CSiozquyylzGeQ==; 31:FKalyyrFBEBdeoWsjHNdFEs5z21KHlMyCmnIuKlaD6X2OjPaBuat7yCgOOYFHQdR7yCblTNzEs0SfAN5piq3AJ/3ymoJMlZlaRagEaNYPsmSfo904Vqb2ecZMKuz6Zpzuku2voqs5/tzrhP+4ki7lgXny+ZSZPrmiacgztLgiYTPG4yWUXRezCT1mpBMlLopDPwqJTV/FznmcRap7n6tfEH0cTmv/ZXxSMboMDcB9JQ= X-MS-TrafficTypeDiagnostic: HE1PR05MB3212: X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3212; 20:p0hLyYZf9S6az17ubdw4sSxCM4KUBG0Gkj1nOP3UKHhm5P8rOchJuDzDul/0AlAhUuOw+X+0Zxh3WiVgHtUmJyeYelSQOnM6tZd1Meh7Po7OABtm+4Ofz+IBiR8HvXbYiamjw6pMak8Zs38AklduUmnfw46fwDpVppan7HhfSAMPxAN1pWazvV8HElZFTIiLuVCWQyajSGC30C2jEpVkYY56gMCY0JB8aWmD/AZTDltiuZsISTHwc7Hsaji7GfssLbmR8a6gns+4FfDPFF73ueonkJ1p84iunvCa0pelEOwEst3iU/4EPLKHYlHfQ2QwiRCia58FRRGB/RxKVXfIX1rqcAN8CyVxM7VyLhhIVoCVVIFxEJXIS9ql4uYUXACp3k1A5FNwF2EHENQkjeRsLJGrrfyn+1uvSc7ygWaSLQqOR8y4VlmwOpbofOsxL4H//4InuxLL6W8FjkpbhJA9ysHSMo0sJCYIDTOGEvd610k36xgwNHzMFUvqbSRRjmjp; 4:tU0aE6teYkHLTif3IBuuTAniwQSSp0zmKX9ihexSXS7CzgTF8VLpqXozE1t+WwiirSvocLgnh5mJp6nw5ehyy2/B85WiFBDWcVCuJhsmDYeRVhiyAsm7Yxz6adRTMEdZTLrjcFkZp9niarvCc8+5eP3uWY+eqrVB5YVYUyzox3LHJNkADtP1K2kb91G2Xq7/VXS//327+PzX1H/RUj3+hrIBvCi5lV/hX44ZkVOXcLcjeIoLDgo9saS91rgL/FiXYhRlKEV85/ltXOU5mLCRUQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(944501075)(93006095)(93001095)(10201501046)(6055026)(6041268)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR05MB3212; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR05MB3212; X-Forefront-PRVS: 054231DC40 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(39380400002)(396003)(366004)(376002)(199004)(189003)(16526018)(478600001)(50466002)(5660300001)(7736002)(305945005)(4326008)(6116002)(3846002)(25786009)(97736004)(316002)(4720700003)(6666003)(48376002)(68736007)(81156014)(6916009)(2950100002)(8936002)(16586007)(8676002)(81166006)(50226002)(107886003)(51416003)(7696005)(86362001)(52116002)(76176011)(69596002)(33026002)(53936002)(386003)(21086003)(2906002)(47776003)(106356001)(2361001)(59450400001)(66066001)(36756003)(55016002)(105586002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3212; 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; HE1PR05MB3212; 23:hEyFZ4KUaDqxqHsTotfSuATUIBz85mmpzrxtQOcE3?= =?us-ascii?Q?01L9vBgpFCwUR/x+/eQqiRrPh5Yw5a4FW9VvPNfAJjV23XyLCGuTVlgI75WQ?= =?us-ascii?Q?SaXCq2tWD/Dr45PtGzYFJzxc/htcR+M0g1j25iZFwjD7e2qEZCpnVnu3e2MP?= =?us-ascii?Q?SIZm7hsWF45/obDI1HtKtbgDNaHPjbE0srYntgBu62UDQy5RHE6ZMH021OJT?= =?us-ascii?Q?bn6XdC4n2UhDsabI9eR4AQzrfVz7pVw3j4afvftguX60qn4RYeLpJDd7hMmr?= =?us-ascii?Q?ofvdYicufLsY2hjPeUEboRgSzMB4iaVn6oUIQy08nArzdE446rlrpLp72LBA?= =?us-ascii?Q?CyqZ7LcZntpewgV+2N86dAYo/03Ups4GJ+DsvvsGP4BSRhixLhSrhEBS7p4x?= =?us-ascii?Q?ggDCL5akcmHKDPiGvTDdC6T9qCMqrVaCVHgVxXX+FKlIo8Znpw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LKD4y2EIfHBef7cCp6TQXyOUFwvmAUrc9iSX8U3vwy0gGaI2i7bOp+ILao3CSEyw5CBVq4vxQORRRK8FS0zPTKw99h1h2WQJpX+8E55KkI7Sb7Xes9N06RzMWfrOi65Bs9yiNPp+RLg5/prhNfD8ShkzVL5cfiI+QrEpBtW3WPM+9bZGdp9vj9oO3ewcb3EHWteeP9Tgm8L23YMpkNRJl6mEaahb1y5yJ2ujm07xA98l58w8L1LIlGhmXeZdOHAsLMHdli2NZm4rRnugFRmZuWwt2+U/FBx2UXikzkmGXKCJLVay00qzSUCPQ28=; 5:lJz58KLjPMgLNJXpLMU3j8rzlo7GrongssBjlyIIoD+zzapkg4E0cvZGs6wHV7TFqaHDX7mcUGynjKKqzpeIKk3EKQ4gFzUsmthPKxJKTIwDW43G6g30ZElKl4KU2J0rKs+2I5ZH8miymfijF1MdmCix0fIvSefLo1qNeqlTejA=; 24:jtvSBGBYljrZpjSrZxuGLzmCKjUGSHWMgaxu+K4c3PCkyD8I3gwj+Mx6tXvNu9mbfMyavPbUFKZHfvz1wBLQm/eCTp0V2i0HEbXnF6t7h6w=; 7:oyLf0ue1CksZP0JJJx7ktSWiUydevZYr8nd+K785fyBTG4VK5XsCjwYp2gkM3BJF83KDSyssLUljA+x5jrk0VRGCHVBUKSVOBDtIJGjg3tT0kioS6GPe3EgNzhn9HCwBMvgUGNgfYHAjRFgf++8yqB+3Tr2bWu0Hqq+2+eqSE7fB5uRRi9bh+ikmJY/MJSaG5Ffw79vy+Q1DQF4mH/kYGfS0/dd1rjhhL1rzibLsbSYuepfGSLuOlRuzKcxKgkLj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 19:19:08.0860 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3081ae99-ad1c-4c22-a145-08d553a80773 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3212 Subject: [dpdk-dev] [PATCH V3 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: Thu, 04 Jan 2018 19:19:09 -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 --- 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..f08c37c 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