From patchwork Tue May 9 00:22:22 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: 98857 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1577784qge; Mon, 8 May 2017 17:22:33 -0700 (PDT) X-Received: by 10.107.20.216 with SMTP id 207mr3250078iou.48.1494289353083; Mon, 08 May 2017 17:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494289353; cv=none; d=google.com; s=arc-20160816; b=AzJNDXwXeadTKrvaaAU2Bj2L1ehJXd6d17AETFkyIONWZd0SYd5fTNhQQZ8RsGNQmf WdtEsD5G87Fr183EfM5LEnpoQFoX0qE5gA84RkUkSCTDB8voMn++crzfvsA+NHRw2jDz COTyIvZIQpVXTBvCS57JHgd9GQ2N/EPSIUMOyYVtWm1uTqtLBL6F5HahkDsAf9oH03U6 gkCN2U0+U91Sk5ZvhHDOasmYJExwnXfnqSOfb4T7X9c3w47SBWbvRRLeHADijbSR//T7 BHl4Tse9/gJUUcy22jjor+O2Beu+0N4VH5BVxZ9845xo1hd/doMDsUE7vkU41PNV59j8 Tclg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :delivered-to:arc-authentication-results; bh=btfkMnIGuWGv9g3KHs1rakQ9cfJub2TEWqjos4fc4Vc=; b=pzshGgKYj9sBtvNKB6Pz9mBQvrgeetMV79kkB8P0tBWViOvHK1+ryAeJleZqexVanU /UEXZB4/QwiAjhYlKnGHfQ4gb9q5X2xR7VyHcvU6zp3PMyiRh8V13bsq11HJGMToRzYW WxXB4wE+VqmYJsj9WFRvXSZwh5L1RRic3kJ0PDNC7Xjv3wYhlVhO5HZ/+KwzCBO3wONi 1/YaSPmzXR+CIsCrCQwcT2RiBVU1gmxIVyoah20jeMo6bex2KtMLG7HZxszRFM9tZ/eW +k0xCaWzbsaZ5GHYKHhN1VKzDIUnPUVPSeIzi3GpULrt33Jer+3sJJJXddTVnpANlA7G EfWQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u126si11570737itb.26.2017.05.08.17.22.32; Mon, 08 May 2017 17:22:33 -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 8278F60AD0; Tue, 9 May 2017 00:22:32 +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=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 22EB260722; Tue, 9 May 2017 00:22:28 +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 106C1607B3; Tue, 9 May 2017 00:22:26 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by lists.linaro.org (Postfix) with ESMTPS id 32AF460721 for ; Tue, 9 May 2017 00:22:25 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id m17so11358910pfg.3 for ; Mon, 08 May 2017 17:22:25 -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=KePoCUPqeQJiZzjCAIK6WMnd5h4vfZp97ZZl9PXjS60BPR7yVc9LTxgjKCV0yQwkWU t0G+3I9fYSsss13IwaEWUTVxa85e5qNIWpMMscZUpfW95HEvCPIZbcNKeQj/i1uwqVsP 5gof50bcMz3d0DoDI/07Bp/+VICHLF64j6Thni8kV2EtiYgcUgJxbLt08HfKoJv6neAv 8hZ8JPyDdB/zNQ4vzqkv4ET0IC/TFtgVG63pGqjFgMO2PZ7nhck89SinfxldM3vCUTkK wvPgXa3UpJvP0CxyIus0HyB5zFmyBjlexVZ925WaUw64FxNSr2iU5GI+LUiIv4PUlddC ha3w== X-Gm-Message-State: AN3rC/6LaKJXoT5h90Uagb/0otddy74nd0n0Z3it6efFZww/YbrQSRgz GU8U7C6xc8M9/qKeuBd8/Omc X-Received: by 10.84.224.200 with SMTP id k8mr65851379pln.49.1494289344225; Mon, 08 May 2017 17:22:24 -0700 (PDT) Received: from forlindon.cisco.com ([128.107.241.168]) by smtp.gmail.com with ESMTPSA id x198sm22503874pgx.28.2017.05.08.17.22.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 17:22:23 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 9 May 2017 03:22:22 +0300 Message-Id: <20170509002222.2438-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [PATCH] 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()