From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0083.outbound.protection.outlook.com [104.47.36.83]) by dpdk.org (Postfix) with ESMTP id 32CD71E453 for ; Thu, 14 Jun 2018 13:50:28 +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=2abTjIQ8yLu6wCafy6IR1tWbChsb7EuNRmyj/Kdfqbg=; b=cZ5hYp7hID2wE+aPmfUQjNy6V5FsDYwheXH2vrFJ64LFeai2GZ6h1e0k5NeWwzcYmZuHmw9W9zJ0xko+GnhP5b+kiwk3iVzLJWy9pL7ScGEDU8AJGk/IJ0uBv7lmYUIz37Qgkkh3nzAZXDJ0pla2uqOI1cteItn0KDBqbJZhGJs= 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:25 +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:04 +0530 Message-Id: <1528976946-14396-14-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: dc795234-3cdd-494b-df43-08d5d1ed0566 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:gNINQQPhMTiFVYJcFgPB1WwKQFiZ3EWil4pJHheGBc3rvZcyr9z6UMZAG3M9KukNcbGTNo2jcAzFHnC7FMAHT3Zp4hC6NKuhc8DdQSmn+ebdAxCZtExvPGjTaCuNSWjqLfjqTpswY45gDiw3KEEY52MBITJUCa+QXB4z2Cx9kqxk5vSGVIpf+rSBf7h2HiDBuV2APGMdR5HBVECX1xeD4tCS0yBHOnzRmNENYZj4Vu2hRVs0DFjFlvhvoc2MKEuw; 25:hXm1ag1MBFMjTa71Zua9RVE+dSVXD7+6uWt1kyYq2oUxlBJSwCpIY80oXSkC2t2KBZN82WbhjVwXVTn3+f/u52otUMeCbKoLSSdX5Q2cXhi/Zsr+r4JzasR8lvvL50GLSveoF/1s/FtNmu5DPwYP3oy1ZERuatrN25ayMmdxrkCcuePWxMJUtyeXACwh3bBYFvEq3hI99Fw43cd24icWxvMRU9kCiVu+iEhMc2Mlh/jTOuwze4XtUEBMBm5xRsjEjXBo04saHYGkp64MnDw+ROWw4DDRf9i+iwJilobDcBdSVZj9zsQUOQyVnhjr2Pm5qnAd54SjG1WzyZiTHUjR6A==; 31:TE3wV1808OrUN9U4x/Aq/oi3zSOGtQ+JWicZPnS1B7dbp/1ldTVw/2icNX1f95rPRxbRDPcYxdgKl+0Hizd7Fj0N/QXug1pP7m2xEPB4UB+IZio+R7Quh7ZmKkZCApvC3kgL1PRW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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:1gcglk/xQc2OjkzGxhReZTc2zBkD9xt66piOKx2YX?= =?us-ascii?Q?4Qa6GYa9yrwMHRsC2JvPY2gyn6cVvGqJEpAm5qsRcJgkY9KNli+zxouUQnWE?= =?us-ascii?Q?n9Ni8Q7O2iiM5/f95gkvV+pw102AiGuYtZcNynOM38K7pXzXdHaR2MUwTW/b?= =?us-ascii?Q?mnZP7vQ5ux+wNDIP6w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ii?Q?SqVYS6sDrN0vzkSreahf2ohICkHgjxlcKHfn9yTYyesgV01VPE9N1AY8UJ59?= =?us-ascii?Q?mFWRNMmk2uYrHNltJ9he/RQ8p6gvXPxVtD4Hfbdw8WKV5IP4b/VKRQrUi0a4?= =?us-ascii?Q?fA50UeyFSubNJykN1s1YkdnoqwEaeJHn9xUbW/2HnR38LgLPat+TiRASzmQR?= =?us-ascii?Q?JHMUOMrlnZj82/54h+opoARau+M8ifgHuckIKgx?= X-Microsoft-Antispam-Message-Info: FR5YAf5TTMw+IH8xkxoKBoEKpHRiJz5KdRsZ9PjMD19GxCeULuuIfndX/WPHdDubcVtUmZ+ME4qSuUwYyRg7TKWlOiz15ROvtmow+Kvs4FK8xEieGu9ibL6S78PGxvYcV72VI6GJpIBP6HVH6wMRDnx5ZvswU0rfwyN44e5OdwGkC8OFOc0bMCdhh5vSdA4K X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 6:PWMl8xXhdraQKrxuopnNg1tgHW0MvvVyik4xzTsstA4Xgu0lGzntGumgau9zjwYIMfDwJ9P5QLcVktP/Ve1SSSMM/EGFWi7ct4C4tMVuS7ihFJj7zk4UKss1rBtNcP8WzgRDAatP7COdNevkTmvRQYE/BpWsacDWaPJZc5sldoZphRZ4dLcWZcVPMZq1bGcUlw6hav81IKUn3fzKmk0oeLWgEwXFFOVe14gVoE8KNdRL3NkbaDqFk5tDwmDW8dtvw/whV7do/uerVUs2GURyjGe/YwnM5DYI5vYwLBZ0EBeMAN/9dGZWdhF9gNzgh9T4JkNr5Ba6v6gYipOHBlauT6I+ROn8wSsXNMUpxGbvpJcl29emfox8adP37IrcgjkqDaL7ABFhpJwZmcadrGY0TeRlwa5H29+of3TfL/afu1OG+hySIx26oX49q1o5SW847nk6Jon7tH932aVdwtprbw==; 5:FsPjdWbndmFH7NBQCyJnL5A2uuQ7nnDOP1lGdnnhNylwM6pmLuzFRNheKTAQlYBHlyMRxiWDSSPWkPzbihieEbNY2g0XXrCFEz//MODUUH5lF638FNeJdNXq7h8dMlDIGiVHs7DUvMRSUi5J86Wqd0oLwcm/yb9P9iuX1G06FOQ=; 24:bISo3yieXO605g+VWuArJWD+ECLTNkLmzGC++w1m/y19yCHPPCHgh/harFnA0/jeK44Z+aEdSuvuuAsFD9F63x/db+mT6f2AKs58N5jao74= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:fPNhakK3QJIsbkBrdLDCNBITcriamlUP+6fOJ2a10qJQ2B4TJP02vjscFYhfOk8hvvDdSEegnKMvp/JQeQ70JlBrZwCDzy+suOpL0kA80Qiv4/Ji9xaccdK0RuCMvvHQu/8/DjL4NZBMU6M7ztX2GeBexUZX8y4kdsfEOMxOKusLnEq7WKmxqo7UNgGY4Lt0J9c+Ho381/ZHFuKYylwkFUixni+tBkDOE8U/ddzyt6Vb80/ZF29eZC2PI6zzOq4z X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 11:50:25.3523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc795234-3cdd-494b-df43-08d5d1ed0566 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 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 11:50:28 -0000 Signed-off-by: Anoob Joseph --- v1: * Replaced 'unsigned' with 'unsigned int' 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