From patchwork Wed Oct 25 09:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 117025 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp606580qgn; Wed, 25 Oct 2017 02:02:18 -0700 (PDT) X-Google-Smtp-Source: ABhQp+REfMBSF4GIpEs2AUMUnDYI09WZuIlgrnPjNrzcWV95Ps/6VffhGMVEw5xmrB53Y1dFsjia X-Received: by 10.55.165.82 with SMTP id o79mr1945379qke.198.1508922138570; Wed, 25 Oct 2017 02:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508922138; cv=none; d=google.com; s=arc-20160816; b=jaAM36mWcquyyUK51W80K70SycHj5qCv0wsNz5Y9cvTxpOeMSjP8o1An8VXjwp9B/c Z8MtcQnxxYyNQZklIRB87V1YpfpZd5Gnp93DIqB75Vc1daE338xp9L5Zt04k3ss26rAt ISBF3a//VrjXT1HP8UlrOvN9mzAIXONFZpwFwOH1bWbxH6v/I/MbX4q0hLqAsNUfKSPV hYkFYgl9pONUvOhoxv+AmGquFvPFmNmvfU8SNSK4DEXwHZrUSG47+YGKgb/NaL11OSXc u6XPLfnh3WluG7uZD/zTBa7tVqlwR0IE4rHGP7MH6CWL1RzzgWazzxqsn6pPUmW1UaaO O+eQ== 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:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=swUUyq2GMd1X7cz9ncefnNgkRQb2+4oW7Fl3QUGkRE4=; b=NdCy2MQW2Juy6oZKRb7GbD4HbqIkOXJ4UjMtoLECYEf0IjzqrFCdoQfSkzroaPEKCv BAvbZhViEE3k/JJKTyS3EzfTL/ZurIkgVZvFzxEJDU4BaDgsqol5xO2b77TU0eVc0/Kz 784GkxEdT/wf7NDruAd3Md6Xe82Hj2MPWe8aWL6YpX6u34tEro1Cp+dVG9f5ezZNJwjG 3eSKTwZRG+wTX1npj9RLAvNffE/2/lFBQYC5NeItOp09ZUUs9865tm+mABJVzD0CN/B/ s5+s2dD0o0qv4qYGOqSzxWwk3cCJhfA27cWQ9MPZkOPE8XDTHXVsXr/5lRFfqUhEl3DO x+/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id k198si1260864qke.395.2017.10.25.02.02.18; Wed, 25 Oct 2017 02:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 4A7F761613; Wed, 25 Oct 2017 09:02:18 +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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 97ABA62951; Wed, 25 Oct 2017 09:00:53 +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 55D4162295; Wed, 25 Oct 2017 09:00:40 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 8D6E561021 for ; Wed, 25 Oct 2017 09:00:33 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 11D691805952 for ; Wed, 25 Oct 2017 12:00:32 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id G57CiHoILe-0VYac0TY; Wed, 25 Oct 2017 12:00:32 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XHnwxaWkV5-0VfimO4P; Wed, 25 Oct 2017 12:00:31 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 25 Oct 2017 12:00:05 +0300 Message-Id: <1508922007-30582-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508922007-30582-1-git-send-email-odpbot@yandex.ru> References: <1508922007-30582-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 256 Subject: [lng-odp] [PATCH API-NEXT v4 1/3] api: ipsec: rework ODP_IPSEC_SA_DISABLE into packet error 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" From: Dmitry Eremin-Solenikov According to the discussion on mailing list, most of implementations will not be able to support odp_ipsec_sa_disable() status event directly. Instead they will submit a dummy packet to that SA. Then after receiving this packet after odp_ipsec_result() will detect this packet and will report it as a packet with odp_ipsec_error_t->sa_disabled bit set. Signed-off-by: Dmitry Eremin-Solenikov Cc: Nikhil Agarwal Cc: Balasubramanian Manoharan --- /** Email created from pull request 256 (lumag:ipsec_sa_disable_v2) ** https://github.com/Linaro/odp/pull/256 ** Patch: https://github.com/Linaro/odp/pull/256.patch ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375 ** Merge commit sha: ba520d0a3f4c46777c7aedca029e9979a89c69e7 **/ include/odp/api/spec/ipsec.h | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 26e852fca..b9ad282ce 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -843,10 +843,12 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param); * * When in synchronous operation mode, the call will return when it's possible * to destroy the SA. In asynchronous mode, the same is indicated by an - * ODP_EVENT_IPSEC_STATUS event sent to the queue specified for the SA. The - * status event is guaranteed to be the last event for the SA, i.e. all - * in-progress operations have completed and resulting events (including status - * events) have been enqueued before it. + * artificial packet event sent to the queue specified for the SA having + * sa_disabled error bit set in the odp_ipsec_packet_result_t returned by + * odp_ipsec_result(). The packet is guaranteed to be the last event for + * the SA, i.e. all in-progress operations have completed and resulting events + * (including status events) have been enqueued before it. No packets will come + * from SA after this one. * * @param sa IPSEC SA to be disabled * @@ -914,6 +916,12 @@ typedef struct odp_ipsec_error_t { /** Hard lifetime expired: packets */ uint32_t hard_exp_packets : 1; + + /** + * SA is disabled, all packets are processed, it is + * safe to destroy it now. + */ + uint32_t sa_disabled : 1; }; /** All error bits @@ -927,7 +935,13 @@ typedef struct odp_ipsec_error_t { } odp_ipsec_error_t; -/** IPSEC warnings */ +/** + * IPSEC warnings + * + * For outbound SAs in ODP_IPSEC_OP_MODE_INLINE mode warnings can be reported + * only as status events. In all other cases warnings are reported as a part of + * IPsec packet result metadata. + */ typedef struct odp_ipsec_warn_t { /** IPSEC warnings */ union { @@ -1133,15 +1147,6 @@ typedef struct odp_ipsec_packet_result_t { * IPSEC status ID */ typedef enum odp_ipsec_status_id_t { - /** Response to SA disable command - * - * Following status event (odp_ipsec_status_t) fields have valid - * content, other fields must be ignored: - * - sa: The SA that was requested to be disabled - * - result: Operation result - */ - ODP_IPSEC_STATUS_SA_DISABLE = 0, - /** Warning from inline IPSEC processing * * Following status event (odp_ipsec_status_t) fields have valid @@ -1152,7 +1157,7 @@ typedef enum odp_ipsec_status_id_t { * This status event is generated only for outbound SAs in * ODP_IPSEC_OP_MODE_INLINE mode. */ - ODP_IPSEC_STATUS_WARN + ODP_IPSEC_STATUS_WARN = 0 } odp_ipsec_status_id_t; @@ -1166,13 +1171,6 @@ typedef struct odp_ipsec_status_t { /** IPSEC SA that was target of the operation */ odp_ipsec_sa_t sa; - /** Result of the operation - * - * 0: Success - * <0: Failure - */ - int result; - /** Warnings of an ODP_IPSEC_STATUS_WARN status event */ odp_ipsec_warn_t warn; @@ -1469,8 +1467,6 @@ int odp_ipsec_result(odp_ipsec_packet_result_t *result, odp_packet_t packet); * * @retval 0 On success * @retval <0 On failure - * - * @see odp_ipsec_sa_disable() */ int odp_ipsec_status(odp_ipsec_status_t *status, odp_event_t event);