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 855EA1B029 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=RVZrQGygCtKJ8o3IlsPAlN0ZrdyylRINgIzt4RhjDRw=; b=GAEQb9mqQTB8pD+XwpAsLcq+/vvYMeh0CSF34Vj/wnreTqUCaSzC6xVwZvOpme2RYK8WZqXoDbXpFqD9Oc4no5pw+57mC3CQ935KIaHxnaQ/LBY1GYCaIL7bIsUJm+kk0xf4QzO3qQIK6Lq23svG0K5D50YxDMRCZLvuyuFOkLI= 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:37 +0000 From: Moti Haimovsky To: gaetan.rivet@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 4 Jan 2018 21:31:03 +0200 Message-Id: <1515094264-185657-2-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: dd49f3a0-d14b-449a-b865-08d553a9c655 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:APzyAquRdJiyzhi3IKrY6gES7BmJri2l9sG4Pfo5sMH4T6MKRVQnk9QsG4AU4qUfPcadrAhFUbrgnEW/DUs5Tv97/tSLDDsf8Qm36LhzzwnitQePAS7xpra+ANopCbu4pMOFF8No6lXB6flSbTyQlmrwN3kno0gF25/M1grabajYcbh/mEUJ5LEzca0ZDeP1OnfPWyPLGeg9cImJxDzslMZiPFF/s/8GN2MqeDIpkq4XS2k2kNmiBegT12Q58u5X; 25:CBIm8y9YXqaaMg8DurojiKQYav3nTgl6ydjBWIX4R6jFEubAek8Tg0KD5QW+8W5szymQLMvRx7VqbhcyVQGtj/vl7gjEl3IC+nZbtZ0T2vh59FsCJtcM6my4gkk5WyOF9UsJRwU8DuL1Jq7htQjWyIrQkH+hnSlLH0pQN3u9xsN+V+GuKwtud4gDN3/znTQYi6Yeq1eHflESq3dNSzAMX1DCXv2oebkGKuJrVO3rNYxo9owF2gH77d4dXsD2R0+FGL1j2uVmGku08LuQZHi3GtxZ8Yjf1a51t6YFvDlAsNQ1JIz9Iy+B8rggUxNCh/HgLsrmEKv8VISZjkrBsN1AdA==; 31:Y05vHcPRPo/EpVC4sSTqnfaPCm/iAU6dg5v9aUCTHfXUdKAFGhKi+UfFjBSuL01VumcV2yas2NiyudC4Asw/YB1zV4WwRhKLva5vK4TEkxg9R+vbIiR736AFb3kvJixUx05AYSPcIJasdPEXRzhfIHNhBZymQr1rpZfxE4lzWw+xSQJuCwWwwspsD1XQQ+/LsvU7buJEjeB0yzf8bWK+nxQfC7pAYFoGh8YgVhFNeAQ= X-MS-TrafficTypeDiagnostic: HE1PR05MB3210: X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3210; 20:/KXlzYb9rfzwllazP9CI0kHhxTclEnSuYnVvUt8J9EWrmF0ixVu2/5L6jgQWX8VGFWAMLjtNXeDYiaN6x5nyzy2Cf1xXykHFS2GsonucwgQ3e7SS4e2viZOMc0nl4UDFsCouAj0LoluzzNZuMwGr+mSIsUo6Cos+PnGremFVqD/To3Y8ZiQGVOKSMLj/e97lLCf1TfzbOLu3hdF3wlMCvPy3hd0giIcF0GpO8oscxltY/Fekyp9o6puNzBzueJY5y2heMLFAz9M0VXsHDwPS6H0EiL7klS+uyJEZ0JGdTCCQy1UjQnmWKHjW+3wUJnSJttaceO16WiKX0CEDJKCtJPYdwQH6XQzSs06gqHWBmhgYqonGvUoIL3NWKckDSkJCukDCi/m+QSHp+bmOEweUu4mMxxxmd8WhKCnTQqdR0f2Y+G/xfZA30eVuSJqjHuDiXZbIRtJqISk2dPsi1NnZiaTRURkvv2kIC/jngjrXsAo3rOpUqWYmkyb0vFWphg3t; 4:M+HMNBqdbR+Gz4n/h5/q97meqbyGkXGshXE3G1GOwbMrqgI+QpsfVHuolSMJ69D7HVejWkkbeW7B0lb84mGFgllI5OL8Qs3E8bWUpE/EONBFIFRcJvt2crfLKEiBpotnI+7Bg35UJHwaPV6fShejwEsp28mq4eyIZtCCnpsB/4JwkC0rTPy2x/wud/IKLqiBHT4Qp1ajqaIsnXzDZ+kc/UTSJ/xJt2JoOkAHhAuYfdAMA+E8lTr4OVjkX0U3XyeRuPQYrij09A84lyMP8XrN6esPgntSft292WNudKbKo+ql8G8vVyAzk5AtjpjDFJ9A 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)(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:t70V8BGwvbq7I2uuMZOHXKA1vovBM6ygwLtnKbdjl?= =?us-ascii?Q?Hl11j8KbaglDwHuU0xTOgWpV7/MxSZdDfsCitiqplDR8W2eUIKQCHXo8p+mS?= =?us-ascii?Q?dwnBGDekm6QTuMmiwSyGwRW7jSHuGRErG2RsTyC04CF4qquKIeelLNOqXGCp?= =?us-ascii?Q?08ay8Zx9ZWLojZ6G/KVvqTd8i6cxRas1nmJOpUTHbujXKZIdqGepadXRBpKD?= =?us-ascii?Q?y+eMucinIWNsr0YklIyOeFAew7do23ruRPcV1KPInxjaUqf/cY4ZAaDhEdbd?= =?us-ascii?Q?A3wlIw221G97a6e/t+nYprMvZ4J4CbWOcvwEuev/6yTt5RwHRwlNr8SWD9V/?= =?us-ascii?Q?1Gnfc0KtS6CWPWG7agfw+QiaiFL++fBZ2OpuJcnpAp+w5r8l/LTn7pLgqFWT?= =?us-ascii?Q?ky3n2HJGj67IL7RurjBbSl12r1WW32eAI5Par6+CUzwn2YPihWRKw0qkThSp?= =?us-ascii?Q?0B8bpfceTowzEVu4QsenR2w91MbpJHqmkuYTH1KrRF0yxPsM3j6zYrSb815F?= =?us-ascii?Q?3r0anAJ7ImpJw8fElTEpi7NvuOM8c6zJq600mQvDeVeEkIwLU7XQF5sTMr0u?= =?us-ascii?Q?a/0hG5y/RKEmRpZOUhW+Pne9P11N43rLdPylq/w9b2g3Umx8m5vJJgRzgwSw?= =?us-ascii?Q?CoiLXXYUCx+zjTLu+NaHf+VpuHy7kiJ/1k3FNt2jsPDmHvQPaI1BEIm6df13?= =?us-ascii?Q?mKNL4izOB2/CnLMPhmGkAo8IrTVQ4xuIxt0I5/fxNYJWN+fy/A548wSkT7mn?= =?us-ascii?Q?5D10An69k+TOzSUM4Wgmk9rUX7Z12L1SzDrlya/WDH0N3QpRtiqifdCZ+RGv?= =?us-ascii?Q?jLS6ZIETNZv8TsJ40E0+O8GCSzTh8B878baPXOX0Z004bTVe5dPPVeFyO745?= =?us-ascii?Q?FHoNpYkj58IPp6ENNwwa9sIRRg9QT0WmFbPRYgJU3La0SYFa6SWKhXsrH3/2?= =?us-ascii?Q?s6tv09iQ2bGiFF/nEI4jiNjxVCGLrdgUVzkxi9hOHRdtp75rno80GiY6rf+j?= =?us-ascii?Q?imJ8lpUyfW9VYx580+442vttLWUjwMbVyPGEhZEOYEMyjXNgq5QRIVkgxT4m?= =?us-ascii?Q?Avuwp4oaUfc5b+gVWRAMvCCXV6/zCFTo3a8Ki2d2tOS58WqPERVzpF0EGEWV?= =?us-ascii?Q?9saN7E6IXly/EPuh3Ul91izZIwxSRN2r4GZyQQ1W4/QOavEAvC7QlVym6c2E?= =?us-ascii?Q?FcDyCGehEXqQlwNTR0beMNQrziy2mVYWSWne/UQUFsVwn8HMeED7AFHMw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3210; 6:bSRs/bw4GN2hyK1pK7fd7/rFCUvYquyJzDcTnA8WcKsxPTkLhnqydYlayGoSR8AySSReCBP/UqhGsE9WiIaw2wawD7T1+UJYR+e/d9X1B+aijQRMgDpl5wQIZ386SA/edyTZZfOxLTvpgud+Fta2zEzat2lfeom8P6xKicLFwbmrTdNiNeeStMVo3dTg/SSDpvouV1t7CyCiDtvXhhW5MIjz+EwGYonOofSJcW38tN7BN1B7i19/BkopGyIw0qwTizq6TIvO8Z+Hc718dzYteVyFYwp1vw5hhv+svNgpTbakWqrjGie94gri9n41xOKPH5GjkFMh1ZsUAvg9Yt5yiY/0V4YmHlrCUeWk9MRuwLQ=; 5:zHKqnBgF7LkGbMr1bveO5cuQytMdmizvW35fVPci72jrXHpli9IfRgXewIPREWNivzUkIZpEvpaAASptT5jjOtDy4rpmk/v8lK433Mxdl36m5UElhdydVdFlLgYtBTSSVjNQl1H23mVtRg5lnypLpdeZUqhwUXuFFxA4RIzemBc=; 24:pyW9cP/P8FKcwxB2/iPBsWWsyoN5EiYhpVshCOAAz/5medRLOebyzyZAEvtizzdpNePZbjdCuYVES7pj+dSOUI9HWrlbJ0zPtyxXAnXBsXU=; 7:OyAm0pBU8C/KqE0g1OiVqKDA1C0iwqpW0IrYM5pkJCTz0ZSByfz8npZrmW03tKxM2FR2SxKtMpXb8d+4MlmHs9gZxchqd//waC/6w6+RZ428gd0YAHJYZTLUev+Dh6x/FxnpHXawZayvlUfl2obth0AMMa8deYOhDfyvaNJwnDuBmTU3J0apRm4zuNez26MTxvbCpbWmn5K7mLzABN3c8sC1EtwBvBYXMTYNi7aY024i1Pq9v4QvAX+fbfLwEAVO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 19:31:37.8784 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd49f3a0-d14b-449a-b865-08d553a9c655 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 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: Thu, 04 Jan 2018 19:31:45 -0000 Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API) This commit adds support to the new Tx offloads API. Signed-off-by: Moti Haimovsky --- drivers/net/failsafe/failsafe_ops.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..1fd845f 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 @@ -77,6 +78,7 @@ DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO, .tx_offload_capa = 0x0, + .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, }; @@ -84,9 +86,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 +322,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 +374,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 +602,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