From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0049.outbound.protection.outlook.com [104.47.36.49]) by dpdk.org (Postfix) with ESMTP id 65C621B4E3 for ; Wed, 11 Jul 2018 08:08:14 +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=Dd42LBRG75zWmITQduYidyMFICNYaogevNt2bB1Eeq0=; b=SjygG2Sg42rrW87fiSS/AmX8Y408bho7h6fehm6QctbJJDGeHDTS+5JNBI6knArl63XnJu5ANGZAsr8RLXGQsr8Ek/0/7O0frOaDeqZ0sVUCqBWDzP2e3MqJPXkNbEq4tFZZEKwr9ODORjMUlK/Tm2t5sQRCOkUJLJsDyo/BLoU= 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.930.21; Wed, 11 Jul 2018 06:08:11 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Wed, 11 Jul 2018 11:37:22 +0530 Message-Id: <1531289248-20025-7-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531289248-20025-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> <1531289248-20025-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: BMXPR01CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::13) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43a2d9f2-4c73-4573-bb89-08d5e6f4af61 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:CEgdkgOw662FCTlbJZzaRLrdH3wnp8IPaenmFPLPK6QHl31pO2T5Z395g/gspfkMev0kyIo2A3MSK3RfN/FedNnMwZYxdckghv9/8cC5Np9Yb6Koc6xOFV995OW3lsfo9XyK55fs50PyvvHjqOMUa1wQp/hxEImfpB9r5f9EVIFtN3crvFDhaQpDzf/Rj2NjoWpBHZZkTDx7EEi54U3L+G2Q8Sw0ChryKYH6iV4AOdcjZIVC5iQU8iHCCQyIlBOr; 25:ycfZ/wdg4WH3eWYZt1XHEbn56ecyN5YkwBCRLLuIkMSQZyPeQdakXYFu17H4K8IpSLoNlaz0jkzFVP+k3rOpMBlqdTi7gVmiK9LXUteteQXLx7e89JjFfS0IEVvbE/28jsZBbmLt1f3TZb4Htq31jvhsXpCBywOacUIc3WRzVtNQ3yqlqKzxCLkcHSqxqlInxqOiAxrkyzEInSADlL2XTP+PGRiVZ1CGwvaR7stgrdnvhV08OpyS+aYjmbES/TqYJqNgMtstutobVNYC78ix+WiuAe01gqjfzB3zufzxPpYNoRLmL+CyYsHDJnkrBSD4j3FjpiPkmaf9bs+Aad7/qQ==; 31:OvXM7YtTjph37nYTYYvrQxF8ArbZaMiYcZ2p1RQRYaoGdkgKOKHezC24FmHXXw88JZTaD5EtHpU1UcVRaM3wpaT259szoLZGGVFAIYCZokTBhKFRtzU2ye/IrzhmOeV3A4XzVzq5vq/c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ft-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)(3231311)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0730093765 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(189003)(199004)(68736007)(81166006)(8676002)(81156014)(44832011)(50466002)(6666003)(25786009)(6512007)(7736002)(4326008)(6486002)(48376002)(8936002)(2906002)(3846002)(478600001)(72206003)(305945005)(6116002)(486006)(16586007)(2616005)(54906003)(110136005)(316002)(36756003)(476003)(956004)(446003)(11346002)(47776003)(26005)(42882007)(52116002)(105586002)(186003)(76176011)(16526019)(66066001)(106356001)(51416003)(97736004)(6506007)(55236004)(50226002)(53936002)(5660300001)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; 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; BN7PR07MB4898; 23:rB/DUhK9YM77yVYGO5bU3A69maTVqurZvb6UqzoS7?= =?us-ascii?Q?fTHxdhlSQn2Z2ruvyMscJ5aC3y+qs1SPwdvW2RwshdsE7/XUsNk1Aq/Y4WOt?= =?us-ascii?Q?0Ov2qSe2BGUiqKmoyBbqBWcptEyhy3l4ZaW0wgVdV1MPNx3A/dMGbVmWXTOa?= =?us-ascii?Q?OIdnoKrsEnAgzm4DqVN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s5YkkmFYoM7XKmbtlwwSnkNUKCVuMKxtXHZ+rOtMEmWYLX/GQfrhaZPbg==; 5:O3mHNT4KsMG1SHMnexp45LvoZdFV1j/J1fR8wEW1L+A9GdD4PFntzisz4VoD1gazLGZ4/wB3KuHCoDfKbhKeitjxWbW5dJ6SoZqswVGjAel/E/I7JL/hXN60F31m7t+vndWLHYI4PR9HfFuvodZ4a0c5edVGjMXzDIk98H5k9IM=; 24:SR7Ibkdyc0Ut85an3NDydhjDmpT4rZmCJOy9L5S9AUpW9Ky1+JL1+Arcq001egGKH1uHnXNO117JGmtIFTa6GEmcHcAkjwRraJwWzKQ87W4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:qO5uXA8N0u+E/mMuDveoZqOHGQsGC05kZyjBzyOgVCfPgKHPcqkbVcEJIOZ7hIqvaMwSGSoeplNnJ6h6jSjNY2R38AhLRBz2grL2+L1KR+H0d5n525G2JRIHEZAXvD60Th2ixY+iq3FWAMEG2tt5eVRv9odWmPuxYowUBZZKF2r21uR2GwFSidl7kMI8v2HjTl5b8vN6xqiTF7lGmE3mnvgIL6H2mEyMyVM4W3uWowYfaLGBULgT84JanW5EVGkK X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2018 06:08:11.3436 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43a2d9f2-4c73-4573-bb89-08d5e6f4af61 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 v2 06/12] 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: Wed, 11 Jul 2018 06:08:15 -0000 Signed-off-by: Anoob Joseph --- v2: * No change 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