From patchwork Fri Jun 5 17:51:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 49585 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0EB12154F for ; Fri, 5 Jun 2015 17:53:26 +0000 (UTC) Received: by wifx6 with SMTP id x6sf6831277wif.1 for ; Fri, 05 Jun 2015 10:53:26 -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=Y0AMlEgMflCPLUALwMnDl/bGXjYKTd01KWl7+NwUrXOAZiQp/JKB5Bda+jJvKILgmc x2uPKhR9hbcXOB4xkSoHsUYUV4fb2D4pSz/pg5eFDMAZncwH7ljLzLrFLIQu63oAG+UK ErD8UTJt4zQBUpOvGhiiOBnP0Wv5vr23dRHNnymWwfk4pGBt4MmJK32LH4f/VYSYQOCT GW2qON80zUceofqw1lMqitpTy+8cPySKcgQpz9NKRVWevFk2pUOsZKGuRdypEukz2Dwx jtiOi+qCqJo30iXwjM+Or337c/VNr7W6rgk1yecUwzawRSD1+LJSSNIKlNbz8x0LiwQA znlA== X-Gm-Message-State: ALoCoQksfxjn18mASLnafoexBUKYD1Uiy6nXRlm7gG1/m6d+5BNTlE5bZs7gVgLCoTuiWDhCSfOq X-Received: by 10.180.187.175 with SMTP id ft15mr7934771wic.4.1433526806014; Fri, 05 Jun 2015 10:53:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.171 with SMTP id az11ls416639lab.107.gmail; Fri, 05 Jun 2015 10:53:25 -0700 (PDT) X-Received: by 10.112.42.16 with SMTP id j16mr4367954lbl.98.1433526805857; Fri, 05 Jun 2015 10:53:25 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id ln2si5393012lac.42.2015.06.05.10.53.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2015 10:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbtu8 with SMTP id tu8so34499266lbb.2 for ; Fri, 05 Jun 2015 10:53:25 -0700 (PDT) X-Received: by 10.152.44.166 with SMTP id f6mr4498675lam.86.1433526805722; Fri, 05 Jun 2015 10:53:25 -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 hn6csp44423lbb; Fri, 5 Jun 2015 10:53:24 -0700 (PDT) X-Received: by 10.55.40.42 with SMTP id o42mr8994862qkh.73.1433526804646; Fri, 05 Jun 2015 10:53:24 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z203si8084992qhd.94.2015.06.05.10.53.18; Fri, 05 Jun 2015 10:53:24 -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 30B6562135; Fri, 5 Jun 2015 17:53:18 +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 DC4296212B; Fri, 5 Jun 2015 17:52:17 +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 C26A762136; Fri, 5 Jun 2015 17:52:14 +0000 (UTC) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by lists.linaro.org (Postfix) with ESMTPS id 0D75F6211C for ; Fri, 5 Jun 2015 17:51:52 +0000 (UTC) Received: by wgbgq6 with SMTP id gq6so62336994wgb.3 for ; Fri, 05 Jun 2015 10:51:51 -0700 (PDT) X-Received: by 10.180.90.228 with SMTP id bz4mr20283145wib.69.1433526711240; Fri, 05 Jun 2015 10:51:51 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id bg4sm11582752wjc.10.2015.06.05.10.51.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jun 2015 10:51:50 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Fri, 5 Jun 2015 18:51:25 +0100 Message-Id: <1433526691-20058-4-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433526691-20058-1-git-send-email-zoltan.kiss@linaro.org> References: <1433526691-20058-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v3 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.217.170 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;