From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0055.outbound.protection.outlook.com [104.47.33.55]) by dpdk.org (Postfix) with ESMTP id 655C52C0A for ; Fri, 9 Sep 2016 07:58:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+R+J0szEhLknSzfHqxQ9x7qQibN6MU/kwKmu86CC6GA=; b=lo8hjGOaVGCj62Rf3UXAXrpwvnES1uTX0xxiCuhK57/vp/CU1snCQKDgrkiP8Q2wEdB6wijt16luVbOUBq72lfPklzTs5WHVRIjwq3ggJHTZHIV75zOV3l81VOc+b+XxxJjnxbjOwykk25oi0TctlFkXYzCsapBBjTZVYVhA+xw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain (171.61.104.44) by BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Fri, 9 Sep 2016 05:58:40 +0000 Date: Fri, 9 Sep 2016 11:28:17 +0530 From: Jerin Jacob To: "Kulasek, TomaszX" CC: "dev@dpdk.org" Message-ID: <20160909055816.GA6012@localhost.localdomain> References: <1472228578-6980-1-git-send-email-tomaszx.kulasek@intel.com> <1472228578-6980-2-git-send-email-tomaszx.kulasek@intel.com> <20160908072845.GA7333@localhost.localdomain> <3042915272161B4EB253DA4D77EB373A14F050BA@IRSMSX102.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <3042915272161B4EB253DA4D77EB373A14F050BA@IRSMSX102.ger.corp.intel.com> User-Agent: Mutt/1.6.2 (2016-07-01) X-Originating-IP: [171.61.104.44] X-ClientProxiedBy: PN1PR01CA0069.INDPRD01.PROD.OUTLOOK.COM (10.164.136.169) To BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) X-MS-Office365-Filtering-Correlation-Id: 38a7c112-79ea-458e-8db7-08d3d8765a52 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 2:TIwv5e2f0HnnBxTp1A1pLb6C7CKvvJ30coZNuMSWOUn2hWJ+002qBoYU3U5aImvOw4cB14RdQXMVpEI1Vh2meLBRTjr22YVssbQJ1jt6QTkHQcD1eqD/weElQEASkvBN4V43dsUu0GuSk/RjQCuElJRJ4yJzNSKwY/1ToGWlooea/aEnRK2+p1E1EgEjFl8O; 3:JCyXo5+5jZo3inLFZYsbmEOYiTx136nAHwWSp7LjkGTlWA3txnwJoPToLD6uMxjBIoxKq4cy4pnZmsFPVWG+ic9wPAMgfxL4NUinkugfNc6ZdGloTExwg1gvfY19DKo4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 25:Gi8wpVis5IS4k6Ti0Idov3KJOdq96qa1P26kCrf8bj5yccOOw3LuPvsZyRpoiHq3TLBVe9kaQewICeSaFxxl/uO4mSz5iWyNgi4CkPexlb/ZjHO3WLao00QLcqV3oodLDbSOepnenC7qTrh3rLTjXdtOU5umaOriCabhRsws9TjMD9/hFeYHTNxe3TiR8uR9brqvM17y7C8d9wfEZ0vJQ/bf0Q9eHigSC8CkoLvgAXAu1UCyzxRzyo1gIHielQJPsTftpNVSj6Ce0NVlFvnqWcSqCslJ3Z2Tv4tQqqJ8AwTaV3Cgyj/DtOOxDE+mq3/0zNkyia2MlG7cb1FTMzKnzrGxjr8zKQEc+dTE0W60iBqrgpSL2DGdtWq/g57jTVbzkXSuCr3lnr85rZPP41FcT9+o8rf0AtZvLKRdBZ1VO3JGEAHH+1bDTi4oYBVA0cGKGv6oZ9iy1YILJPXIPOAb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wbEnPVBFV5usV6dE9I38uPgtXOrmz60rRaEZKmy5oCqe/1LmNj+dcwRPR7kEi4oPK0jjxgpDeKPFo4ukcHVv8UMdE3lLAoJSrNBbcG8k24SSHDMahQbNquxqpWvTAlP0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:sgwF88voQbCNA/fJV3p7y9M8XcsnZgB/qZqTtm4kfFNx6uD8u1IQjFhJEcRKGCqvBQdiOBWqYePKqqIhvVExQ5DNeP2uQ/Q1XspPQsFL+xjDajjOvv6bVzzGDjn1doDiskg+X5fg/8al+C+BTmwo6wJX12fEG7XgwB37Cr+z7vtwOVYU7F3MzwJ4pOrNX/RUhsCJ83EsDBW8nN1zi1iCxkt1JBIJt3U8gj5wb1e1Yyk2aASdPd6a2Dfacg5uC990qLRxBQNpW9VbK+l/QevtQd0cP7q5XL4532AgUtpYJ8A84r8JmDIJ7Ih43ot9X1IvS+Mkrd/sCEl5uIpoK/rdV/juxtUfpPI57Edxz0CZOvvpIpk9AMiI4d7pynxg9tgCXQ3VYJdjd1/FpRQsSdbgTQXVyRjeG5f+DccTgLcH+K3s52R/uNE9RjPezMpiNvLy X-Forefront-PRVS: 00603B7EEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(24454002)(189002)(13464003)(199003)(50986999)(54356999)(76176999)(3846002)(47776003)(106356001)(97736004)(42186005)(83506001)(4326007)(8676002)(97756001)(7846002)(105586002)(68736007)(5660300001)(19580405001)(81156014)(2950100001)(61506002)(66066001)(7736002)(19580395003)(46406003)(92566002)(189998001)(110136002)(1076002)(81166006)(77096005)(101416001)(6116002)(586003)(9686002)(33656002)(23726003)(93886004)(50466002)(305945005)(4001350100001)(2906002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1724; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1724; 23:VITNX2UtFfRP/ymQoPgqb3nM+98pTryg2fuiSMn?= =?us-ascii?Q?JRE6doPCe7/ImdLwNuP+Po8e8RTToeIu2dOCLrKPgzjlhJnAzHbkx5FpCA8w?= =?us-ascii?Q?C7tKJo09a3pBQEt842D8A48C2odPnSIN9FBaLFpUB9oZnURhQvXC81Vn0z6H?= =?us-ascii?Q?Q3TmDUGZQx+AkWnYUCU9imrOS0EMtd6t/+6T2G861DRZzbguXLHd1bnwI5ZX?= =?us-ascii?Q?iAl6EVM63LtklL/kB/pOzLqTvD7mlXiHlt5nzFnAUuyqOIfO9728a1UEbF7i?= =?us-ascii?Q?1riTLKqy3Cti8BT+Sf0MIQssuHRXtGkLDbwWyUxK0tm0+/nQbD0PRqaidIq7?= =?us-ascii?Q?bEN59GFc2zHrUhpHCdBpcQmgmJBy1iqpDzzbwh40JO48APus7x8G3uDS6+47?= =?us-ascii?Q?kyvA+ZPIe8adDF/qk5+PRh0mZs1sjeND3o5qHnsghMLWgWIqQmJ5vR8YmVbt?= =?us-ascii?Q?iYfj7ePrsoSFlH8K3joL7xxPA6FbhKuc8MR4hWbvy2RKHQSiUsHAHXraCmcL?= =?us-ascii?Q?d9p7jf4ywGWidXtSMygLpJ+a2yX2sy0rgO9dAHS9Kj+wO5lMyEooAO58hxre?= =?us-ascii?Q?oBG4CPWVELM719qCYwO6Xs+ALHeqx6LTnBe5DKdE04BaSPxlBvYbUDKLjr9J?= =?us-ascii?Q?dJfkQMkc7Qr21oEvmgOezRq41kKyripx3UCLB2s2AFQum0iFyJGQe1C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Uk7UtoT1440dRlXqZrKNwna8CQC6KLwRCiF1aVbttAMeCtm7ZsJAwEfQqREXalQZNqrggvR8eoQimO3KRdSG105RdWz+hMBHhPw2Kw3LcJESPEWWVFy/tA==; 24:2iBF2g2wmbxhRAR+8PHPEN7Dz/Nc5omg/2Oy486grT5VyAv+1itmoWURq3uOeeTUMIsosMToKxZ6GrLY26ZcQsQMs1wFYrZyJgq7vxKezXQ=; 7:TuCiEy1LKUcBuPTUa2CdUfIqa4irCGXlIc3/62CCwufp/PbaUqnq1FIC7a7Wnz9eIT8+0Yo3KfTHeu4nHUdcwJ2sDiGehqIYm5Oka1gVKEov9n4VfQfUIF7V7KsgGTaB0s6BgE1SCGdLV5g1Dj3OSfxEFmy51K9yP2AROxhdfGRHn4rAc8uYjMtOSHsV/n5BecscjW+6o3+1v3RHZwyoXuo4mv195t78+12iObOqkGNUG4KFaseFHAoTrlx7mnt0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2016 05:58:40.9461 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 Subject: Re: [dpdk-dev] [PATCH 1/6] ethdev: add Tx preparation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 05:58:45 -0000 On Thu, Sep 08, 2016 at 04:09:05PM +0000, Kulasek, TomaszX wrote: > Hi Jerin, Hi TomaszX, > > > -----Original Message----- > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > > Sent: Thursday, September 8, 2016 09:29 > > To: Kulasek, TomaszX > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH 1/6] ethdev: add Tx preparation > > > > [...] > > > > +static inline uint16_t > > > +rte_eth_tx_prep(uint8_t port_id, uint16_t queue_id, struct rte_mbuf > > **tx_pkts, > > > + uint16_t nb_pkts) > > > +{ > > > + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > > > + > > > + if (!dev->tx_pkt_prep) { > > > + rte_errno = -ENOTSUP; > > > > rte_errno update may not be necessary here. see below > > > > > + return 0; > > IMO, We should return "nb_pkts" here instead of 0(i.e, all the packets are > > valid in-case PMD does not have tx_prep function) and in-case of "0" > > the following check in the application also will fail for no reason if > > (nb_prep < nb_pkts) { > > printf("tx_prep failed\n"); > > } > > > > Yes, it seems to be reasonable. > > > > > > + } > > > + > > > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG > > > + if (queue_id >= dev->data->nb_tx_queues) { > > > + RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id); > > > + rte_errno = -EINVAL; > > > + return 0; > > > + } > > > +#endif > > > + > > > + return (*dev->tx_pkt_prep)(dev->data->tx_queues[queue_id], > > > + tx_pkts, nb_pkts); > > > +} > > > + > > > > IMO, We need to provide a compile time option for rte_eth_tx_prep as NOOP. > > Default option should be non NOOP but incase a _target_ want to override > > to NOOP it should be possible, the reasons is: > > > > - Low-end ARMv7,ARMv8 targets may not have PCIE-RC support and it may have > > only integrated NIC controller. On those targets, where integrated NIC > > controller does not use tx_prep service it can made it as NOOP to save > > cycles on following "rte_eth_tx_prep" and associated "if (unlikely(nb_prep > > < nb_rx))" checks in the application. > > > > /* Prepare burst of TX packets */ > > nb_prep = rte_eth_tx_prep(fs->rx_port, 0, pkts_burst, nb_rx); > > > > if (unlikely(nb_prep < nb_rx)) { > > int i; > > for (i = nb_prep; i < nb_rx; i++) > > rte_pktmbuf_free(pkts_burst[i]); } > > > > You mean to have a code for NOOP like: > > > /* Prepare burst of TX packets */ > nb_prep = nb_rx; /* rte_eth_tx_prep(fs->rx_port, 0, pkts_burst, nb_rx); */ > > if (unlikely(nb_prep < nb_rx)) { > int i; > for (i = nb_prep; i < nb_rx; i++) > rte_pktmbuf_free(pkts_burst[i]); } > > > and let optimizer to remove unused parts? I thought of creating compile time NOOP like this, CONFIG_RTE_LIBRTE_ETHDEV_TXPREP_SUPPORT=y in config/common_base and and have two flavors of definitions for rte_eth_tx_prep #ifdef RTE_LIBRTE_ETHDEV_TXPREP_SUPPORT static inline uint16_t rte_eth_tx_prep(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { Proposed implementation } #else static inline uint16_t rte_eth_tx_prep(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { (void)port_id; (void)queue_id; .. } #endif > > > IMHO it should be an application issue to use tx_prep or not. Some cases even _target_(example: config/defconfig_arm64-*) can also decides that. An example of such target is: Low-end ARMv7,ARMv8 targets may not have PCIE-RC support and it may have only integrated NIC controller. On those targets/configs, where integrated NIC controller does not use tx_prep service it can made it as NOOP to save cycles on following "rte_eth_tx_prep" and associated "if (unlikely(nb_prep < nb_rx))" checks in the application. > > While part of the job is done by the driver (verification and preparation), and part by application (error handling), such a global compile time option can introduce inconsistency, if application will not handle both cases. Each DPDK application build/compile against the target/config so I think it is OK. > > If someone wants to turn off this functionality, it should be done on application level, e.g. with compilation option. >