From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20059.outbound.protection.outlook.com [40.107.2.59]) by dpdk.org (Postfix) with ESMTP id 6CB461B052 for ; Thu, 4 Jan 2018 20:51:26 +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=AAf3UaT4Ig67dqU+AmvVO4wevrIPu7+ovhhl7VBAumI=; b=evYDtzj6HcVjWxQroiHwsV5SNEGaxqj3PpcJe2ipBBnrKAqwimOD3XJTSQWjQBQ/Edj87Jihtfp0DgQ3mh2iXns/dGTOd7PNm8xqeKB5Fm4stL2Jh8KMCKfD4V36rMMP6TIPWgFEzeqhyRtBhFuC3TY5YnmZ3JfqVMn0Pef36fc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3208.eurprd05.prod.outlook.com (2603:10a6:6:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 4 Jan 2018 19:51:24 +0000 From: Moti Haimovsky To: gaetan.rivet@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 4 Jan 2018 21:50:58 +0200 Message-Id: <1515095458-186363-3-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515095458-186363-1-git-send-email-motih@mellanox.com> References: <1515094264-185657-2-git-send-email-motih@mellanox.com> <1515095458-186363-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0501CA0020.eurprd05.prod.outlook.com (2603:10a6:800:92::30) To DB6PR05MB3208.eurprd05.prod.outlook.com (2603:10a6:6:1b::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 34fdcb6a-3f4e-4d7c-ab34-08d553ac89aa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DB6PR05MB3208; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3208; 3:Po6dEqTLaleHUEwMXUhsXvwcUgZrNBK2zmYSMnqVNrk3nR/o4En2reuHkvn8i6bwd1s6B19DXgjCkuhq2rs1UoSZPkhVJ+enPEUpnV2bLKx2dz7Y9invtQQa+QPL1zv3K00UbBVlej2Dp1eEhLqDf1rGgblP7d22IiTMY6geKdd4Rt4ubn/lSjxnRvdxOmn9Wh2z9RsHPgGc02gBhcqFCnvr9qf2GYO4KDlYSBVoNGCwDsy09fO42BaJrWabYXQB; 25:BLXb44/iynIYDLDcxXG3ciGVwJchJnmHgK54PhNpKNt1y0aD/z1diH++usZ6u0u7q2LPvXi1iFloBOBqoVQuw1R7TthfW5mlcuRP1mBpm/MO5LDGGsv6bE13YEEgQrkN+jDV7ejxuCgBszo1wKGKxyh3T9xuBmgMYEXpjqmcNWxzP9JuAM8nfkQv4CCqP/ZlrssNUCi/6ry4cXdOryrjJ7s1HuYATDfnOfkb9umxP/5S5bNlLYSNHQwRSFgxcBvstf164FtwnKgQ5gG2X7nN7JD+lrnJjjGGcjE9ird8utySv6ah42ZoBCDnjfVzkagT8i3OCDP76O/G3AImKM/LxA==; 31:4zx+hVBBnr2nDpKuuIrrYP6OVOvZo/ndC9vQgmMdjWVWUfqatu5N9hoeKdyZfqPFMMDEtnTRltgysHkYM7lLz2oHG0YDlLYzO19Z12OJunfr2b2PPegUH2KDVBAE/EGe4fOIaZybv9dGQww7zeSlV27JCrcXuQ7DSmopMvSI20wGEOHD5ua08rEirvqwOladfNLAs2NwZAgpT3dg3yMpKcG68BWpKg1DXXBYxUjMezE= X-MS-TrafficTypeDiagnostic: DB6PR05MB3208: X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3208; 20:5vIUMrt1MFzmhoAduDcCYRktLRqLbIhYGIw72fOJ61LfcMnveH/hA+ey++zsIhxe+uJ57HaYoUAD0kPSBY3QFnjYRL+X1QOCWwKcX4yJJj00bHZ/FPCGZwyWdxg5xcMKVeDEs9RZDX9wVMxtnk4Ub6w3vaSbhLq1rOSKzwD0EdptUOOUB3+NzjKSBADs9/JN3uqykpXjwAWGe60NYQuCVAXyY9fezOd/T/U9BtkOIk9QGL6BAShS/KQPYCC2DRVlwhDv151MnRP9SsMUXo0cVGFe/Ew1rfvuZjm4X90T+tWeO9hIYmfZzqikkUXVLlhCyU4KoapvqGvdKJ1grKoOfzYI8dfRk+K9+V7AtL7DFyd8IzkKMjIVs1OCCs4wzxoLmZ4AL3t+GA2ZeWxqG7MYLBz6bCRiGqg8I77st+V1HYxFfELT7bTWQaoWPgYiww/C7S4qnMXKwpHZh1JHU9yIFGTzIRYKX1yTvPVR+Zug/zmrvH4WfrljJTDOa+7osbrn; 4:8tc1Xxpx/PJ4KYVgGArpQODBrl23Jzx1rxbhyUGnUZ7E3dZQ1BbG+k6V69QVfFgsHyp3Y4T/lxLWrXndAZpgqOE6dbyqK9Sm8txV1h3hX5B9BkufVAsXe1grfrVXOHGhNMGwfuqgWfeSp/reXiYA7m196lDjz5IjxcTs5FvaWGJH4bZzMsmC0eHhn0t63CgXKHQ9LGDynzwMRDO1jc+3on1vzYnQTFbP+htFKz8SX8zBUCZMmTc3KihSK/EVeGaC2y/axvY377UF6MUOT6Xa0Q== 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)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6055026)(6041268)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR05MB3208; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB6PR05MB3208; X-Forefront-PRVS: 054231DC40 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(366004)(39380400002)(39860400002)(199004)(189003)(51416003)(2950100002)(6916009)(36756003)(59450400001)(52116002)(386003)(7696005)(6666003)(69596002)(478600001)(76176011)(97736004)(107886003)(7736002)(3846002)(8676002)(6116002)(86362001)(81166006)(2906002)(5660300001)(33026002)(66066001)(4720700003)(4326008)(16526018)(8936002)(305945005)(50226002)(25786009)(81156014)(21086003)(2361001)(50466002)(2351001)(47776003)(316002)(53936002)(68736007)(16586007)(55016002)(48376002)(106356001)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3208; 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; DB6PR05MB3208; 23:mF59EIN/6pmaM6qqfS8HPH/hQBDA32NyoDRHBAw/v?= =?us-ascii?Q?WYxHqhiio7HmYYQrB/qxsBKlmMFPxNJlekAJN89w05tJFjPPuGsYSXurxfhz?= =?us-ascii?Q?XKO0uQ2DoALAF5IHrjRaDx16qfPr/WWnRjzD9AhMMKm4NKIoOSiVxRfbP5Lm?= =?us-ascii?Q?SIt9ZwDJCZtjZ94AHZNYgpkkNkYRd4aU/Z45RdSYrzfh9EPLMRqH6Q6q5xMF?= =?us-ascii?Q?9/rnKdo5MB7oFOp514u8dG1lv3vH9cBuiCDFy1ZNDeiM6CgZrMFBLYcgoPSG?= =?us-ascii?Q?BYyVjdQlhm3IbEbofQqOs4JeBoRoiT7ZKFuHdIQP1jbF9x7FLLpAz+jk3QXp?= =?us-ascii?Q?DfCTKP3pdeGYpQaV/pIgy+sZPROSAnndwiiVfIOsk+dtP0eSwAHs47b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ostics: 1; DB6PR05MB3208; 6:gA0IIN8rBIwT+QVnokoaymYR0TlpyJGyhFr4K5PWJfcn1J4BEwcngtSjd4v5or1DAwTyvyg9vzzlEaiL7qNFIRYESycjgRURuODau3A0D31ki+gC/gm67ud7Ao5skkV0XptqyjNX+3T3t9YuxVZAaXfFxa7k+zK1+lrgvzGbi5CEASduebfvNe/lElS5wMic4Pzxjzaf/0VeHH+Vo8NORotXd3DtPhYHuCHS48lDQcofbQ+Cm/VNj3av7llt4hzSYwIE204hxr4/QZYK++3c8e43WB07Y4WDXEK77WQy6R1aW8PWd4IVN7oxfKosVFgZaBIi85hwtJCcmnnIgfYhjYyLG7SfvvYSwNBPxctyUjA=; 5:4/gMtp7P2p/ypcMXVTjq9t15SGwEGMh7Z+jgfa5WpN8LHBnWsffslxsGmDDgXghUYGhVV9Cyzfv7oWK5LFJrNA1ebHSGWHfrN6JsnmqnhqksYndHJltQLMpi02qhHRXyDj3BRI+DnqYUOwsfi/0jR2P6yR6JgKNoTqAeV79VBuE=; 24:QCP13YE8wOnYYIqEtSVUYawrEd/hFzY0Hyi3CuCmcNlnEhF8aTijEVoFOOchGGxIkU+/QgHcBWZqEcIoYmSIDvW4lhIe9Dya3ZajFOxPIHE=; 7:WqnV80cpC5UAIjSmW7H8IS+8ex4h6LPGBoc++uXLYkAJUieAvV5ptdUx9DVTqe1zo0o/xQ/Pc+W2oq9pukJ6l9rn2PmM23YOSWcquLy3DKkRBFVfaThDJZSCVQDxzSRnpUqJd3cpOba726Mt0hbssJk8tVl4KA6Rhr2VeCnBFiv04dTxlZ+2O2N8zk9YG7b/gA+y+wrfhNZPZJms/6sDzR23d4miG7ugqxvH56E4pnefzmxcSirLgMNFag30u8X+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 19:51:24.6155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34fdcb6a-3f4e-4d7c-ab34-08d553ac89aa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3208 Subject: [dpdk-dev] [PATCH V2 2/2] net/failsafe: 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:51:26 -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 --- V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e498c49..e4aa82d 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, .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, @@ -254,6 +261,22 @@ fs_dev_free_queues(dev); } +static bool +fs_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 = PRIV(dev)->infos.rx_queue_offload_capa; + uint64_t 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) { @@ -291,6 +314,17 @@ 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_are_offloads_valid(dev, rx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Rx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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, @@ -590,12 +624,16 @@ sizeof(default_infos)); } else { uint32_t rx_offload_capa; + uint32_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); -- 1.8.3.1