From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41]) by dpdk.org (Postfix) with ESMTP id E5DAE1D023 for ; Fri, 8 Jun 2018 19:10:55 +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=uLBDp6Wt/g8YwZHhKQyZz0onvPOzYfS+zZv6lM2Y1X0=; b=OjfT6T47SE6og5/fW12yVt3DUKfcYXL6OWARECmnromj1EcoioJk/2mpsXRV6AuhlxsB7vXO0iQDvL4PFx3z6/dy5cEjiNCBPNcOtNlh56/3gfMDgiRQnA68BWnkRbYUzBPKm+JACuSnSXQZEtYnmBHU/pO2vsRRIJUsKNvL3vQ= 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:52 +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:24 +0530 Message-Id: <1528477766-15788-14-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:aeMVXv/INP+qyQQD+WaXWn6RE/iPT/ajU7yvKVcq1jHGnhCtl+HHGgexjn/mapDMnWKi7vLEUIwzmsBTUSJuLRCJBCt8VU3XBS/5DgJiPBFn8jHxTepa83MnMbLVoFoAURSOUJZzQnDbRg+xQnkMXz8kqlmxafcVykY+sXYJPQC2wF0S9HFdtG94g5EiyY84T5emoc3pWR4FyYF5ASNsXTfEPz2If5eyxp8dkU0wQNJZ+DnVCh27U+NXgEQrdFkC; 25:b4WtEJQpQ3g9iKPyErUsnAU5JEysJA/SrWpTmrlDMFeciS+1T6KEW3PlhOhCPu/LdirXIQLg3/DNjkjWzEO7zEFNvdDG1t6pu/jTcsg7Pn94VXWVmn9bOKeWPge5xGx4m/HMigrlEc2pmuG4NJ0PkQNV0v06vwPHfWAZEmnZ0a0LIiRYe8G11vi6L9t0BF+Fk/v8s7z0ouontlpxAxUl62UjkQg2VpHeO9FwU+UitW622GlyogNE3TbP3KAkOT3tDyzuHh+nlmC9DcTBcjWiG2P+Nva1+V3FlX6ux6bhdOcnuCjODAF29SGl/eQuKos1Ue7E5IWsp7w/nY1UjPVWkA==; 31:MFin9ZRjRhBlm8q7tGq39m4szddqMgbzBrE1sdUYsU7XnlTwjA6Z8MsXAo1OYl2O40To0cYmLSq8DAMrNkE8lTrzfr5yg7aF9eYjTHmYwnfSlcBZH4PcyKjMmxO6VlapViNl0nO+8q+PWkMyPeuwI2DxLsCzWU6Tkhes2pg7s143nHKvajM4U2Try2l0ZeMwN9UmA1W/JBZZyD3WSlrG+cEQvdueQbwlQ5RkLeEsbyQ= X-MS-TrafficTypeDiagnostic: SN6PR07MB4911: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 20:pODZFFC63qE1jsw+Y4v3aF6vLPNh4uCtpuO+Gk7sFZT6PG4K/elM54Ot+LQhWRR7FHH4nu/G0vjxSf/Zc0r+g30BBsps/JXbsHgp4ozq1QjZ2A0NvkIyMR9KtBrpm4IOeco2nZmDrHKY5LdYAgTM2qKKkxAltV6HNX6k5ss0AZ40O3mivmGn30n/i4GKuTaWS08TactzUWRGGQEIZDyc9FbggfRQiXxHwPLumMi7g4bD8sRbv1GY9Z9JPGSzIfhW/QnyjZ26zXl+bz/tat3IQleXGFwPibL/UzDGMM+nHjgjmFJwmctzlE1ZZna1SGJMtU3eAuH8FoTn1ma9CryfPX6UQRsliNoT0jsTgKCem+lJHbQGSS6MF+ghna+Dmm5OehkBbL62icNkFaMvjL6JuhMKOKfVS/JD6EygA6rp9sUa5V6mLUSCFmccXASm5O8PTqIEDTatVANBAtXzMNDPJ31h+C123BmLwEmBIm0lHn3Rxfmoc6wtPFmuL4cjdUha2QmBPZYFcvCRFymOrS/Y/6m740zP18A54Wcs1KiFenFtyBtTrNlM9HUiaVNDx8BRmPUz2FjhmsH0sY2Znhpp0uYrx329nGpvFbkNNR8xP0Q=; 4:JazN1uzt7BTVQ9UFNxfam3CaruUZvJZZhjUWDdoBwFEJdlZqlsnny4Y46p6x3wu0936/YSZMzJwMaed8n4b50Ip3azn+aCF9LpQCyowE2J/beI+4HtUHzMEXSw9sSWu6k7hmKLskOgWQ6QETtbx21TFV07mGwf5mL3mw6s6IqDicA/MHqceTQbTDwZf2VqB0BgUAIf2L/t8iZvKIz5NcA19fa9nc3S8y69Jk+BRAmPYxX4S3kWDMlsCyFGjxhfGlX/Zf+yceyA+Smqiyi3nJQw== 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)(575784001)(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:YUdPIWi4lRQI7ZJPuj3YephOb46Su0HAVT/z7XuQI?= =?us-ascii?Q?THHwz/lYQBLFvY3j5V2RreUuWEo4p1KZTN3o3FaiBEu9MzZcmomaddWtzaLu?= =?us-ascii?Q?TRCgACGtxfsUoT3BxVX6UJuSGrqJgE33sHTQ7mK6GGr+arj/hzERogXmbKob?= =?us-ascii?Q?AGrjYw9m9olMjneB6NmHleBsFNOxJKk5cznJQ7g0kpJdsj3eMygPitA3BFqL?= =?us-ascii?Q?fqDtrR7U8JteFGGWzQDr0DJ49MOtMnv9INcuVNzEEzv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7WnCb1x0Me2DSuyGusyF+TCl+C5tCwgJ4FzQbADXe2AGmD?= =?us-ascii?Q?CAkvE2N9Ikp9t6hdja6eErsz04WzEtE8nse3fixAs4vV266zeRE8T5xJta6D?= =?us-ascii?Q?Q5nvVx36aPMc1ftUeZMY2UIr7qdMigxL0VSOI/+P/OF+sYBGQ4RNI85J53qp?= =?us-ascii?B?Zz09?= X-Microsoft-Antispam-Message-Info: 8c91bmYRN7UMUSFljW9byTwSzGfmUMlxX07iuUaQYN/O9VkRGW5ott+xMDvOW6NuN6wNpC4CBYc4iCP55fop9s9OxT972mvbAMMTUvcUEIwy9IUEvnsi4mBEW67nCox/dtVGdL0HxGw7+18+BYXFfwXEVSjxYqm5wbJvI8n8DnPD7Ail0UbigQLd4a35rwO8 X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 6:9cfWpu2O95mlUK/oxglmK2yJiy+tgTl39Ahaa4M7VG9tQYMkoxn+29OQ3U+GAENUC8S7eO9THXMW3zgzPsuTDq5RZvd2XXTkc3xVzsHgodGSG9XUIhlIYgyxVCeZ+XEDzspvxI14QEhpn/c+ISJUunxhosZlsFTXpV0wmwIWABdEbGFbJl/GvghNnwxscvj5JIgWk+kILG2dFRl/9zkRI7+uLWzf/EyweMa2UjnwfHcvwsEURtbLwPWOILwB1y7l02wD4kz9XA38xXxGggzzylOaQGJL6bPTlsgg7hCb9zvHFExOiHDYKxUFwC3FViaBKJQ9ZPUzlUu63XpA88D4EWi5Nc29tDPsRdoF1Itw+5DeVMe1vto4609sAtZu84FVcPSE6Pr/zGYCmWUb7eiUaVQezmJzZPpUetPhht8dLyqeJwMCvrvnHr2bUIL5jEx1s/ggBCN3BPy0pfd5HODXpg==; 5:n3R90ILBX2/o1/ZvAOjEr1RFkUTVkYFan81ByjX7tFr4MOcoJ7uRl/ZzTZ7QrYD97YVM+vORCtR7RcdXwuaV8uPu7TtAzaXSEFACavqR1LsCc529nyTfqy7c82Xqf0F31ODudYcXo9xNpmCh2od6HErPRZ3ziZ9gIxbcli+Wakw=; 24:3XiEJSqEo0iHWz/0AlCMx1V0h+38S9NxWuqZemYeCRYx2/iTpM0m3MyI7cqJrchLLgCTrtbCFKqMPPoYLPc7XK3wPI2O2PU/6Opiqcm6iTk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 7:qFY+cl2FUepdXz1UE1awZ5MWj7q3wkUxAIRoJ6uvW5j4zcAXasY+jfOLhWjjAvUh/QrqH4/0aeQowvqZjGODhNEfvsUnm+YlADbKHCgLQEdhzCVQtBKO5Nr/imWy4qnLUkTpQWfd5bKO6bWKhi8Q4oOWxq95Pk0leKRZpVnypg75motjplwk62/ryV05t3Szk1KcpugzPwuIYejPXqeTzDbLU0FKiSmMTHr5tVN5ESCEIDfgxyekcCQKQPa+ASRh X-MS-Office365-Filtering-Correlation-Id: 259f3434-57a5-4b6d-dc81-08d5cd62cb48 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:10:52.1586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 259f3434-57a5-4b6d-dc81-08d5cd62cb48 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 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: Fri, 08 Jun 2018 17:10:56 -0000 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 9ba78f6..56e0bdb 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 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 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 portid) { unsigned 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