From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00067.outbound.protection.outlook.com [40.107.0.67]) by dpdk.org (Postfix) with ESMTP id 68E7B1200A for ; Wed, 17 Jan 2018 15:30:33 +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=HghYZiOuBrlPXFv9+AdFxxfUOsrILycchfCAROW2VYQ=; b=HUrstWfOYCH3veycZ+6rDwMadNi045zvAiSgt7eybWmNCywKXGH98OzZhLDW2mvpNeNkwj+UXwBR5oEVaZd+sB6yaQINttBS4Xsm7crT51Unt9Fer2usK/93CTPA9gN44hwIn21dX5Y7SaanpH6AKkt9FETIW7/uQxy51L6edFk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:3::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 14:30:30 +0000 From: Moti Haimovsky To: ferruh.yigit@intel.com, stephen@networkplumber.org Cc: gaetan.rivet@6wind.com, dev@dpdk.org, Moti Haimovsky Date: Wed, 17 Jan 2018 16:30:12 +0200 Message-Id: <1516199413-134187-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515595223-36144-1-git-send-email-motih@mellanox.com> References: <1515595223-36144-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1P189CA0024.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::37) To AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:3::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 59cff473-3bb9-4df1-bed5-08d55db6dcb8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB3203; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3203; 3:QNjDPu/P3gj0CAtj0+21u9AgqBLFbKH7qc8WXedfp8zjyuagwHmjF4Y8ZqFjAmCFeXqxvdoT8p1AvNwfli9IOQvee53gzqm03gHn6HOTyGt9l/cwmYZ99pXy/TFnh1O1ICejrIW7psySuWEjXB9i8eToVeaEK3kJlaYv+qlNX51BS5HIVmtjPKz06IIupQXo8WmmC7rw/Jv8kvmTZjqRxENFuxf9CMEM7atKWEYdVkr5X3yZuBR+EdkJLq2NAN1V; 25:0ppx8x0i/71jEKOLTvOgaZjJSteH8S0h7RIWvBKTqofws8OUfv4ZEC91GINovXjbxD0reBm0p53rsAW3LmgrhXS4UCivxDDJlnSSgLUan9eigbb7nZJOuIlc7TFwp932e7We6F7yvyAVceJdhI6wDTy3pXUTg7puVwaJCKZGl6EWzd+aiPFWGU0GGAkcoNs6oxgVMKSKAzg+ZKagvVYiq9rM8slN2TuVXRrDXn33tDJfp8xLm3l4YnqBrmDuM53DSMWF2W1QWA4XaeYVhzl3T8E0up051lAEpRprtkbrm3MSkYF6x9/op54UwCnvqouOs9oNZpc+gZxpMPCQ0HseRw==; 31:wkh5+PefVHk++H4b9IdD6tvbVK35AkzWuGDG14D8skRrXuHaff0+bZU8lvNNE6CDzWjp6K7h5q6kiwKL16dT0nXax7ewWn8pAAtBG94QVIIh1qoiko6SqeSuQYkg/RZJTXS9vJJTjjpBB1vlb01axkikvxWOFeAlQl4rh6p5f0pSgRh6XZDhMiNk3kJzNR8L9Zg2f0UuwWLgn5XswDVDl0gpwgmZXJGbunjHmaUyhPs= X-MS-TrafficTypeDiagnostic: AM4PR05MB3203: X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3203; 20:kYN2MXDd25PmlDz7NEPC0SfO3pn+rjgpZvlKPWjcURCfpkEqvTEtwv7iv8dVrSnoi6ZdfCAm7rzk20337l7qh9GfkSE+WXY63Y0FiGWD1F9ONJK8LAdU93mEmtkfjxoohfk4kWU+wCtuKBhEOyCnNguEBYHuxqKU4Kaot/uPp8oQHlzYkdnh7wr7JSYDbQ+TvewRYWVsdVOFxDrbPp8fJjpDSeoustn3MXDY9xUuSaIrcbMtT3O3CIoqKLqEwHiE1ZMJBDQdvd3xH3iJG92L8yV6I6gO06oiM4FiCz2TNxA6FvAhT5wWMkG5QVQcwowc23wXyiixXTKbYJG/kZLld73PYj8hoih2vTEiw4UHeYcLGllr1nSANPG1aXtCsdvBxSRhJAWWXEAMMrkRdBSV8OQ1kHfOEKSnSSYhNPy2KEwDAB4OPa/9Pp1clsC9aMJBr8CBBjYT57KwF2DNZCAOm8+moMgFwWYiX3GHNDEVz6crzaj7uk0rHr+v2uK91Dzx; 4:N0DMJ5hNxZKZjVU5kGVKGmupmMRydQelp/ael80gVZVCCSOR4bGtdI4/I87k4WcDIUSZXJyK4+xtgSS2EdLcx28pD1LsAltCv8/AEdTjl6kfPqlSB5vg/X7GEmBpCGLQMU+uKm7jaam3ghnxH3Y2VFpIlF1AS3qAPtlStnT4ciJIBfRR1Zyj8BIeK9Xml3TB/YE0CkQ0sydrN9ZQTpQC9UK60hIqSVX1IL6dDhcE3PrT4ObIg+9wBLLoxb7p0Vhrr8vcmaBQbWT7uixMeb0F2dayrXBDNi9ntDRGEpGHVdFwhsrmXTPvIZ0DjJ6CFBZA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501161)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:AM4PR05MB3203; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM4PR05MB3203; X-Forefront-PRVS: 0555EC8317 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(69596002)(8936002)(81156014)(97736004)(7736002)(36756003)(305945005)(55016002)(6116002)(86362001)(3846002)(50466002)(59450400001)(386003)(106356001)(81166006)(52116002)(8676002)(66066001)(76176011)(7696005)(51416003)(47776003)(2906002)(105586002)(48376002)(4326008)(107886003)(68736007)(25786009)(50226002)(6666003)(4720700003)(2950100002)(53936002)(16526018)(21086003)(478600001)(33026002)(5660300001)(16586007)(316002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3203; 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; AM4PR05MB3203; 23:KFUuJQ5CGiB2xsZ1uVz9XMq7suzT+KXjmBwBzF8Nv?= =?us-ascii?Q?3dNpl5QOxhdZEtEQqKZ0/JO2kdEp/GpbvNto0c1G6SMEI9+tRWUd+BNTCiBm?= =?us-ascii?Q?0f9gN1pIgRGjpAJC5oJFVW396PoW2vL9keTNEbIGCuAn2i6hgvT9yVg7Kbbu?= =?us-ascii?Q?VcDMAYEm3mMg/hwXYmgy46mdyU5i5KMNfvRarSQclGInD+SAS4/T8GMSgbZI?= =?us-ascii?Q?8uUnHAUmeCKUJUUCN8bJQsiSB3wPlE+V4BfcUEuUYntU8rJMytkj6/buiPQJ?= =?us-ascii?Q?355fSmXKhkIlKLzTYBVapOLjW49hEqNbQkRC1/buxvZNRQG/BZeD7P4k9Oq3?= =?us-ascii?Q?xyWU00KTmqFSN+cZMF/uVnvfOch2rqZ49lZNy6d3xps1dnPwwl4MWfDv/FJ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liT6yjDCtzJIooCrU/3voh2CF9Yp7XfLhIQL6QgOtvdQJxtQywKT6HGoxWlhButDMkmMa2XJq49c0QykwW5nCLgfqG083MpijUIeaB7hy7vE2GFlsEB5ME9XZY8aXAIqboP/vHQp+2ulBs2z6gXz7j10RnWgiFdX03P85SGw92iJSrtCAWp9NBuXV9AcaqIWuqixLAfySzSayhxYIU9du8bDhKw4B18W0KEmEQ9WybMc4ejzvn2CPSOlX/v8fyyj7NTstMD9KTAtuT87CuzopQt4M5YmSyEDONtf5BcGMlJ8aZWBE+P2Nvx9WBQfrXbN+gJ7YYwMDb/CvBp36ZQFkg=; 5:r7beGELpOemXzfq7oQHifcRnKt7w7hKGhEZ3jrQYVgLee1BN9do7PShU+jJ4i/u4h1rg6o+DzGCkKPb+XqI6+PkA5NZ/YDmZHibu3DaBFqUYWnwOhuF5vMxrILX2NfxND8q1IGu2Ykq/3FFh+F773hVpQhS0A8QkiXFxJJbwwIU=; 24:Dit4pKVkoFxnRcf1ka3j2HXnUAUL6P9WBCrTEH01KuJgfC8KqCXxd/UrTgA+5AZcgIrs8jrbyJNVx2ncxjEgdRX5ULsch9rvJDJoTO87iX4=; 7:oDlNf+hVJdvJ5mMoo/AR0hVIAdw9Pu8/I61eLK2O8p0DRG/pbr6l7HLzkehPw/8CnjaI8qWAeTomncX7YgUH3+uO4N38MCV/yIuvgN+DiZMT8J+rDfSAPJ5KJ5yrNNtFhvx3WIgjSGFyCtO+6OKkDHJxkOwmZu8HekkCJ4R53Gpm1Qa0Zc5XsXkSj5FtK8V9CUaIBpC2nqqArkYAwBo+kvzZE+pxhTQhq0jmhceEQMLILS4gPvLv/0tCUzsMNf6/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 14:30:30.3819 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59cff473-3bb9-4df1-bed5-08d55db6dcb8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3203 Subject: [dpdk-dev] [PATCH v4 1/2] net/failsafe: use 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: Wed, 17 Jan 2018 14:30:33 -0000 Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit adds support for the new Tx offloads API. Signed-off-by: Moti Haimovsky --- V4: Modifications according to inputs from Gaetan Rivet in reply to 1515595223-36144-1-git-send-email-motih@mellanox.com V3: Modifications according to inputs from Stephen Hemminger * Removed unnecessary initialization of tx_queue_offload_capa V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index fe957ad..53a242e 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 @@ -84,9 +85,20 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads; + uint64_t tx_offloads; uint8_t i; int ret; + supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; + tx_offloads = dev->data->dev_conf.txmode.offloads; + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { + rte_errno = ENOTSUP; + ERROR("Some Tx offloads are not supported, " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, supp_tx_offloads); + return -rte_errno; + } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -312,6 +324,25 @@ return ret; } +static bool +fs_txq_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads; + uint64_t queue_supp_offloads; + uint64_t port_supp_offloads; + + port_offloads = dev->data->dev_conf.txmode.offloads; + queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; + 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) { @@ -348,6 +379,23 @@ 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_offloads_valid(dev, tx_conf->offloads) == false) { + rte_errno = ENOTSUP; + ERROR("Tx queue offloads 0x%" PRIx64 + " don't match port offloads 0x%" PRIx64 + " or supported offloads 0x%" PRIx64, + 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, @@ -560,6 +608,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