From patchwork Thu May 28 14:38:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 49117 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 077C8202A3 for ; Thu, 28 May 2015 14:39:11 +0000 (UTC) Received: by lani11 with SMTP id i11sf11751863lan.3 for ; Thu, 28 May 2015 07:39:10 -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: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=o5v7/E8k8qmQgkT5Uj74Lq4xqUchh+pcB+Y2lKDmPZE=; b=KKxCkwPoLxUP8rcKxNXqzt9+CcSwSv5Po5edwPEzP2qI6j70c1ABCIcZH1dQzWSQ8a mlkvzRQqxZVMB0eavsOqWSDNsj20yCewqtQ3AGMROcodSs0r3ZkNdtVFDiZPSulkV0vN YR6S6ofobnOOC7rKEyaZbwhkvMY0nkULIEUrGMrgc7zXcACXK06Y2nbZGHWNZxeHEl3d TF29jP5lOCV87lrUSfMNl2vVwVkts692J+rJvLQiQhRh3ELOWP0Cfh8Lj2lTg3hh0nQN C20vG3SjsGm7B+CgRwQnx9E3BrKdtlrmDezUUP9vE48rxTW803fvjukB61CN+Op67ntX 4GBA== X-Gm-Message-State: ALoCoQkK+WEeZeeMwDJE+VTG9O9UvbpsUHaYu5YKE3qx7szt6jzZIkjbndsLHMyKQuTCeI2cj2r+ X-Received: by 10.152.26.134 with SMTP id l6mr2968822lag.10.1432823949802; Thu, 28 May 2015 07:39:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.72 with SMTP id h8ls210177laa.71.gmail; Thu, 28 May 2015 07:39:09 -0700 (PDT) X-Received: by 10.112.25.10 with SMTP id y10mr3168284lbf.61.1432823949655; Thu, 28 May 2015 07:39:09 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id r9si2141285lae.5.2015.05.28.07.39.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 07:39:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by laat2 with SMTP id t2so33550433laa.1 for ; Thu, 28 May 2015 07:39:09 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr3147629lbb.112.1432823949552; Thu, 28 May 2015 07:39:09 -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 hn6csp1210574lbb; Thu, 28 May 2015 07:39:08 -0700 (PDT) X-Received: by 10.229.96.138 with SMTP id h10mr3754408qcn.5.1432823948282; Thu, 28 May 2015 07:39:08 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d49si2571173qgf.37.2015.05.28.07.39.07; Thu, 28 May 2015 07:39:08 -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 1463361EDE; Thu, 28 May 2015 14:39:07 +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 1E6E661CA5; Thu, 28 May 2015 14:39:05 +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 BCE4561EB9; Thu, 28 May 2015 14:39:03 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by lists.linaro.org (Postfix) with ESMTPS id 9252A61CA5 for ; Thu, 28 May 2015 14:39:02 +0000 (UTC) Received: by wizo1 with SMTP id o1so64983302wiz.1 for ; Thu, 28 May 2015 07:39:01 -0700 (PDT) X-Received: by 10.194.200.42 with SMTP id jp10mr5840314wjc.66.1432823941293; Thu, 28 May 2015 07:39:01 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id u6sm3661745wjy.13.2015.05.28.07.39.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 07:39:00 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Thu, 28 May 2015 15:38:43 +0100 Message-Id: <1432823923-3920-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] api-next: pktio: add odp_pktio_send_complete() definition 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.42 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 A pktio interface can be used with poll mode drivers, where TX completion often has to be done manually. This turned up as a problem with ODP-DPDK and odp_l2fwd: while (!exit_threads) { pkts = odp_pktio_recv(pktio_src,...); if (pkts <= 0) continue; ... if (pkts_ok > 0) odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok); ... } In this example we never call odp_pktio_send() on pktio_dst if there wasn't any new packets received on pktio_src. DPDK needs manual TX completion. The above example should have an odp_pktio_send_completion(pktio_dst) right at the beginning of the loop. Signed-off-by: Zoltan Kiss --- include/odp/api/packet_io.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index b97b2b8..3a4054c 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -119,6 +119,22 @@ int odp_pktio_recv(odp_pktio_t pktio, odp_packet_t pkt_table[], int len); int odp_pktio_send(odp_pktio_t pktio, odp_packet_t pkt_table[], int len); /** + * Release sent packets + * + * This function should be called after sending on a pktio. If the platform + * doesn't implement send completion in other ways, this function should call + * odp_packet_free() on packets where transmission is already completed. It can + * be a no-op if the platform guarantees that the packets will be released upon + * completion, but the application must call it periodically after send to make + * sure packets are released. + * + * @param pktio ODP packet IO handle + * + * @retval <0 on failure + */ +int odp_pktio_send_complete(odp_pktio_t pktio); + +/** * Set the default input queue to be associated with a pktio handle * * @param pktio ODP packet IO handle