From patchwork Fri Jun 5 11:53:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 49563 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4CAE42154F for ; Fri, 5 Jun 2015 11:55:49 +0000 (UTC) Received: by labpg10 with SMTP id pg10sf19004665lab.2 for ; Fri, 05 Jun 2015 04:55:48 -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: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=Wzl/MtSH0kLdlMfvI/l7ug6jQ69xN+EKhnXvDNQfA9Va24/gBbYgWZ59h7p4Wb5zFX Pts8BkJj7us9VcpN4vw+rQyFiF4vy81EAwVu8V3dXc5jofVs7uJHbJNEzeU53iRsJQjs AOr280GnXLAe7Ih1gD7itS28D7x8bIy1/rcG5D9P09BNvkDlRF3rsEos1RD4gXXHniT9 YuAga/4Ff8G7GO3DA85w1YdppptTYobAqk8HTxfLTJnrW0wUFbdJJHEsGs4FmfsDpReQ blLUN1D2s9L+K8X/A+QI35rE1Na540VJXcaRy4SWrEiF6T8/fsjg8zxFMIfpL072lO1O JVzQ== X-Gm-Message-State: ALoCoQmZNsv7wrk++zdq2Z118X4FKtxwmOi/NloKT1OGwabZQQ90FBzyV+al4ZBAl7MXUDbnJGQS X-Received: by 10.112.97.210 with SMTP id ec18mr2908544lbb.15.1433505348103; Fri, 05 Jun 2015 04:55:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.169 with SMTP id l9ls353716lah.52.gmail; Fri, 05 Jun 2015 04:55:47 -0700 (PDT) X-Received: by 10.152.116.113 with SMTP id jv17mr3047612lab.28.1433505347829; Fri, 05 Jun 2015 04:55:47 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id e3si1414292laa.104.2015.06.05.04.55.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2015 04:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labko7 with SMTP id ko7so52500505lab.2 for ; Fri, 05 Jun 2015 04:55:47 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr2999326lae.19.1433505347412; Fri, 05 Jun 2015 04:55:47 -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 hn6csp1368513lbb; Fri, 5 Jun 2015 04:55:46 -0700 (PDT) X-Received: by 10.55.33.206 with SMTP id f75mr5793736qki.96.1433505345666; Fri, 05 Jun 2015 04:55:45 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 131si7243934qhb.60.2015.06.05.04.55.38; Fri, 05 Jun 2015 04:55:45 -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 0ADCA6208E; Fri, 5 Jun 2015 11:55:38 +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 C3EC661FB2; Fri, 5 Jun 2015 11:54:40 +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 F220561FF3; Fri, 5 Jun 2015 11:54:38 +0000 (UTC) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by lists.linaro.org (Postfix) with ESMTPS id 896AC61FF3 for ; Fri, 5 Jun 2015 11:54:16 +0000 (UTC) Received: by wibdq8 with SMTP id dq8so16386088wib.1 for ; Fri, 05 Jun 2015 04:54:15 -0700 (PDT) X-Received: by 10.180.99.69 with SMTP id eo5mr16952060wib.92.1433505255845; Fri, 05 Jun 2015 04:54:15 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id b20sm10268741wjb.46.2015.06.05.04.54.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jun 2015 04:54:15 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Fri, 5 Jun 2015 12:53:45 +0100 Message-Id: <1433505231-28843-4-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433505231-28843-1-git-send-email-zoltan.kiss@linaro.org> References: <1433505231-28843-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v2 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.53 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;