From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690077.outbound.protection.outlook.com [40.107.69.77]) by dpdk.org (Postfix) with ESMTP id 58CF61E9B6 for ; Thu, 14 Jun 2018 12:19:18 +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:X-MS-Exchange-SenderADCheck; bh=5EJBjODc5pxkd6a5n+Or+MPf6mc8SdDdN4esUzXMWak=; b=UKIRw7uJCddi2cQFZlQidSYwnR00itVt1hUFVzcF6put0N7v50282ji27llbMqiQXqZ8X6wiTvdaNQobrGVkA6M1Swyssnm+uuiXzwDFOUxWZLOyI/ew95jPDR01GiH0durA5DKTZyvBGpOLfrolSQj9hgnp1oKNuoMZluUOSwM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.19; Thu, 14 Jun 2018 10:19:14 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Thu, 14 Jun 2018 15:47:51 +0530 Message-Id: <1528971477-14156-10-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528971477-14156-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528971477-14156-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::17) To BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65061339-4019-4881-4148-08d5d1e048e9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 3:cG6VSjzeEji4hwYfXAtaDl47eFo/+NAoJ0s4/WUtoIPlDqVDIvsg21oYwIcyXtrZobjIgwOM3mJVgSbrh9VcoM4EnjAo/GbQhnRcwU/R3tie7FCKjR03DN569to8IC8/bkQUDV7RgYr6yWTnE47ZIUnjqIB1AEQPtOLEhN3Y0GuNOiutcmc4jTt7T4LdLcJhEvjBAekQBJMvtia1i23rTNT/u/6+bBGNwEsxzzH8F/0zPRWb02LDEf0WuA5gJ5o0; 25:dnTew3N1ErA9SOUGimqBHcDTjo8G/cv/7QUwrxo2etZIqFgIFlq4CwF+0sKGZpe+jRZ1Kq+6IPsbpJKhY+8Yn2Uc2e6WcU4PlikDpRDPHqK8ofbXFMK3YaRKYbHDgNmtfdWoZ+gVH/rCTgeKsndbS7O0WFeBckN2VrB5+o7cfTTAwuRQ3nghcenBaZo84oy/upCuuhdFAz/ZpmozNB4bDY/7pnta4naYn4zIjZJqGnkEWOxHL6ixT4ZUgJvWZmKnRkOvVqeHfu4V8a6VvDdIL52laG6lNU8AcNUsEXwWjN/aG5Nc7iIVvg+138HLBcK8Dnhxkmj7n5sc3xtUlHpr4w==; 31:zpTntrIveH7m7huqiJLyNGzjVknDPSL0z81uLa72JUhtKXCnOXW4xrlRRraSfXSML9eSk3OZ1260o008Aet7j/pwe0J8gB6Bn1m2TVRHor/sE6yqQu2PAkkUhsvQGYz4oQiCJDlyowRDF/x4Y6NfK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: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(39380400002)(376002)(396003)(366004)(189003)(199004)(316002)(6666003)(110136005)(68736007)(2906002)(66066001)(54906003)(47776003)(6512007)(5660300001)(50466002)(72206003)(48376002)(97736004)(6116002)(3846002)(53936002)(16586007)(105586002)(478600001)(6486002)(106356001)(6506007)(36756003)(11346002)(956004)(25786009)(4326008)(50226002)(16526019)(186003)(81156014)(486006)(81166006)(8676002)(7736002)(26005)(8936002)(2616005)(476003)(386003)(44832011)(55236004)(52116002)(42882007)(51416003)(76176011)(446003)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR07MB4902; 23:8oyweKYODU43+xA5528M0ge5jBQWa4/of/tF+SlB8?= =?us-ascii?Q?FAiTxKZFPOqmsyRVWQGBYx29/7FYnirRY3JqSWAf2iTTj0kl4GMP28VCfcLd?= =?us-ascii?Q?4tR2C76B0bn7maI08KYV92JAsk9zP84pNikjVhT0e4R9p747xsRPF7CbkbLS?= =?us-ascii?Q?vT0uMBirT0NlhXggG04/r0c2vcKHV9lWj2QmXzhLkHRrj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qjjWkch3SuVixLgvJsP3TzfDxzyhmMeMQZfRC4Vc/wmJCCp1FGp/zOqFm3CoJ/G32he3Zt8faRtZQ=; 24:a/cuSbH5TH1E2DuOBD7Uk66MXSQkyq2jPfipJmZDgLWCBgrOZQ5uu0+jJFPzhK/UfQV950aTPaGFnIl5SmZg13JBYqvSSbjmwgalMRIeMvc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 7:LcBktpJGR5+FpbihHiQcPWFSy+rpsV+to0Yaqi1YWRkU5ocWepRrm8GeOvuz2u1twwB3OUHiWsWrw8ePpyiFnNTNySSFYy4B6PPUbKc5pj5oMZE4UUbhWx0ZLRhkEUlOe1OhKp3N7rda+n3zJtcoPmKwGwYT9lnuyfUVlRrlREdjq++p6/iDwRspXkM7QDKeSV75wf6UrD6oyMJ5UrGExq+2nZk+HmxrbhCl+yp93fqjgXWDW5zj802zhl0ERnwg X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 10:19:14.5512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65061339-4019-4881-4148-08d5d1e048e9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH v1 09/15] examples/l2fwd: move drain buffers to new function 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, 14 Jun 2018 10:19:19 -0000 v1: * Replaced 'unsigned' with 'unsigned int' Signed-off-by: Anoob Joseph --- examples/l2fwd/l2fwd_worker.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c index ad5468a..dfa78ed 100644 --- a/examples/l2fwd/l2fwd_worker.c +++ b/examples/l2fwd/l2fwd_worker.c @@ -76,6 +76,24 @@ print_stats(void) printf("\n====================================================\n"); } +static inline void +l2fwd_drain_buffers(struct lcore_queue_conf *qconf) +{ + unsigned int i, sent; + unsigned int portid; + struct rte_eth_dev_tx_buffer *buffer; + + for (i = 0; i < qconf->n_rx_port; i++) { + + portid = l2fwd_dst_ports[qconf->rx_port_list[i]]; + buffer = tx_buffer[portid]; + + sent = rte_eth_tx_buffer_flush(portid, 0, buffer); + if (sent) + port_statistics[portid].tx += sent; + } +} + static void l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid) { @@ -116,7 +134,6 @@ l2fwd_main_loop(void) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *m; - int sent; unsigned int lcore_id; unsigned int master_core_id; uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc; @@ -124,7 +141,6 @@ l2fwd_main_loop(void) struct lcore_queue_conf *qconf; const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; - struct rte_eth_dev_tx_buffer *buffer; prev_tsc = 0; timer_tsc = 0; @@ -159,18 +175,8 @@ l2fwd_main_loop(void) diff_tsc = cur_tsc - prev_tsc; if (unlikely(diff_tsc > drain_tsc)) { - for (i = 0; i < qconf->n_rx_port; i++) { - - portid = - l2fwd_dst_ports[qconf->rx_port_list[i]]; - buffer = tx_buffer[portid]; - - sent = rte_eth_tx_buffer_flush(portid, 0, - buffer); - if (sent) - port_statistics[portid].tx += sent; - - } + /* Drain buffers */ + l2fwd_drain_buffers(qconf); /* if timer is enabled */ if (timer_period > 0) { -- 2.7.4