From patchwork Wed Apr 19 15:16:34 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: 97644 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp371458qgf; Wed, 19 Apr 2017 08:16:45 -0700 (PDT) X-Received: by 10.107.30.80 with SMTP id e77mr3567733ioe.12.1492615005520; Wed, 19 Apr 2017 08:16:45 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 198si3370472ioz.231.2017.04.19.08.16.44; Wed, 19 Apr 2017 08:16: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; 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 4A6F562DAC; Wed, 19 Apr 2017 15:16:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2F6DA6090D; Wed, 19 Apr 2017 15:16:42 +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 94AB860985; Wed, 19 Apr 2017 15:16:40 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id 4C7AA608BE for ; Wed, 19 Apr 2017 15:16:38 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id 75so14262469lfs.2 for ; Wed, 19 Apr 2017 08:16:38 -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; bh=btfkMnIGuWGv9g3KHs1rakQ9cfJub2TEWqjos4fc4Vc=; b=TprWq9OcN689Xl9bkCRzO56ajhlGj4aR/5wbAxnvyewkobRqT0aHpY+xgel5b6hNKi vPogjE1uSCVZnNtW98XWYM3KmzgkmJNVndYqDMQv9CTD82nCOzD8PQs6etZeOnlpEDYT /9LyqpRTVkG6jvflVgcmYXF9xO6vQRsvJAhvRlLNbNb3VQeQqojt487C1rOG9ndc5K84 YIYUElqr4S/sxMqX9xRz5xkDZ08DUSq2cnV4LMP4iJ8snzGKo3P9flNWL5iMwmB/+lMn kdEV19J7T3n0sjNuefv5PrvVOBsWPkQQslBbk7HYfmChLSqriygQzdzGdo7kASzSL4Jl ul4w== X-Gm-Message-State: AN3rC/5TLPFpISD4yp76yU+ziYJMrgPJiEOtnZ8gQh+u45T5+nsCvrcz u+X4jneu6mvznarjloTnK/5n X-Received: by 10.25.233.195 with SMTP id j64mr1321454lfk.29.1492614996788; Wed, 19 Apr 2017 08:16:36 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.65.18]) by smtp.gmail.com with ESMTPSA id b62sm491097lfb.17.2017.04.19.08.16.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 08:16:36 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Wed, 19 Apr 2017 18:16:34 +0300 Message-Id: <20170419151634.29710-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [API-NEXT PATCH v2] 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 a0ceb11a..78645567 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -1278,17 +1278,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()