From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690058.outbound.protection.outlook.com [40.107.69.58]) by dpdk.org (Postfix) with ESMTP id A00B11D38B for ; Thu, 14 Jun 2018 12:19:30 +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=VOU6bwy+K+3NXoYSEyIxfeQC5Mz8/n2ZyZwAPcFMy+s=; b=SinE4uUWH2CJPu7xYt+m90IwPsivAp6dgdIZXQ45J9+v8YgFuWHZPiF8QF0cjpKZ79GNu4p/7S54CoSF6Sq0y9dCpwCB0CGUQ8VuHEPfbMuytSjXBNxE66jPklXrWokr2fx+cUjIO1AUN1W7yjvebPUsjvCob4cm57VRlkT8s/o= 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:26 +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:55 +0530 Message-Id: <1528971477-14156-14-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: 45c0c55d-907f-4955-c952-08d5d1e05035 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:gvLgzkJdb5VnS/qgUfIbyFonufWqHI1BF19D9AynvEd2g9FwZqY1DB7FJ28SUJg0udsfUbnpf1BBdonSAeg//pgJGuwJt0GzyRUelarefUynYH0GlRs6TeQh1SXXViITAZ1QTdUvvB8gA8K2MmxJRlZUP6SvxO0zDsPIUBpNRbNCc/5UGSbd+/oNz2lE4MfjVJO3mMUeZB2KlQJyLHR0bVLSOEd86sVhseGO2wzYiyrbBNggfgc1DT1bpP+tv93t; 25:115dUW4hiKY/2EigY3paigyBbHmhdDuwUFn0PO47axN5cGIU0arc6KembPbARSC68RHhBz8cz+tA5Xia6W04/6jTmAMR3aT+cChC+ty91RqbdNLdyq665He1uTQrswN/oPWE5zFZPtjbuP1pLdoH0sjYU+0ACA5yCixC8jjtcioviiHicibs6N/+/xstJ3tkwTrJmegymVFgEhwIX3gimD6OijgrBdq4W/UNfoICjkFdNS51AMyiOOR8C0HHG6rMVP2hyNusTwOvhFTeV7pIv2faSKO86x8Kou5y13V4ntUtbEBx8FsK9atItB630xCu4H4mv61D7p8NMkjXdEQEVg==; 31:f/ftzyFGn8ZUX5waBznseFuX0/b9l2bQLmgGybam+7tNFPFitd1EBTRpbDlkqca3Qd0rBDUjJCAjaFVjPkDPgzXaDUpth35OpAV3UgU3rFULPyAwkc0slK4BmDwwC+QfFbswOgMaRt/zgEwAQTqDGu2CJ54sGM8evCG5QiuXmutyMIAVV+BQRiDtQ/3HoakcUJKiIbYz6RhyH5rPnHE8GweF6cQ2mgNXxM07e3Qg+2o= X-MS-TrafficTypeDiagnostic: BYAPR07MB4902: X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 20:ULGocaDmQeXQPafZC+bZ0HjU1M7PQcy/pvM2YR0QGbs5ac9VuBN/HR+soJSHYpdadFsrVVME9GcnXqqeMKx3EGoneChM1q58D/mjgXlAnGJHEbmZwDOJMx2nREy+SMsIvmKgQjFSgfm64blWYBcvnSp0KOF6yxWTKrPguuQ8SN4xVSZJcj+AeUamUBSQRKuTucxBAT+Wlr3SY+dDav8UHfxnRbi7XPTfzM7LxB6oWGxIOACsyHp4ozwTzZwGnyZ0niwa7yjfn91wdRif3s7tPB60MEIi5RK+RDjPUiyIOTjNV27K20eUUWVgu1kxb8RskHoEIiyPEieqIa7yrAUVfGchvTickuSz4SLRumIa0CuLLX8i+1lSHLvDYxWNPifMQDR0P9EeGMxfUMDWPCq/kVEuV9rBP/mPMLbzLOWpPoC/P8FD/qMo93Hb4dKBH7xUocYcRtOrz0zl53WalDNjhMPpS3TDS52Yk5WarGYPPHBtUUrJr9mpDThg3R/lXqO9NBd6gs1lVMaf1VoRWOWt3I+dKMjMQe4v3SUcnnOd6fd9Da7OvjECoCBQDUCyzkfM/ZoJiS6089uNn3b3eH0ZC2+InFspBMis/rW+3aqbDuc=; 4:381YgxgXcaRkgqsouWUckUPNOIOsytzWPOE0sRhA7Xt+Y9SkUS8/WSF3qF4AS+ivFjB7u7M34851MZw2vITUchi8j/3Wx6VpdLHG1CkQulWIJAVB3trq900yBMJhEI7mq/7wEeuZMuj2QM8kfYaUiHZ2ysJEvjQM0xKgilBdPLaYLg2JAWS5IYsLPHtFVmRf0MM6cvZ8GU0RF4SVYgKYTVEqfcy2QoPYnVCRVudmbBMv6xKjlT5AtHqAbAQwxnemX9LAZZwPHmsGWFfF6SzJnw== 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)(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:zb1ainLm7gIccMX2ojjg6Rje6ZsRSHJdqqoyd2GLk?= =?us-ascii?Q?zzuAUHraoiwGlm+J0g2AgYdZSLm4is0+lG44KFdfAUCHeBsUs2chVkYUL285?= =?us-ascii?Q?nsRj8G5hyY/atCh2bqUsTLtxEFbkuhMTPzPgSuTsLRA9MagsCELtZWwqyKaw?= =?us-ascii?Q?D4yHBW7J0uDhXZllfQTM0E/q9eHVPftbVYbLxv4ngRdWwDXNfMYNCJiH0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4NMXZNGpQ/cJ/CuC+np9IGlqcNIsuWI7CIr30WtJk3QIlc=; 24:+NzQQTpQ4Ut8iZdrKfNb1DlhDMgSL85HltUlBdgs3kpSjg2taBpnbAQj6bZOR2o+XD1hA8jKUj4waqz779LODF9aQTN1Q4lg4X8WUByJGjs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 7:3ACiScdO2pFJDqkJTGtxgnE6rvDxrTrRTsh0lOjS6s6q7Dj69CWjdOOGAe+ohXk+CqfZFOfrVRiVVEagHUenaKPPn6Os9/9PW1devUhPymoUWgHWOoAi7BSc66WZCvpMEnOBajv4ArNy3C3pJYkoIrHZkrlnljs8gOnp/t9Vmvx77Xu8ObAcpl7C98Yx11ATYg8q+aE2Co5h/zTb8g79AZTaQkxxn5JWxniVPq59HocVVZycYNM4iY5Au5TOwdXq X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 10:19:26.8118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45c0c55d-907f-4955-c952-08d5d1e05035 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 13/15] examples/l2fwd: move pkt send code to a 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:31 -0000 v1: * Replaced 'unsigned' with 'unsigned int' Signed-off-by: Anoob Joseph --- examples/l2fwd/l2fwd_worker.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c index d6a5e90..bac1946 100644 --- a/examples/l2fwd/l2fwd_worker.c +++ b/examples/l2fwd/l2fwd_worker.c @@ -154,22 +154,30 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid) ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } +static inline void +l2fwd_send_pkt(struct rte_mbuf *tx_pkt, unsigned int port_id) +{ + int sent; + struct rte_eth_dev_tx_buffer *buffer; + + buffer = tx_buffer[port_id]; + sent = rte_eth_tx_buffer(port_id, 0, buffer, tx_pkt); + if (sent) + port_statistics[port_id].tx += sent; +} + static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned int portid) { unsigned int dst_port; - int sent; - struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; if (mac_updating) l2fwd_mac_updating(m, dst_port); - buffer = tx_buffer[dst_port]; - sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); - if (sent) - port_statistics[dst_port].tx += sent; + /* Send packet */ + l2fwd_send_pkt(m, dst_port); } /* main processing loop */ -- 2.7.4