From patchwork Thu Apr 27 11:51:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 98283 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp55278qgf; Thu, 27 Apr 2017 04:53:25 -0700 (PDT) X-Received: by 10.36.30.1 with SMTP id 1mr2442817itt.43.1493294004979; Thu, 27 Apr 2017 04:53:24 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z31si3120668ita.41.2017.04.27.04.53.24; Thu, 27 Apr 2017 04: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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8155561627; Thu, 27 Apr 2017 11:53:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 78D2C61CE9; Thu, 27 Apr 2017 11:52:24 +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 ED8E860D2E; Thu, 27 Apr 2017 11:51:58 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id 9AB0860D2C for ; Thu, 27 Apr 2017 11:51:56 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id t144so15983348lff.1 for ; Thu, 27 Apr 2017 04:51:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=mwLeF09w9Jz7xsQeR5K0W6nLH4iclTfJwyK5i13CSGk=; b=PplQEjRNszpXhW40XrGlLNhGjxg6C1ewrDApjLgVywY5UiL9tOmSJak8kp4WZqCgKs y4ww+i05mXXaXm0SEUWvbUxwarNa1YqHOyEzPE6xhAseC8BbU0AumwALH4nMXt8lwURz RQ3O9TeeO7P/t3CA5DbvCyoQEoR4Ikxw+2XrAsPRSRabVZuRogZkzBE+jKxck4msvmMz ELMTOyi3i2Cb70zmwqAM6RNDZmwCA3CUU/bY5aCg4Wz/PHrIc3KuZ+xlFRZIF8LWr7ta Yw0bfVgrEhaOLlaO18IRWl59/AMMBy1nM2uAx/cQDefhyu5buc/3MFkUVIFxfMeS7b2Y PDTg== X-Gm-Message-State: AN3rC/7EtRMm/ybZ86mcCx4HOj9BTQ0DLmWESs3AS5Kgz2gMlkVw/WD0 9RzgyvPVqVc0SUJeEb3/8/zr X-Received: by 10.25.79.4 with SMTP id d4mr1793149lfb.122.1493293915271; Thu, 27 Apr 2017 04:51:55 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([94.25.229.39]) by smtp.gmail.com with ESMTPSA id 30sm425282lju.0.2017.04.27.04.51.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 04:51:54 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Thu, 27 Apr 2017 14:51:49 +0300 Message-Id: <20170427115150.19452-3-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170427115150.19452-1-dmitry.ereminsolenikov@linaro.org> References: <20170427115150.19452-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [[RFCv2] 3/4] api: ipsec: change semantics of odp_ipsec_result function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" - Move packets from the event instead of copying them. This simplifies event handling/freeing code, which now does not have to track, which packets were copied from the event and which packets should be freed. - Do not require to free the event before processing packets. This allows one to copy packets from the event in small batches and process them accordingly. - Freeing the event in odp_ipsec_result() leaves space for optimized implementations, where an event is actually a packet with additional metadata. Signed-off-by: Dmitry Eremin-Solenikov --- include/odp/api/spec/ipsec.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.11.0 diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 7f43e81c..255c5850 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -1275,17 +1275,23 @@ int odp_ipsec_out_inline(const odp_ipsec_op_param_t *op_param, * Get IPSEC results from an ODP_EVENT_IPSEC_RESULT event * * Copies IPSEC operation results from an event. The event must be of - * type ODP_EVENT_IPSEC_RESULT. It must be freed before the application passes - * any resulting packet handles to other ODP calls. + * type ODP_EVENT_IPSEC_RESULT. The event will be freed automatically if + * odp_ipsec_result() returns 0. In all other case it must be freed via + * odp_event_free(). * - * @param[out] result Pointer to operation result for output. Maybe NULL, if - * application is interested only on the number of - * packets. + * @param[out] result Pointer to operation result for output. May be + * NULL, if application is interested only on the + * number of packets. * @param event An ODP_EVENT_IPSEC_RESULT event * - * @return Number of packets in the event. If this is larger than - * 'result.num_pkt', all packets did not fit into result struct and - * application must call the function again with a larger result struct. + * @return Number of packets remaining in the event. + * @retval > 0 All packets did not fit into result struct and + * application must call the function again. Packets + * returned during previous calls will not be returned + * again in subsequent calls. + * @retval 0 All packets were returned. The event was freed during + * this call. Application should not access the event + * afterwards. * @retval <0 On failure * * @see odp_ipsec_in_enq(), odp_ipsec_out_enq()