From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0064.outbound.protection.outlook.com [104.47.34.64]) by dpdk.org (Postfix) with ESMTP id 1376C1B50A for ; Wed, 11 Jul 2018 08:08:24 +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=dteIzrH7qdYUosOHLe1EbhEQ7SeYm02yyfookXaLQho=; b=ZQSeN/N3LcxRmkSxihU938wOZSWvuso4b1zIr7qyQcp49xv5KFKQWtJ0q38trcBOrhNxzopSotussx8OirTyxqzR83haD/tARCFcyYO//htJs2GYL3vUavhJkfF9NZiws82+tG4wBb++cuWmLPfBfsvx0PlVp7vSDXJhNc8PiR4= 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:20 +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:26 +0530 Message-Id: <1531289248-20025-11-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: e9e746c3-bdce-4f07-538d-08d5e6f4b4fc 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:jciFdC44/+4/0dybW+R9pcN2pCjwHeWcyyX7Pbi1JPvLWvUKEqQIpExCWuVkWDBP42gXSalMKno47PsJn3hjpzoyZHia2ptzpn8pOISEk2T0tYzOzmmfpLYDzT+JyL/vBulimOA+sBidoGLkl4dcxvzwAFLOmg9IIULDsYE9nGBd1CilUAeyga934kVbZyJxNmtvfeFPYQShFc/1XGXh232694SVxG+7EMviPRZZ08q5BkoV7ihYNIw2uwl88w8b; 25:KvJD0JQqgMkNiikOl6gnL+TEPBb/Fk0rQTgbzMGrXPD4Ot8nDz12EjCtZfR6N8gTJ36wEZ/vY8I98dJUZHL++uEZaluIn4lc8kxxfa+wj9+3HjS12zXqMfFc7EAtMHCGdJv4S0DfvznGL9aDqwQw2cWav3/Auk5Zd+2binNUF/48oRbpjYIttzZ9/S9FjdRTP4D+V4OT0OhwWwFUykdA64MzVRUujq3L8zrIU10FvjdVzChmnfj6eXyRjEjFbMsbpGbOrxu6Cd5nhTpMlld5eT1SgWbXYlzdnF8lnX//XYh7NeMVdc8g8omqZZt9qPeePRvL02Vb5Wdv0Vn17CjTHQ==; 31:Q5TisN0G7YupBNLvyNlIFFLMrEX/6HJrXHH8lKxcFyQnIPRbYZJ+ZZ9g+OwyhZVkOAqak7dDcu/jcLaUYaDKZvNtqeLwd1hMQPjNI39vs9iBMFSTzE6IcTYK96jvwaHQF8r4AEoGRpEMy//qGCnR0V28RMD8kzaoE87QxGfjLm3uPfJoBH3aGyJgrYDySGXLKCm98I71C/ELV6+QvFaa029V8b0gAeOzV3+sgVrT4Ew= X-MS-TrafficTypeDiagnostic: BN7PR07MB4898: X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 20:naGrrqRshpBatG6IbXs0hor1eQKGNDUx3n/kd+qytONlQf45USh4xMNqQvPwGPEYMDsU1IfPfdZmieQoGSaYrcXWYwXtgD2Q6GIELWi2urw7iq6MfBaXYFGPHCi4F4sxnxhYWAxIJQ0Y8RwngBf4BoKqfFQbCUq4w9N1Q9C30o2U75Rt0kXxupsvo1vofABACaZ7bF11Mv8UPDcAmZSFvA+y+m7wP4ZinS4q140gzDnGFDlsp8MtukFVRVnURdshfFFRRfKK2n16X2K5JwNcKslCuJPoIbV1YEY+/kJ5VqpsPkBi9mic5ME2zqRhkms9F2D9ZqtmvasLdySyotimZ0opB2ZCFD+bhCcuwvbZ+SjFGYfcH7DKh9X8s6sKXwPCkPOt8/ztyr0xwJvJSGSLkWuATw6TfT/5Musz/7OoVPMtyD70Sd1dD2/6z6V8m6+etM9RaRkSkAyf9gQONHXY6wacBjHFkYPGvhADkMgsvS30GEoo5oMb1zmBJ/kbkdYeNdZh7pccaICxfylfk2o8grJXJmfpBkf94dN37fBStX9SkBUa6C+SoIfqFrfcM6t7Bvxgn+wndkhGD7FlnWxxfihjFhMjbTsAMyJbaIX6cJo=; 4:DLtcQp0j4qulUTydDtoenGebp1kuywAEqrjezOsFr4sU7dxkTubulttGSpfP7ASQHz9UUNnMc2b2Wv37+AbtBVvIijCOkzFzTCsnExr2I3FlJr9CNEx+Gi0yI0pWktqg2SIP6R3RFc7TG2XZiWlCqut206T4RqgjEsgdLS4zv1UWvuIIOf+a1WXJBBCGt+J4JBCy3CDRa/3IzgYov1O6BpTcHNS0jCRd75YqQF+yTg0vGCvytS8ksOPtpUp39w/ot9Q4AS0zP4MO/qWwKj5Prw== 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)(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)(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:8AeaWEIyvRxYawfe2AyeFvbhgl3M2HZz/p57CSVEc?= =?us-ascii?Q?xatNxkOGKt87dEXhG6pkngUFVBLlr6E+Lu16ovWDnt9l3G7Bg3o10ZVccpG9?= =?us-ascii?Q?Lil8pv7XMQG9CT9IRf+rtgik47zMCuJH60hKFh/dTC9MEErq2Y90WD8yJZTt?= =?us-ascii?Q?6LXxWke6gm6G1v0oMsfk7cv0vpgteVSLoDa+Uhhm6J6f3ikvCmtLl2S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z7XEc/CZpyyOXsLMDneK5nPBpm85Q==; 5:fkqqtxxYQuvIIB2WPTRnDCPEBUI+LYvl3ZJ2SLkjbUUtl4FfSrfuKryxob3J/PibfrXoT+B9vsMxG6Q4JGJNUcWthUVyZZ2GxIeBFRxgmMF05VC+WructQTfDsye9EwZxar0w72ZiNWkeX5PorKNiZD8yBBoXOvkRwkYBbnUqao=; 24:bcWPgaNcKpYD+GKdzjUwZvJpqtyk+D6VDXV61wfcQ5jAJkuDKNi4atZDKFOGR6JU4y1+ERybn0YgOFQ4Uu1JpeCqeXDwaWcEmg6oDxRicjI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:KDjetZgmB29QbDoltKlsMIu90G89lk9NBSoYwi5ndefjDptEctnmPTePPw6L301dj+L8suIhxsfSPeOwoLkeU6vjYs1Mw1lAS7bHoVGjnVdz8PMLsI08FwtKUOtL4VmEprNXV3LKJkFDWJnGp9IKC1LVJVppWduRZTVLZeQXrtWwRdbNWTLYNrL3YzL74WmFjsPqPJQUQm0CoVS5G8TmSKwhz8K6QYqj5cirUhx2hxGnMcH5J+LkNlOL6mAKEKKr X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2018 06:08:20.7864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9e746c3-bdce-4f07-538d-08d5e6f4b4fc 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 10/12] 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: Wed, 11 Jul 2018 06:08:24 -0000 Signed-off-by: Anoob Joseph --- v2: * No change 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