From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0045.outbound.protection.outlook.com [104.47.0.45]) by dpdk.org (Postfix) with ESMTP id A8A5B1B026 for ; Thu, 4 Jan 2018 20:31:45 +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=UenlO1YB5bSpZsnYNrMOlDJPLAHVGpEeu7JFVP7QzAc=; b=pRUq719rql2nPYKkGkKWYWLolpMdEW1gAEnAfeQVa2UUufkhq7fCR0lHjcfTDXablIiKlGY9TvnaV5knXu5/CudCd7o2mKHSQPlTCZpFX7LOUFvqcQpT0PpYb4+T6XGREBMRpKjQbZ1wvlsQapd0vM9gQEd1KNRUNQMRqc3dvBY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3210.eurprd05.prod.outlook.com (2603:10a6:7:36::32) 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:31:38 +0000 From: Moti Haimovsky To: gaetan.rivet@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 4 Jan 2018 21:31:04 +0200 Message-Id: <1515094264-185657-3-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515094264-185657-1-git-send-email-motih@mellanox.com> References: <1515094264-185657-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0501CA0024.eurprd05.prod.outlook.com (2603:10a6:800:92::34) To HE1PR05MB3210.eurprd05.prod.outlook.com (2603:10a6:7:36::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a06072f4-97e1-4a94-762d-08d553a9c6f5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060); SRVR:HE1PR05MB3210; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3210; 3:lJycB7zOkxqcN/AA1x4T5UEVmFAhdx/LZrosVY8dsC5OUPacM7faPxJ+Mwk77MhrCO7brUUh7N9I+ERiSaGTsdrovDjgrZh0CnrGip6MOWGHW36CE6OGJNH2fZyxxLphFhq+Cf+z5PcK4PSCmzHU9j1wR+wp6ZD5d9lYyE4uzuXWxEDoyVy4ijj/YM3oQZ95hHrf4YrmxTqeSfzUQQHZSzzeJvo6+eros5sKuDS3aMtmpN/jep5KSDwDCn3T5aq+; 25:VTwbJTo8U657TfRLt/C7seBGI1/3e4S7FgNh/FVyb5UR2EYJnETnOP5ToPdHsAaX6NdXhu/ml5mvyGCG4+adcD1Kdl1OlPp45t5alN3s7u1DjgZWPd6Xgv+ozrO1mWwlxT3ms2nl6sQh+hSbj/tdPquXgJQAxSouh88ZMKyIygleukqBIjEQyrsmQY4fUkkK7O22LHEiAzor9/GoVh89yeTmO2LnUl9K0e0wdSf/6k795D07jMifdCQIr/uSSeWZSUHkeNwJvht1PfN0VNFQ3n1TbVTyx5Ybv8JQ97YXEmFymrDuMP2y82LaLudRbUwIAuIS5gUwtrQUTI29CgBB0A==; 31:Iysq8nTJbh+zCXgyMlXKrI2/R2LhaXHDjM2MAtPU7W/lFhchNovL/mRNf1t76NZ1eT44Kyu7tAAKkShUdGZHvLH9N7kI1YFhhBRY0sFM7lL/E+uEfYiRkhyyLaJxnyaHkgEWmAel1NVwFXm5QmB9FDvjaEle84DVaHztL87V2dZMGwqpi4sA7FkLMu4tln1W1f0xHUFu9x7urcXjOvW1Ch7f2VUafqnPLge35oa+9uI= X-MS-TrafficTypeDiagnostic: HE1PR05MB3210: X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3210; 20:AwVIQHcdBjFwDq1l9awZzhOL5oRl+JQcf1Dk00zbrHNhwXO/r5aAGNuyD66MoHN7Ng8uAWPz1NTKZnoSmPmb84LdewkpFqxtQddiGsLy4aoenWMYyn+cYwZM5FB9Pt4NYM0+gBA/hRHAo1GQLYxbELb3DKk1tmJ0XA5gmHJvczmLnTgV03AY/vcN0XeqxOzXS5AfEksFeI/1a/1Vaa8AGyvJ8KS13K1Utb9xjoA/SVEvsEG0nFwSYh8XpTogayMxjcWUal1hZr8YpQUqODuPhTEd4U3DuhSdlDWNN30x+9XxWh0cuhnyiTRMBDPD5eSlwolSxiyxQY+YJvWWGZaD597SLwI0gDRPtIsB5yhiqg67Z8HJ94BrnK56Ei5dBzJZWhLl+/QuiRs+QsV2QFBMhlwIjpH6dpRLkYRADoz7GLDJGcIuKrvU71sf5oBi/g80LydF4Is6fi+i8L+FofMbIGbvphemtBdIUMJ+pGFBV0t/BxW8jBRo+1qKU5V8r2CP; 4:s+Yvwvc3Nkfd5wXMSgBsVLYh39HBAQ4SDct8x/in9YkY/rCgkhQ0fmVrD/Z2fa7V48PCZ2O5xTlE4RyCEymrqo7hw/N1f9BjhedjH9mZzlXlPTzj/EkKyk619MiJJAmJv2k2tQ88z/wks1TTuV+b6uHm+7wc+xa2a0RcqA3YXWHiWhCNSAWYLZOr+2BsaSQg/Nd1I5V20gZpt4/aSCSd+BBgPpBffVqyxcKv12UsqmP9D1QJ8H0btbaGI2DhtMrMHfphdQqloudmqc+3eTS2nA== 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)(93006095)(93001095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR05MB3210; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR05MB3210; X-Forefront-PRVS: 054231DC40 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(39380400002)(376002)(366004)(346002)(189003)(199004)(2906002)(2361001)(47776003)(8936002)(105586002)(106356001)(2351001)(16586007)(7736002)(478600001)(4326008)(50466002)(316002)(16526018)(6916009)(2950100002)(305945005)(50226002)(8676002)(4720700003)(33026002)(6666003)(25786009)(81166006)(81156014)(86362001)(66066001)(59450400001)(6116002)(5660300001)(52116002)(51416003)(21086003)(386003)(107886003)(36756003)(3846002)(48376002)(7696005)(69596002)(55016002)(97736004)(68736007)(76176011)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3210; 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; HE1PR05MB3210; 23:P4FWIlAzuTujfE35WSQkM5zuz8KEgP6FedtPt4ZCO?= =?us-ascii?Q?f9+5CIEc+weyWQHjmwshaVwOXRFk2i49auyNAbvw+EUJ00cH6+vniCQcSnWq?= =?us-ascii?Q?40MVtVu7gAfjewgIEntlUcHrgyi3J/TrJE6vKnk1uc/00Jkc+z02k9Iz2dWD?= =?us-ascii?Q?OrwmKdhpSw15kYeZURs/KHXxWkBWV4dhDaWG0PVN4ItCu1BwdifCQfA+yvPZ?= =?us-ascii?Q?S6IiZxwRqaJmdBkvRyVuZXUZAQ1etex8JMId7eCO07388q5mdvgtRD6ZFhjj?= =?us-ascii?Q?0RyPh4+DC8rG9L9QnfTbATz1Ko9cEOpG4e+ubc1LVRtea7lAeP3bJhXOhxhi?= =?us-ascii?Q?mhwtxDyoIA2/WNWZe2MYP3v62ILC2TwEn3DTjVe224uqGLEXfqoMo/9EPEXf?= =?us-ascii?Q?IWzede1c+hMvk0JWFcbaOJdPbWM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P1iYNo8csJkDen/YvaVIkTgZdGGgJDsbfJZn6nraarvtn4WsRNU83L19LKnfZuX6e2MeErgRF+uiRavyW13zpA7FzLAsXYOn8FxWsdsPp5Gsp5iXWjeVDEkiAhpa8RuJpZ+O7NW0Jw3Z6prqAmPir2rqUa+Qf9Saodki2jSOylbU5EHjmS/EBmwrJ+PgQ36v4p34b106ApEPzS+g5iCCveg4qxLxTawvrV2xS5Pzq6qakdw42/VkyjOvHuzY39A+TxFdUHC0dsIsOEsTkbKBu2AjS8Mhz9oliI6zTuZgPqiuKoSvJaPPQMfNZMvUhIi27Ggbsb68MB91Hj8doiCvFX2CGJPmo=; 5:6MpNsKRRktgZAtrbtOIRkidp4isdD6dSDKb6k4zAwWU9y1xYBlFJk75tZ3179auVbLDG/QUq11VVRLpZ0qTQM2/Enha/Sh1VGr3H/ACTOfvCF42pJycVsBWO7de/XfW3sONOP4SJZTL9DQggto77jArQitsEwCOLFETAwFo8HO0=; 24:8RxHckRLqxroprQAFQCWUM86+mfx5Bz6eby8Y2Da1lOJ2y9+1XLzqZjSEDb1QgGxXFC8P3JxnJzNbhlTx9Ik795txFN1R4nS7zJSyDRluU4=; 7:orhsBLx0EZLQ1L3lZxyTHzeQ2DEVca/r+B7HBiaJNxqS5ShuJFdnqgya+kGD+LgVYz4J0gqzEqktzhXX2UJnuHufo301Z32NVWI+Fy65Ej29sgVzwxs/W2EIx8Na7kGbcEUflfH1Zf93IXkUZ4UGEphtn6alPoOPwJjDJ9ErzQYu3DKitG7lRTAs3Y051YwkKFSLJtNdZoHThoVZyfUvXK3Zq3gMd67exWKQ2iYtXputRyagQgYe6411pPSJqm7T SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 19:31:38.9409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a06072f4-97e1-4a94-762d-08d553a9c6f5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3210 Subject: [dpdk-dev] [PATCH 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:31:45 -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 --- 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 1fd845f..6532a62 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