From patchwork Wed Jul 1 17:06:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 50532 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8A362214B3 for ; Wed, 1 Jul 2015 17:08:59 +0000 (UTC) Received: by wgbbj7 with SMTP id bj7sf14581744wgb.2 for ; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=EmbkX0AmryKR8ckZPT2D3jPxhLzwHoPM4g77LUV7X5s=; b=huRz5vNa/U8ytckIl6g6lKRgYsr6AwD3bY5cBxVA1YTKYIuNIBMAT77VI8r6Pmq1HH rsqzr7Betlos1ZGkW3AnmVf58acG2nocvoYDJBLKkWm3neVHddu8u/AfWe/hTwJhWPf/ qUXug3MDJk8m+sncVGdkDkLNKGQONP8F6OR1qbYQDk5tiKCo6dYFQN2+ES0lrc7+shBq /Ac/h/0BpurrRd15EL5gAeDAkxiTKVyOo+urC675MCKszn3uvPYyr1GcK168L8p9xBOl USQBgB3DR9vlZkySVfHC9w3AdpPUsTp6hWi33z2t1aypYcPjYAk28PLbmUppIVjbZ9on /znA== X-Gm-Message-State: ALoCoQltYSHsZEHuFoJOZ/cqGcHSX3V4XaPzbh4+5w6KBm6yBO/v5+3BzVw+WljLfv1xnx20wGWR X-Received: by 10.112.28.111 with SMTP id a15mr17619859lbh.21.1435770538806; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.9 with SMTP id ku9ls214677lac.37.gmail; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) X-Received: by 10.112.72.164 with SMTP id e4mr26186993lbv.113.1435770538371; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id o5si2191473lao.159.2015.07.01.10.08.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2015 10:08:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagh6 with SMTP id h6so45006752lag.2 for ; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr26812973lal.35.1435770538227; Wed, 01 Jul 2015 10:08:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp743137lbb; Wed, 1 Jul 2015 10:08:57 -0700 (PDT) X-Received: by 10.55.17.215 with SMTP id 84mr57089426qkr.24.1435770536756; Wed, 01 Jul 2015 10:08:56 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e207si2987173qhc.3.2015.07.01.10.08.32; Wed, 01 Jul 2015 10:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id DE3BF61F6D; Wed, 1 Jul 2015 17:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C582661F45; Wed, 1 Jul 2015 17:07:04 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6817C61F73; Wed, 1 Jul 2015 17:07:01 +0000 (UTC) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by lists.linaro.org (Postfix) with ESMTPS id 6CD9561F3C for ; Wed, 1 Jul 2015 17:06:38 +0000 (UTC) Received: by wiwl6 with SMTP id l6so171787899wiw.0 for ; Wed, 01 Jul 2015 10:06:37 -0700 (PDT) X-Received: by 10.194.48.71 with SMTP id j7mr51299221wjn.59.1435770397670; Wed, 01 Jul 2015 10:06:37 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id fi6sm4335895wib.6.2015.07.01.10.06.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jul 2015 10:06:36 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 1 Jul 2015 18:06:13 +0100 Message-Id: <1435770379-30000-4-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435770379-30000-1-git-send-email-zoltan.kiss@linaro.org> References: <1435770379-30000-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Cc: Petri Savolainen Subject: [lng-odp] [API-NEXT PATCH v4 3/9] packet_io: release unsent packets after odp_pktio_send() X-BeenThere: lng-odp@lists.linaro.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: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zoltan.kiss@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Zoltan Kiss --- example/packet/odp_pktio.c | 10 +++++++++- test/performance/odp_l2fwd.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index f08d9f4..0b4a8f1 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -282,9 +282,17 @@ static void *pktio_ifburst_thread(void *arg) /* Drop packets with errors */ pkts_ok = drop_err_pkts(pkt_tbl, pkts); if (pkts_ok > 0) { + int sent; + /* Swap Eth MACs and IP-addrs */ swap_pkt_addrs(pkt_tbl, pkts_ok); - odp_pktio_send(pktio, pkt_tbl, pkts_ok); + sent = odp_pktio_send(pktio, pkt_tbl, pkts_ok); + if (odp_unlikely(sent < pkts_ok)) { + err_cnt += pkts_ok - sent; + do + odp_packet_free(pkt_tbl[sent]); + while (++sent < pkts_ok); + } } if (odp_unlikely(pkts_ok != pkts)) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 5d4b833..dd0b4b1 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -224,8 +224,16 @@ static void *pktio_ifburst_thread(void *arg) /* Drop packets with errors */ pkts_ok = drop_err_pkts(pkt_tbl, pkts); - if (pkts_ok > 0) - odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok); + if (pkts_ok > 0) { + int sent = odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok); + + if (odp_unlikely(sent < pkts_ok)) { + stats->drops += pkts_ok - sent; + do + odp_packet_free(pkt_tbl[sent]); + while (++sent < pkts_ok); + } + } if (odp_unlikely(pkts_ok != pkts)) stats->drops += pkts - pkts_ok;