From patchwork Wed Aug 17 13:02:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 660098 X-Patchwork-Delegate: diproiettod@vmware.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3sDqCv0lMtz9t1K for ; Wed, 17 Aug 2016 23:03:23 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 58B5A109C8; Wed, 17 Aug 2016 06:03:22 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 80B3510875 for ; Wed, 17 Aug 2016 06:03:21 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id F338B1E05D3 for ; Wed, 17 Aug 2016 07:03:20 -0600 (MDT) X-ASG-Debug-ID: 1471438995-09eadd23ee15af0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id Fe3eqcleH8a0y5BK (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 17 Aug 2016 07:03:15 -0600 (MDT) X-Barracuda-Envelope-From: i.maximets@samsung.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mailout1.w1.samsung.com) (210.118.77.11) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES128-SHA encrypted); 17 Aug 2016 13:03:14 -0000 Received-SPF: none (mx1-pf1.cudamail.com: domain at samsung.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 210.118.77.11 X-Barracuda-RBL-IP: 210.118.77.11 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OC200LNT1LBDL00@mailout1.w1.samsung.com> for dev@openvswitch.org; Wed, 17 Aug 2016 14:03:11 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-b4-57b4608e1a00 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id EE.8D.04866.E8064B75; Wed, 17 Aug 2016 14:03:10 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OC200LZ71KO7T80@eusync4.samsung.com>; Wed, 17 Aug 2016 14:03:10 +0100 (BST) X-CudaMail-Envelope-Sender: i.maximets@samsung.com From: Ilya Maximets To: dev@openvswitch.org, Daniele Di Proietto X-CudaMail-MID: CM-E1-816013509 X-CudaMail-DTE: 081716 X-CudaMail-Originating-IP: 210.118.77.11 Date: Wed, 17 Aug 2016 16:02:46 +0300 X-ASG-Orig-Subj: [##CM-E1-816013509##][PATCH 2/2] netdev-dpdk: Simplify send function for ETH devices. Message-id: <1471438966-20440-3-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1471438966-20440-1-git-send-email-i.maximets@samsung.com> References: <1471438966-20440-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupiluLIzCtJLcpLzFFi42I5/e/4Nd2+hC3hBvMOaVscPb2H2eJl9z12 i2mfb7NbXGn/yW6x4sYpRovJs6Uc2DwW73nJ5PHs5n9Gj74tqxg93s1/yxbAEsVlk5Kak1mW WqRvl8CVsWBmTMFZ0YqtDYfYGhhv8nYxcnJICJhIXGn/xwxhi0lcuLeerYuRi0NIYCmjxNQH u5ggnFYmibczlzOBVLEJ6EicWn2EEcQWEXCVmH77DTtIEbPACkaJ3uU/WUESwgKeEk9X3AUb yyKgKtH98AmYzSvgJrF59R5GiHVyEjfPdYLFOQXcJU7dPw22QAio5tPRTSwTGHkXMDKsYhRN LU0uKE5KzzXSK07MLS7NS9dLzs/dxAgJoa87GJceszrEKMDBqMTD22CxOVyINbGsuDL3EKME B7OSCO+NuC3hQrwpiZVVqUX58UWlOanFhxilOViUxHln7nofIiSQnliSmp2aWpBaBJNl4uCU amDM0G4zr2rYUivuoHYw86fNhJJPOUr30sO173rN0k7m/7w1vPNhh+82WZHlu9dUfPvadG+e epn+viLrRfJTnv+4m2JauimArfti6ZegmnnrsjYaMcW/zZhevn1xSq/hHY/pd9O/i7Vdz9XQ baudIdBQOXta6LqiYsnYM3K3D0T6m3QuUdm77pkSS3FGoqEWc1FxIgDePZ3gHQIAAA== X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1471438995 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Cc: Ilya Maximets , Dyasly Sergey Subject: [ovs-dev] [PATCH 2/2] netdev-dpdk: Simplify send function for ETH devices. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 'netdev_dpdk_send__()' function can be greatly simplified by using recently introduced 'netdev_dpdk_filter_packet_len()'. Signed-off-by: Ilya Maximets --- lib/netdev-dpdk.c | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index bd374d0..209760d 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1642,51 +1642,17 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid, dpdk_do_tx_copy(netdev, qid, batch); dp_packet_delete_batch(batch, may_steal); } else { - int next_tx_idx = 0; - int dropped = 0; - unsigned int qos_pkts = 0; - unsigned int temp_cnt = 0; + int dropped; int cnt = batch->count; + struct rte_mbuf** cur_pkts = (struct rte_mbuf**) batch->packets; dp_packet_batch_apply_cutlen(batch); - for (int i = 0; i < cnt; i++) { - int size = dp_packet_size(batch->packets[i]); + cnt = netdev_dpdk_qos_run__(dev, cur_pkts, cnt); + cnt = netdev_dpdk_filter_packet_len(dev, cur_pkts, cnt); + dropped = batch->count - cnt; - if (OVS_UNLIKELY(size > dev->max_packet_len)) { - if (next_tx_idx != i) { - temp_cnt = i - next_tx_idx; - qos_pkts = temp_cnt; - - temp_cnt = netdev_dpdk_qos_run__(dev, - (struct rte_mbuf**)batch->packets, - temp_cnt); - dropped += qos_pkts - temp_cnt; - netdev_dpdk_eth_tx_burst(dev, qid, - (struct rte_mbuf **)&batch->packets[next_tx_idx], - temp_cnt); - - } - - VLOG_WARN_RL(&rl, "Too big size %d max_packet_len %d", - (int)size , dev->max_packet_len); - - dp_packet_delete(batch->packets[i]); - dropped++; - next_tx_idx = i + 1; - } - } - if (next_tx_idx != cnt) { - cnt -= next_tx_idx; - qos_pkts = cnt; - - cnt = netdev_dpdk_qos_run__(dev, - (struct rte_mbuf**)batch->packets, cnt); - dropped += qos_pkts - cnt; - netdev_dpdk_eth_tx_burst(dev, qid, - (struct rte_mbuf **)&batch->packets[next_tx_idx], - cnt); - } + netdev_dpdk_eth_tx_burst(dev, qid, cur_pkts, cnt); if (OVS_UNLIKELY(dropped)) { rte_spinlock_lock(&dev->stats_lock);