From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9A8C5A0096 for ; Mon, 3 Jun 2019 18:51:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCBDC1B94F; Mon, 3 Jun 2019 18:50:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 51E681B94F for ; Mon, 3 Jun 2019 18:50:52 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53GduW0031506; Mon, 3 Jun 2019 09:50:51 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=DLqKwWann8aUqoC2Lw9GdQxbfqdxJXeMZkIHQxYaJZ0=; b=IjFxMRXxPadZyx4WS47RJIt1wXvak8j5OcM5vt35tQ40tA4ETT90MachoqBIIpRQXZGF mte4GLvWnjW/manHKoQ6EbWNKzYIIx6s0f/feS1syalygf5TeaT9i9vn3DyG+W96NKv+ jbXXAFF2DLz3bYDit/Y4lwWqLK1dAii/ADh/5kng26X8z95MeDxnRBH/KJxxJkncs1M4 B1yuVo5cf5BWVDRZRM3Z+E7uwWetP3VXcZ5AVQpdfOIViO8O0MaEmPZ5DGegGppZTlLi qrxMfYORHY98n0XouDNKkwGpjGsZ4CRYLI4ICEpu1ObAhIP7fTBJgHcJNSojHfcNKpfL 3A== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmh70p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 09:50:51 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 09:50:49 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 09:50:49 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 16AFA3F703F; Mon, 3 Jun 2019 09:50:44 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , "Hemant Agrawal" , Nipun Gupta , "Harry van Haaren" , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma , "Anoob Joseph" Date: Mon, 3 Jun 2019 22:19:16 +0530 Message-ID: <1559580584-5728-12-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559580584-5728-1-git-send-email-anoobj@marvell.com> References: <1559580584-5728-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-03_13:, , signatures=0 Subject: [dpdk-dev] [PATCH 11/39] examples/l2fwd-event: move pkt send code to a new func 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- examples/l2fwd-event/l2fwd_worker.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/l2fwd-event/l2fwd_worker.c b/examples/l2fwd-event/l2fwd_worker.c index 58fd5b8..1a7ee2b 100644 --- a/examples/l2fwd-event/l2fwd_worker.c +++ b/examples/l2fwd-event/l2fwd_worker.c @@ -154,22 +154,30 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid) rte_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