From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0079.outbound.protection.outlook.com [104.47.34.79]) by dpdk.org (Postfix) with ESMTP id D342B1D003 for ; Fri, 8 Jun 2018 19:10: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:X-MS-Exchange-SenderADCheck; bh=IPDn0m8+KzEKK67fSC6OaQjwjKrPVotJaoxMMBkMASo=; b=I7VEjOuojJu2x26SrXiRd/G/vqMl63Jgz9TR3a+xHPBcwlp+77O/1ba2OAene3ZPuzV+JxfyJ6ucil3dQAJ74lBF1xzz8KhNcBkm4t9tRzwGYy46Zo6PFWhLMtgcTNkuCxyYTlAlK7JRlhiEb8Z/I/ZQ126d5EAkM3qKtJl87sw= 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 SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.15; Fri, 8 Jun 2018 17:10:40 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Fri, 8 Jun 2018 22:39:20 +0530 Message-Id: <1528477766-15788-10-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-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: BM1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::27) To SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4911; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 3:xg2sJx1qrB7gFwjh/jpNIjA5/OpXMU2yjEaV/ulAUJWTj24OdmZMwd35TLhPts2e27aOV9D8t/WhcFTpXvv6hN3dW1g4z386SHhRA2+IjbjCnFUWpPiKj8wBXRlJnd+GEz1BC/UayllaKYoDWO0UwElbCUSUZTizXXa0xARaoEoGhl2GrB6sW3E2gYj1wfkISyodYrNwx5xkGvBdfT0rza8dGI23eiOj1V2Ylnpa+H3PiTCrjqsXCeDNQ6RI00MA; 25:+63J735EZuUWXtcVhmcGAK3jlL2W6UNTgabf/sKepomg1D2xchD1AI2Q1agALi0QjV+wWx2wcpN61zsuVriNJHmTi/gy4Clrw7Rgf8mISNfUcZEJCsY2SnSMVbjNKlzRn2frtdlwb21rYBugPqtiJXpLBViikHZwlyMP8Afx8sgBuA9UL3/9ltbg4EU3CdM6muuSEeInZFW2suAetQK8L9qJQeDK6+xV5OUvPeSBmLG98gjt6lHtYA+jvR60GPPDwyWaNsJXm6ozV1bLWGL8HqTWBYULBGN4jLAAhcll9DZK1XPHZe676kfDi9tA6f4R6TbwJq2cE4My3VTZsViA/Q==; 31:GqWlmxffQRLsyaF4AGcOF8JKNElB9fGE1o/SEIAT4VcdxqHxlyYw4Dt5wWT8Rk6f/48db01JN7sWbSTKjprh1t/6yJJulg1FPuj0eORvqlEtnwnAOzuzzUhMOMwgXpO7wGeMq9EeNrIeFW3Xwt6s776XkX7YGVvR1SV+IDcOzzzHwOpfDQK8zFUse/GrgNxGLjxfrcFAjv+90XMBCvQ2bc+ShmSrH4MqsCrejSAkYHw= X-MS-TrafficTypeDiagnostic: SN6PR07MB4911: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 20:uFYe6702oTYIhmJALorp8563G7dDlsoXC4xo3wYi3904aNRDrewWzBszzNpxqOHXteMN3wx45poQLAeDNozT4Y7Tsil/b8mjq3IXTged+3IXwPlQUehucphcn64x8hBZQhasXUibRlfRnZCHK/A670h8xtJm/v2Tm2tte0sAnqgi4bGDmtcqExiv9gT3KL5DWXGL30Q+Jzm993T2o+Qs8GYTS6wNIIFfkM3VFDip3nk7ZYAlmY+5qcsaryCAFs+C//nxqy/dLCKDKn72WfX5x0naMWhZUQVM4u4h+lCeErFVrvR1MsjkJeZBCKyVnQIyvAhl4OxmqAqs3pYiCz/wcnpFA3SU+xsGMfWiGJhWl4AIFXjS7xG+U+wgSZEHZmsx2Vy/jymfR4Yt14TE+y3M+iRvC3Xm0qSr8fOkQlSL3OzrjorfFf2XchbkqeO1sFf6EpH6EVNigvWweim2owqEwbgmZ1i+bmGHak0gfd3YMK2plD5+h2M3Zzuvz3NqI6VDe8Hv+JknQhxuV/hichgkf955M+1+2pLmnfa6oZ1ost2ueRVXeVo+wUIO5Dgo/dVNUtTHG57Xi5ddrGCuKoh5ecQO22lUwLbUx/em8wuUccU=; 4:v0MV5zlGICHhm/xpM7e1hFrXmcdNOAIOHW07TZL50bXzZE7KBFG7q5Rte5BiixP/L0l/6YouLzK0c71zbb1jO6zCaebrFkj/djCtqecXqdU2cFI4Wbz9j+0UkYCD4TFp1LE/uoVzQsSJfSDWju9ImhUlkl8uI++UNRgdWwq4h9lDZru1jzyqdbvY2+IG8VWIJF/Ox6eVAAeCVEoWXzOY4vVtyt2yiKwVPtfKPMTZ/qgxhYdxtBhnnKKLjc/36VJ9irgEIs/V7iBShs+frHPvYg== 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)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN6PR07MB4911; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4911; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(39860400002)(376002)(396003)(346002)(199004)(189003)(6666003)(4326008)(54906003)(76176011)(5660300001)(25786009)(48376002)(50466002)(446003)(386003)(186003)(11346002)(16526019)(2616005)(42882007)(44832011)(51416003)(476003)(66066001)(110136005)(36756003)(316002)(55236004)(2906002)(7736002)(81156014)(81166006)(8936002)(50226002)(106356001)(105586002)(68736007)(52116002)(26005)(956004)(8676002)(305945005)(53936002)(6512007)(47776003)(486006)(478600001)(6486002)(6116002)(72206003)(3846002)(16586007)(6506007)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4911; 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; SN6PR07MB4911; 23:wWK2bG5l4gjtNb9v1KWqTAHVWxVeToNN5Q1XvD8u9?= =?us-ascii?Q?NOfXm7XDaM6BUS0xxXCSHJFZYwjJNhtdBuMnzFFc8rdRw90L7AuTNk79OjpB?= =?us-ascii?Q?rVtNSBm8yGy2djYXYYFDRoFDyfwjCNBMQu6m1qYDgST0BW8HlZL4L9Pdq6mQ?= =?us-ascii?Q?9GkSDMCBoUlzwGm9tIjiwpQNoQgTd1m12wd8mVvsomi/xUG7lDMprEqEPqXX?= =?us-ascii?Q?7kcI/bz8SuoLyzmjjnvsvf+kiJOwZrGYOorXug2bHlOGkwC1eDOUuECjVHxI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0bGRKAdYl2plQR/P08+Ox2xBAGgqJ0C0UC6xCTVfSAzD1n7SLwxAZLW1M4h/PqrinzIoFiH+BYTIqPn8Jj/URd0hHoyPMC0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 7:Fz/lnNHieOi/HGiR5ooHxnQZ32P3d8rfutp3WD2x0ROX+5mRaFJlRPBFg1QhiGNDgRzoyY/uSiAWjhL4G5Htb+E3RPgge8DFIQnifAu2zt4CqUbYLUquJcYeqbULJOwxNlgqCUmU0iOyte9lNUNT1ejz4eYCRjp1nDY/DyZujPfpxOybWaAWZXk78i2yZYjPMXYIB1IyjkHiAZ19/KQj+6aJ8UiC3pTL4MKUTkuQPpf5rBLOdeUjCURb8haJuUD+ X-MS-Office365-Filtering-Correlation-Id: 0fe103b2-ac2a-4088-f9f0-08d5cd62c48f X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:10:40.9016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fe103b2-ac2a-4088-f9f0-08d5cd62c48f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4911 Subject: [dpdk-dev] [PATCH 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: Fri, 08 Jun 2018 17:10:45 -0000 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 8298005..ee2de58 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 i, sent; + unsigned 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 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 lcore_id; unsigned 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