From patchwork Mon Jun 3 17:32:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 54235 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F3A71B9B0; Mon, 3 Jun 2019 19:34:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 7A1242BEA for ; Mon, 3 Jun 2019 19:34:29 +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 x53HKXve000361; Mon, 3 Jun 2019 10:34:28 -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=O62/vAxXnFnBCFsPw0QHt8CsqLfh+xZJivlDDS6jxJg=; b=k8O39c8nNHRnBuEortj+NMj26KV2d8a/+DGKsLax9zYY/I+SmFkqGmJAC3soiL9hWsNW vfdNVJLckJB6nO0oBH58+FM7l4PAaxImXRHWOi9itWSHf6Vtd43LOViCxmtdzyNKlOog dBDJWN1OV0JBImq+cMZlbQpUi/igXdWhah/MQbVBno+rhPCTpZsro7qRetn4TpBxYVa3 4vDuNjnygf4lBpDmX8ll2jZYCx3gpXa4ydXDBBM+qEpSSvn/LXj5L0hBsB2lfsgu1KYH vjzc1ANNgHaC/Vf3myNC2wdRKsVGBduISNOW4uJGC2WLCAe5rVV0mM3LvEMfLOiPY7bC cw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmhdda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:34:28 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:34:27 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 10:34:25 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id AE5C33F703F; Mon, 3 Jun 2019 10:34:20 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?utf-8?q?Mattias_R=C3=B6nnblom?= , Liang Ma Date: Mon, 3 Jun 2019 23:02:11 +0530 Message-ID: <1559583160-13944-12-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com> References: <1559583160-13944-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 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" Modularizing code to aid in smooth integration of eventmode. 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 */