From patchwork Tue Mar 21 14:17:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 95659 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1546162qgd; Tue, 21 Mar 2017 10:13:55 -0700 (PDT) X-Received: by 10.200.56.97 with SMTP id r30mr32753620qtb.229.1490116435657; Tue, 21 Mar 2017 10:13:55 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w66si16177543qkd.131.2017.03.21.10.13.55; Tue, 21 Mar 2017 10:13:55 -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 2FAA563610; Tue, 21 Mar 2017 17:13:55 +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, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 B008D63637; Tue, 21 Mar 2017 17:13:11 +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 04609635D3; Tue, 21 Mar 2017 14:17:29 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0117.outbound.protection.outlook.com [104.47.2.117]) by lists.linaro.org (Postfix) with ESMTPS id 2A58A62D9B for ; Tue, 21 Mar 2017 14:17:28 +0000 (UTC) Received: from DB4PR07CA027.eurprd07.prod.outlook.com (10.242.229.37) by DB6PR0701MB2759.eurprd07.prod.outlook.com (10.169.215.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.8; Tue, 21 Mar 2017 14:17:26 +0000 Received: from AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::208) by DB4PR07CA027.outlook.office365.com (2a01:111:e400:9828::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.4 via Frontend Transport; Tue, 21 Mar 2017 14:17:27 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 131.228.2.35 as permitted sender) Received: from hybrid2.ext.net.nokia.com (131.228.2.35) by AM5EUR03FT027.mail.protection.outlook.com (10.152.16.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.7 via Frontend Transport; Tue, 21 Mar 2017 14:17:26 +0000 Received: from fihe3nok1346.nsn-intra.net (10.158.36.134) by fihe3nok1346.nsn-intra.net (10.158.36.134) with Microsoft SMTP Server (TLS) id 15.1.466.34; Tue, 21 Mar 2017 16:17:25 +0200 Received: from mailrelay.int.nokia.com (10.130.128.21) by fihe3nok1346.nsn-intra.net (10.158.36.134) with Microsoft SMTP Server (TLS) id 15.1.466.34 via Frontend Transport; Tue, 21 Mar 2017 16:17:25 +0200 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v2LEHDAD004606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 21 Mar 2017 16:17:13 +0200 Received: from 10.144.19.15 ([10.144.104.219]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v2LEHDxU004603 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Tue, 21 Mar 2017 16:17:13 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Tue, 21 Mar 2017 16:17:11 +0200 Message-ID: <1490105833-3990-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.35; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39860400002)(39840400002)(39450400003)(39410400002)(2980300002)(9170700003)(2906002)(33646002)(50466002)(53936002)(22756006)(50986999)(5003940100001)(8936002)(189998001)(47776003)(50226002)(38730400002)(6916009)(36756003)(356003)(48376002)(110136004)(77096006)(8676002)(305945005)(2351001)(5660300001)(575784001)(86362001)(106466001)(81166006)(105596002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0701MB2759; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM5EUR03FT027; 1:a/2S29GiAHQfkocHZFG8mookgRLd29YXg0WYAnl3qtBwIUjTe1Au8UDdiHWJpla+VYlAw6sZU+M2T/ZwBRs3W4m1zUrO+ypoQl4GSG+cPmsj8egCuEsRgL2iJG04BsKvf40MvOhZqlcbYjYP6Gs9p9sLoOWFmfn6FqIVw0C9xDWcjHgR3wwI/yGrMH+gycWETitCMD/dP8HIuWxFXlt6tYAvhlWDwaIwrfjLgoItHoqp09hQGtjWkxpUiQrruBP+2hPpk8NjIJUeMBO4MBM2hd+n0EeJ70ojQamwD9BKO3gegsEnBrpWSndQZRP0V+x1dxmGokJdTQBFnys8XNPLxAeD9HxfkM0OQ9ECqX1zPlEPLG367LCVrPX/QRNwPPGjUFutOevGc5gBX8AyPl9WWLvSE4ENAipImHShIj7v/ObJFPnXmpWwhrg3zE0HE5kZgAZhf5LhtfgBQIcwBilzdmkoPQwkvvYQrhL7UpRId+o= X-MS-Office365-Filtering-Correlation-Id: 1d724bc2-a59e-4d88-fb1c-08d470650066 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075); SRVR:DB6PR0701MB2759; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 3:Az6j80CUL4nMpYNXksWiwfPDgKqpakoVI6qLXADU5EbsdNTdNOeNNA5Ls2ETlphCTE5z3unjQSui/g5SoeqBiRcvMCq4V/ly2UKT7+RFUZRy8VxlecCsqQs5p2SWx3ULTsLrGr0lZldnI9hmUiJU1FGBu34822Y7iWbUS54a0tEUItqFBbKvcr8vwgpfDqWYf2TZC/K4M8lqXN1GUTQ9mpixKRduUM0Qf+2VSfchtScYY17LwYmCbwSiC0Y5gCdOShosnyLZZe/a2x81yBmrjY67WIyg5H6nJAvkGTlfglc2ACBAETv2UaJbP+mXa5KCmOhcNpn5TwILTS5uK+N+WC15HWsTjT1+TQgYZi9wc8nHs9etQfVKDgacLEQk2X1iLc2Yxz42c7Tarp6xUcVt5Q==; 25:rhY8wPyy/ny5kR0DLt5R1M+huX+SyPoYvUUHTlb2h/Ot/ez/gHtEOIUVShDyeipTTOuso7QD5AURxCcSn4ELde09DcDXWwZ2yZbudSK6gEsRkhavnL4Gnrk/tDmWvhNxqUwD/0ERu3LduIytiyokwHdvIHSsAVYZCVDKA1w+QvnLzG1zTA9QqR6lB0mdglxXyWSNrKsXCHqIliklTehP4Zn7PVgq06PLVg8goUKFUkZAezpuIguo4Zhnjn90jSVyVBrFK2V3IDfSsaNd7i5ylzQfVlYLsl8HD0VqN3AzavDgM9R9mpvm4zxWMazbbmeMqGu1lnqsIZWS48jzFcWnm5vXmQKf9bCJWEKz5IWiqcMDtSglAsC1oFKHF9jAh/557DRizKnYhbhSTdPVg8RsyViBJwcGZTDYyg5wqKDd2IdDql2ilsbzlCnWf/wVLkO/vfnVF0vJiDKG0dv4YX3f8A== X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 31:0QH1QB19/WV9EqznMrXJiFCFYIp7IxNxbx4zQiPftUzQFNirBkr5NJdR2IuXtRNKZYIA0X+Y6VrNY9mbhc2/hrrv901NbawKDbEME2Wx8vQgc/UR5XccJucKx0o7xSPHnwobVkM/GdmD22rdBNa7YBoPZ5ooMIXXxOCEi6h+pdywkFPl0vZ2WGfO95mV3Z8pW30Jpmbn8NCH6zykYScBT7IsrP5TpMkoM+tZDdLdxWSgfEplrktDlnvCgqxdQm6kBRBdxkQ/syIb+6+izaBcJg==; 20:PdwZve/MMxjIxbjcqrL5alobmLDb7N8aoc9vBdrjctBvY8B/FPoyhBwRzW4XWiKKq7D0tbf7hQqxXPvVOifchrwxdqJCLypPCUvj5eAKXtKSMfV8xKRnI+awcHp5eqF23XM561uuHctQBFG5EH4ko/SxbmIfjsYihXxX4XnJbbBHhcfYhkeX7C0qdABqnbmEIzK5Dqn/gSO8Lr6GY0UHWgvByaD060PQL42TOThz8iVTPR1p00WkqUIb9uW0Vhgb20SjPjoFAIcLbJvIBeAFnn1pjO9GIU0RVlb9MH8aXy+AYs+fc5LnvA/FXoXXX5StGvoddP9Py4/g4QTskrsek+q/DS9txTMxPiEZ2JdBqXa3/SOqq7gv5cVqODn5v0f/szj+V7zUvFnJAGhtf6+xj+c1BilbNSh8bjFBa30DM7EIg+m35qvpGMzl4d3jRa4u3maT8HJDsxxUmar7b9wGEwn5JknuEOXJqPukBU+tfqFwqNGEYVBrzjBWZC4fGUtLmwdPDxcbepPsdMGyB7kDVIUF+jvQUurxCe3oN7KHZ6lBo9g0hRx5v2FWmRGpsQP14bYITZneZNsGXtUSRh84oSg5ZwNOEeGOURhYstQbggI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(13016025)(13018025)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123558025)(20161123564025)(20161123560025)(20161123555025)(6072148); SRVR:DB6PR0701MB2759; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0701MB2759; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 4:UrMR7zWKWYGvyiVcFGxI05kLdTTux91xmXY6b4w8XibyeKwNUsMnFx8GHurP5ggVAHX7AWt5PB7eRDDJJrvFYFnIyTpXJowa7FqxcEi8rae+z7551ASpXEHrnVl7OENwJ2rmkTsxpqKyoV6YZ1ELJ1XVfT/EmeNnV4iP4YQEpJ8frO893hGKq509diDOjCUN6Waui7ci3GS8kin/oFM23jQpypzgiO7yuEbLZ/CLiUMlfo7yDvPJ9bOzNQzNgVgQxltZoKFPl2i12Q1e4hpzYi72N+nE/USqkPuavgClK/3G0g5V/7PzvcYI78OXIxI/HvPTVeYkxr9P2KNAIiFinNu+qCqwW2g3RhRhRdiwN6aWBPkqmxuFwFNN5PPfylzTnd7z/mWx4xERkUJUMUkWa5rzYBeCOA+GZdxAnViClHWMawwtn0UARxHRrn4DfvK0cFlvsBYznqwcbWxwAbTT88JLkDsUVmp4+sDUoDI1c1wYZXZkIk/KalC5wQEKI4SFFZCdjFMGmsv8Gwacwvfpw6ZWY7XnL3raNAljcm+F839hlYlD++p4aYyTEPTt2obX9kcl85vwflnFpXofNMVJreMwqKAV/L6i8RtndGYgsz/nIqOVGxRvePRL5RqDJWJq5Wd93cyCsrgG67CbmjIEPTKjXfSt9qlkIJyPGZ0L/yI= X-Forefront-PRVS: 02530BD3AA X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 23:VbIFdMezcoC2F3IO4M6zUdfRFPZtshfHncglVqFHG6m7JtAbmCWH2vjS/I0iSPOW4yc9HECZRtmEjr4Ung8BOLST1aRd6+hyeJmn33dQvMtQrJdK6uFnRXOaPgtNlSd9+KGrzi5XJrWRt816W1/sTWy0nCB2lTyss0hvJDig29hA3JtZddIJ8VV7YFbQhOsk/dd8ZIJQL0ZTxwu4KHqVollWvVrmk/xPk9NySzFCZxHuzFLPTa0s/TYReeGGAM5SBo4C/AMhEBTOiwlq/PJTSAOKXffK7PJ/uJiREfRmpzjfNVMTCXYNoMmSA5kL60xy1YIXjPH4Nm5kQybLvHDSUyYNRx5qXIzulH2TE1DqOL5iq9SJxjqVFU8kiHd2utLARsekckwF1qx9LZl3DRZdfXRINdAjnAExFrRH473ieOpQmaDJA1NCcWPjagJjUQHny1honA7EcOLjqpr+BNwyKgHC7iVh9+V7nzcmqfJmS82wi/lEpDx/89Y3nTUowQ/qkJGDZExN5GvkJETcwlWHd7xO9dkbCR8Cdajh2a+wb5qyO+ihgbQ8mjF6vgaHKrd3DfGkIrgkaowBtBBSQdKCwk0GQscYmgWMD1UdWYhcbR4bcB/AmVCBzjMqI9kVxGml7F06a+bwMdVEEWxlnWVo9su8I3rdKBKFcpVFosde860wsl1fVA5R25HwmAcms1Tj5aBdxr0eXxgfiwuWElo0xQU7sgqZakvFJg/nWxpUd7YGvJLBdJbEfm1+sGShBQqQFHqRabRsED6BRvtUN8skaWwHvvv6ZoXsD85iIpeLekWOuOZS4WKKeuZQooOw54Vapre9U+5FxlY3wtXRTxw+zFEGKW0TDu0v1CwC4vPa1DwtsNT3pEnl3H9DwmEJpf/Oka8h5usFEOkSB/31v5zA8pjY6Z3QGrrmSuOLnbajGn8DJLbwSigbhHc2U1TeKkqK X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 6:ILrtx/yaLmpfP+6o4XIw5b3SQhudS5eeOzNmj3Au8CaEPwZ9RubdaXLrJ7RBKrxEqYgyYBFEv7ellG9t8r582MhwmVOmvSfvjmU8/gwcT7fwea7LvdANrRkTxdYqdvKht8CnifivrmDmjhiCLdVdFodNa50qO6nphOQUr2oVbn9MFiP1RmE6yh1hrBHeGVb3uDKg1hGS2aslblHqVXzbt2fANtO1khYAnwMW5tvvAA4HmkFpnPmz0vjSf8ISqSS4FIx4eFuBSjUF4fDO3RKrr9pUdFonh8Qq7ZMlb4gs6fBS74pk2QoTi2zzy/2mDwXl96KMinLSChllS8hRCQ3oDaSUJVQcC12XEIvI5zj29Eu7PzUqMbR1vP3B+yXufNbfxKD0uNLsJEu8TDEk5EJayVX/3ntsywTKb7EXVizdXpo=; 5:6kfcqR81wfdlu/2j4jbZCc2kqaNBxgTViiOpZCKB7fGg3BtmICHuPaGqevzHJI5JZqzvHv1yOabZD308iQ4G26lfOM3UstqCJ6sh5F7sXImE3IxOQoqU2hzBNpgCEiygIy2LWTeztpL5b/CQfWHs6g==; 24:HJbcskGTnS4E16jucM6A1kvk5u5nv81y9wcfqULQl0XpPtb/lfuOeFd4YyL+4UiqW58DgHpkFFTQ/ZBjkimM37D1a7nSAZ5w1eZ6I/oKs80= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0701MB2759; 7:xiKdXN5vf15/Q3dzs1WvhLxW9Go9gPca+HD3ZfEUPDgvsyTrHiPm0V6XfRR8dePL3ho6WZyVqbRGnWIr5wjonr9c/Cwedopf/LoRPyhSrk4SlGNyYNE1fJVXZNUFgV40a9vnf9Xb3x54sr7Q7eXgIEEalhSSEZba3nv/z5mm9nk9D/79seHfnfcqbKh07onUHMN4MriamsJYreZwJ4mp/3epVUrY06+G6EHaJ+bsGR8/q9Y9H+4QHCvMES5XB1tOR21Uze2kjsi0XXdeWp9vzryROfD44TLKfh90MgDUhMptYdH3DqkkqyEEgkm/18gkjtnpy9s8Dqad64164NjxCw== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2017 14:17:26.6058 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.35]; Helo=[hybrid2.ext.net.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2759 Subject: [lng-odp] [API-NEXT PATCH v2 1/3] api: ipsec: extend lookaside API 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" Added configuration option for inbound SPI range and default queue. Added SA disable function and status event for the response from it. The same event may be used for e.g. IPSEC statistics, etc queries. Improved outbound fragmentation documentation. Signed-off-by: Petri Savolainen --- include/odp/api/spec/event.h | 2 +- include/odp/api/spec/ipsec.h | 181 +++++++++++++++++++++++++++++++++---------- 2 files changed, 143 insertions(+), 40 deletions(-) -- 2.8.1 diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index 75c0bbc..f22efce 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -39,7 +39,7 @@ extern "C" { * @typedef odp_event_type_t * ODP event types: * ODP_EVENT_BUFFER, ODP_EVENT_PACKET, ODP_EVENT_TIMEOUT, - * ODP_EVENT_CRYPTO_COMPL, ODP_EVENT_IPSEC_RESULT + * ODP_EVENT_CRYPTO_COMPL, ODP_EVENT_IPSEC_RESULT, ODP_EVENT_IPSEC_STATUS */ /** diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 66222d8..e951e49 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -56,6 +56,30 @@ typedef enum odp_ipsec_op_mode_t { } odp_ipsec_op_mode_t; /** + * Configuration options for IPSEC inbound processing + */ +typedef struct odp_ipsec_inbound_config_t { + /** Default destination queue for IPSEC events + * + * When inbound SA lookup fails in asynchronous or inline modes, + * resulting IPSEC events are enqueued into this queue. + */ + odp_queue_t default_queue; + + /** Inbound SPI range. Minimal range size may improve performance. */ + struct { + /** Minimum inbound SPI value that application will use. + * Default value is 0. */ + uint32_t min; + + /** Maximum inbound SPI value that application will use. + * Default value is UINT32_MAX. */ + uint32_t max; + } spi; + +} odp_ipsec_inbound_config_t; + +/** * IPSEC capability */ typedef struct odp_ipsec_capability_t { @@ -111,6 +135,13 @@ typedef struct odp_ipsec_config_t { */ odp_ipsec_op_mode_t op_mode; + /** Maximum number of IPSEC SAs that application will use + * simultaneously */ + uint32_t max_num_sa; + + /** IPSEC inbound processing configuration */ + odp_ipsec_inbound_config_t inbound; + } odp_ipsec_config_t; /** @@ -529,6 +560,29 @@ void odp_ipsec_sa_param_init(odp_ipsec_sa_param_t *param); odp_ipsec_sa_t odp_ipsec_sa_create(odp_ipsec_sa_param_t *param); /** + * Disable IPSEC SA + * + * Application must use this call to disable a SA before destroying it. The call + * marks the SA disabled, so that IPSEC implementation stops using it. For + * example, inbound SPI lookups will not match any more. Application must + * stop providing the SA as parameter to new IPSEC input/output operations + * before calling disable. Packets in progress during the call may still match + * the SA and be processed successfully. + * + * 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. + * + * @param sa IPSEC SA to be disabled + * + * @retval 0 On success + * @retval <0 On failure + * + * @see odp_ipsec_sa_destroy() + */ +int odp_ipsec_sa_disable(odp_ipsec_sa_t sa); + +/** * Destroy IPSEC SA * * Destroy an unused IPSEC SA. Result is undefined if the SA is being used @@ -567,55 +621,59 @@ typedef struct odp_ipsec_op_opt_t { #define ODP_IPSEC_OK 0 /** IPSEC operation status */ -typedef union odp_ipsec_status_t { - /** Error flags */ - struct { - /** Protocol error. Not a valid ESP or AH packet. */ - uint32_t proto : 1; +typedef struct odp_ipsec_op_status_t { + union { + /** Error flags */ + struct { + /** Protocol error. Not a valid ESP or AH packet. */ + uint32_t proto : 1; - /** SA lookup failed */ - uint32_t sa_lookup : 1; + /** SA lookup failed */ + uint32_t sa_lookup : 1; - /** Authentication failed */ - uint32_t auth : 1; + /** Authentication failed */ + uint32_t auth : 1; - /** Anti-replay check failed */ - uint32_t antireplay : 1; + /** Anti-replay check failed */ + uint32_t antireplay : 1; - /** Other algorithm error */ - uint32_t alg : 1; + /** Other algorithm error */ + uint32_t alg : 1; - /** Packet does not fit into the given MTU size */ - uint32_t mtu : 1; + /** Packet does not fit into the given MTU size */ + uint32_t mtu : 1; - /** Soft lifetime expired: seconds */ - uint32_t soft_exp_sec : 1; + /** Soft lifetime expired: seconds */ + uint32_t soft_exp_sec : 1; - /** Soft lifetime expired: bytes */ - uint32_t soft_exp_bytes : 1; + /** Soft lifetime expired: bytes */ + uint32_t soft_exp_bytes : 1; - /** Soft lifetime expired: packets */ - uint32_t soft_exp_packets : 1; + /** Soft lifetime expired: packets */ + uint32_t soft_exp_packets : 1; - /** Hard lifetime expired: seconds */ - uint32_t hard_exp_sec : 1; + /** Hard lifetime expired: seconds */ + uint32_t hard_exp_sec : 1; - /** Hard lifetime expired: bytes */ - uint32_t hard_exp_bytes : 1; + /** Hard lifetime expired: bytes */ + uint32_t hard_exp_bytes : 1; - /** Hard lifetime expired: packets */ - uint32_t hard_exp_packets : 1; - } error; + /** Hard lifetime expired: packets */ + uint32_t hard_exp_packets : 1; - /** All bits of the bit field structure - * - * This field can be used to set, clear or compare multiple flags. - * For example, 'status.all != ODP_IPSEC_OK' checks if there are any - * errors. - */ - uint32_t all; + } error; -} odp_ipsec_status_t; + /** All error bits + * + * This field can be used to set, clear or compare multiple + * flags. For example, 'status.all_error != ODP_IPSEC_OK' + * checks if there are + * any errors. + */ + uint32_t all_error; + }; + +} odp_ipsec_op_status_t; /** * IPSEC operation input parameters @@ -673,14 +731,15 @@ typedef struct odp_ipsec_op_param_t { */ typedef struct odp_ipsec_packet_result_t { /** IPSEC operation status */ - odp_ipsec_status_t status; + odp_ipsec_op_status_t status; /** Number of output packets created from the corresponding input packet * * Without fragmentation offload this is always one. However, if the * input packet was fragmented during the operation this is larger than - * one for the first fragment and zero for the rest of the fragments - * (following the first one in the 'pkt' array). + * one for the first returned fragment and zero for the rest of the + * fragments. All the fragments (of the same source packet) are stored + * consecutively in the 'pkt' array. */ int num_out; @@ -745,6 +804,34 @@ typedef struct odp_ipsec_op_result_t { } odp_ipsec_op_result_t; /** + * IPSEC status ID + */ +typedef enum odp_ipsec_status_id_t { + /** Response to SA disable command */ + ODP_IPSEC_STATUS_SA_DISABLE = 0 + +} odp_ipsec_status_id_t; + +/** + * IPSEC status content + */ +typedef struct odp_ipsec_status_t { + /** IPSEC status ID */ + odp_ipsec_status_id_t id; + + /** Return value from the operation + * + * 0: Success + * <0: Failure + */ + int ret; + + /** IPSEC SA that was target of the operation */ + odp_ipsec_sa_t sa; + +} odp_ipsec_status_t; + +/** * Inbound synchronous IPSEC operation * * This operation does inbound IPSEC processing in synchronous mode @@ -897,6 +984,22 @@ int odp_ipsec_out_enq(const odp_ipsec_op_param_t *input); int odp_ipsec_result(odp_ipsec_op_result_t *result, odp_event_t event); /** + * Get IPSEC status information from an ODP_EVENT_IPSEC_STATUS event + * + * Copies IPSEC status information from an event. The event must be of + * type ODP_EVENT_IPSEC_STATUS. + * + * @param[out] status Pointer to status information structure for output. + * @param event An ODP_EVENT_IPSEC_STATUS event + * + * @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); + +/** * Update MTU for outbound IP fragmentation * * When IP fragmentation offload is enabled, the SA is created with an MTU.