From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0054.outbound.protection.outlook.com [104.47.36.54]) by dpdk.org (Postfix) with ESMTP id 0D8AF1E41E for ; Thu, 14 Jun 2018 13:50:19 +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=N86wZu+JX9yVppnJMueYKJ7C0TW6lHmryKiM6HlWzeA=; b=AwmlTliVKQmAXIQc3O+2RgjN90DmzyW8fCr095+PrOCMptaDbxRxhv9psimGz5AnTeEbDESUwub7HK5JrrszMD8mFfx96hzLrD8QDsFZU1HiV9ep2BxRXqq0VVjk256Bbi8eqIIxxSNNtWLmwpnq8REmlohIQqxUnz5qzsumzzM= 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 BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 14 Jun 2018 11:50:15 +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 17:19:00 +0530 Message-Id: <1528976946-14396-10-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528976946-14396-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: PN1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::11) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6735434d-4539-44a2-1eb2-08d5d1ed0001 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:K5tlt6RWG5o393kPZJ0qwPdYzAOIH5rIVDrBuMGLcNUo722mcnyvHE6r/OaW0qi3vSFc9YBCe0tvNmm7ibvrr6OotGhX1rreCYCqov0BhoQ+yi1VIxmbFtRpRu1ZWmkwIv1wHTY+VFxFZaW1ZQ7bxMHRvIZuprTNxVA4rMuzc7927WqSqAD3AhszzcHGYJHGD6g+shaM1dSw4EUG5URkTekw2Vh84ImN+SYtbAbXQvRJJ1ghECnnD3k1wzxXobiF; 25:UD61LrhZS1KOhkDEX+1LUJxDoMW9aNvhbrH3gd7DYP3YB6YEpIUUmiIfGzhjfCPDvlMAgWumFsBrWdC3kLAUYqxhkgKDR6K7BKP2QAsRuSeGrjuhxeO/1/TDAK7eYcslSqKTwc8QeURZ8hee06ev1s/0blAQnQ+pcFK4eJgDYoJFG8Hg7h60kSVPeS4MsT8MHoorA+vntatue0FHCXjVN3hj7qfuYKM2TyecXSvI4y15fx7lTYVnCNU+19FFx8MleKngS2XesWHW++IPHhbpogps54OdkKeuGYUHGeg0MjgejqJ5WxWcspC64l4wZs0NCbQPk3od9U4Ht3Yol9OkCw==; 31:E3noHjy0NjJlOUkHRdeb3TByPAeh7bMjvCTzBVAs7NRCTGs2JU94IUXFL6NHE4POjzyyzJNuwI+14vMMoc8Al1F5n99OTfavOzTYlgHPVdNDxsApD87hELmFDlFoCAMrYpVd1MTZaG7u2lOzMvWxq1J0iI7gdXbbH+Oj2mPruIda7dU/QKG7+FqUIc82uIJlbylZLsXFGZOVcTgfYr4JgjoWWQEzb9QbNWm+eIGOpKA= X-MS-TrafficTypeDiagnostic: BN7PR07MB4898: X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 20:ZXTdZK2p5DYFXy0wGseEmXqveky0NeGJWk3kjNVumVwHTwNEdewKuFPyZkrLKcj78D3Gq1cbZCdsrWfCDk9/WZVtsbi2kj8pr2A7OmgYbc4xm3TNvEB2onk0rs+tcGWOhSwv5vFh1eNonw3evUrmatSrA4K0WvhOjOrso1qMqNHNKjtNME7q5eHSdkioBEoz7brvf9db9BuWPfQ1BgiAKZ8OpTmiGgyTWsJJce+sS3fvZ25mMMOL0vTLBVXIDn1fwaUi9L3dgYn3Zc4un52nevnUQbHM20s0lbwQUVF+ECW+jaLvmHsN30ejCFePF7C+cD+YtnOQzNDKae3vGwevbtmJgLZAFsFf+tLKqV6A12nY614L88E9xOAAmfbehItusplMrvNLLWfnKPspH0cBRSf5KfCp+zDdbcNZnEvTjlpkwMW3J7GZz2aqssBK5Dz7di4Tz7E+1+dby2g1oHuf9bPTRchybet6rKEkr3dTaHOXLvz2XMbdn93eumCGIw90QywzxsboVBO0aTNot5zOqLgluVsfn6VLAZcCWSSafbzqsegQ47Lxs4ufaA9hm+UXug5EHQmPWgGjMBu6gMSoMuE1joIEoEU7+cjJADxqvW4=; 4:YnDA02yWRJeXIQE+pEZc6Ci9E8H7XhM6CcYt8V8jjUMcO9NTdPTHshwY1p1t20XETrlkj0ITzY6J3E7r1uACM84WKyd3E4HwF0uqyvIqKKZZv6xvjY7i71Kmzx3bS5+B50sbyI7USfwC3jA7SelHPNbfXXGC9Uo6a5bloDjnQRbI9dP5JB8uK/wqwfcdf4h+FKt6648N+cOhWF5QjkDVDrgNwHhHwFaVUu06RAj02gfTKN10o3f6UNtfFOUHlvWtRw1XUMlb4ZwNIk+BbgM3IA== X-Microsoft-Antispam-PRVS: 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)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(376002)(346002)(366004)(199004)(189003)(446003)(956004)(2616005)(305945005)(6666003)(47776003)(476003)(54906003)(44832011)(53936002)(68736007)(486006)(110136005)(8936002)(8676002)(81156014)(16586007)(316002)(81166006)(25786009)(4326008)(7736002)(6116002)(3846002)(11346002)(97736004)(36756003)(106356001)(478600001)(105586002)(42882007)(52116002)(51416003)(26005)(16526019)(186003)(50226002)(66066001)(72206003)(6486002)(2906002)(55236004)(50466002)(6512007)(386003)(6506007)(5660300001)(76176011)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN7PR07MB4898; 23:7wGNpgNLb2KpxSGaoQKRa9ILW3YM3SlL5X2lXwmDw?= =?us-ascii?Q?YSXiCaci0TQewyJwCKJ9szTTSm+PbXsY+107RNVJDBLzGICt6BXHwTyIko2R?= =?us-ascii?Q?h9BT/2KT6dpIVJpxmsNKtlmdqAVXVONJ2/pRfc1WvlP7y9uNjr+E0T7BTwiw?= =?us-ascii?Q?Qk6lK3W1xkir2uXi4WOzK5FeeZvOFd/nPwcMKSEkPmnAX6sM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cqytCwEBOCopGR/vse4AlHqPGECzeVHTYxHDJjHjSQkCVT12IS3sgaPs4=; 24:U3DMZvLuMLgCmyjVZ0LeqaD55dzXotyI/nvv9xcK4qgFjzWC/5mnajCHPITi2OGh9onB9Nf74Hr2ePyiowxY/9+D+GWHoi7sW2CJKJcoW4Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:KGwcmOgqxWMWCbzLbEe6zX6da3LJmVVFjJsnL05NLEvq95LcdjsmwVv/GAThNNVTHjwAxZ1109ojngKGrRjLnA1hzU2UiEvErbqU2DP8eAveEGH+iCJHowF9pcpDSJuolO9O83H6x1HMkCS7Z9HjL2gqDuwaZ8cOd/emZ9mQBc3rUa+C4/2Z/8p9D4+Fe3lgArhJr+UMCVJfcckJRT9anDK0h7+JlR+Vn/FIV/aQ2SRh38apAWuEfW551rcfJxsG X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 11:50:15.9656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6735434d-4539-44a2-1eb2-08d5d1ed0001 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4898 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 11:50:19 -0000 Signed-off-by: Anoob Joseph --- v1: * Replaced 'unsigned' with 'unsigned int' 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