From d710dbbdbb11b4ba29e63491885043e23b01ee91 Mon Sep 17 00:00:00 2001 From: Aakash Sasidharan Date: Wed, 7 Apr 2021 10:38:44 +0000 Subject: api: ipsec: add destination queue capability In some ODP implementations, plain queues might be using software primitives such as a simple ring and the ODP IPsec hardware can enqueue completion events only into schedule queues. Introducing capability queue_type_sched and queue_type_plain which define the queue types that can be the destination of the IPsec events. Signed-off-by: Aakash Sasidharan Reviewed-by: Janne Peltonen --- include/odp/api/spec/ipsec.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 3441d83c9..a75740c0c 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -338,6 +338,28 @@ typedef struct odp_ipsec_capability_t { */ uint32_t max_cls_cos; + /** + * Scheduled queue support + * + * 0: Scheduled queues are not supported either as IPsec SA destination + * queues or as IPsec default queue + * 1: Scheduled queues are supported as both IPsec SA destination queues + * and IPsec default queue + * @see odp_ipsec_sa_param_t + */ + odp_bool_t queue_type_sched; + + /** + * Plain queue support + * + * 0: Plain queues are not supported either as IPsec SA destination + * queues or as IPsec default queue + * 1: Plain queues are supported as both IPsec SA destination queues and + * IPsec default queue + * @see odp_ipsec_sa_param_t + */ + odp_bool_t queue_type_plain; + /** Maximum number of different destination queues. The same queue may * be used for many SAs. */ uint32_t max_queues; -- cgit v1.2.3 From c7f4b7f0ba0d5895653376ba735888427fdff814 Mon Sep 17 00:00:00 2001 From: Janne Peltonen Date: Mon, 20 Sep 2021 13:33:20 +0300 Subject: api: ipsec: do not promise original packet back after all errors Specify that the output packet of an errored IPsec operation is not the unmodified input packet but a packet with undefined content. This is already the case in the linux-gen implementation and is basically required by implementations that use in-place crypto operations which modify the packet (with combined mode algorithms) before checking for authentication error. Still promise the original input packet back after sa_lookup and mtu errors since in those cases the application is expected to continue processing the packet. Signed-off-by: Janne Peltonen Reviewed-by: Petri Savolainen Reviewed-by: Anoob Joseph --- include/odp/api/spec/ipsec.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index a75740c0c..7193571a2 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -1613,9 +1613,10 @@ typedef struct odp_ipsec_status_t { * packets consumed and outputs a new packet handle for each outputted packet. * Outputted packets contain IPSEC result metadata (odp_ipsec_packet_result_t), * which should be checked for transformation errors, etc. Outputted packets - * with error status have not been transformed but the original packet is - * returned. The operation does not modify packets that it does not consume. - * It cannot consume all input packets if 'num_out' is smaller than 'num_in'. + * with error status have undefined content, except that in case of sa_lookup + * error the original input packet data is returned. The operation does not + * modify packets that it does not consume. It cannot consume all input + * packets if 'num_out' is smaller than 'num_in'. * * Packet context pointer and user area content are copied from input to output * packets. Output packets are allocated from the same pool(s) as input packets. @@ -1697,9 +1698,10 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, * packets consumed and outputs a new packet handle for each outputted packet. * Outputted packets contain IPSEC result metadata (odp_ipsec_packet_result_t), * which should be checked for transformation errors, etc. Outputted packets - * with error status have not been transformed but the original packet is - * returned. The operation does not modify packets that it does not consume. - * It cannot consume all input packets if 'num_out' is smaller than 'num_in'. + * with error status have undefined content, except that in case of MTU error + * the original input packet data is returned. The operation does not modify + * packets that it does not consume. It cannot consume all input packets if + * 'num_out' is smaller than 'num_in'. * * Packet context pointer and user area content are copied from input to output * packets. Output packets are allocated from the same pool(s) as input packets. -- cgit v1.2.3 From bd16fceda545ad71f2098e8b1188a5e5437a62d0 Mon Sep 17 00:00:00 2001 From: Janne Peltonen Date: Thu, 22 Jul 2021 11:19:41 +0300 Subject: api: ipsec: provide original ESP/AH packet length in IPsec packet result Provide the original ESP/AH packet length before inbound IPsec processing in odp_ipsec_packet_result_t. An application may use it for statistics purposes. This can be useful since post-IPsec reassemly offload makes it difficult to deduce the original octet count that went into the creation of the result packet. Even without reassembly offload, possible extra padding cannot be deduced from the result packet. Signed-off-by: Janne Peltonen Reviewed-by: Anoob Joseph Reviewed-by: Petri Savolainen --- include/odp/api/spec/ipsec.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 7193571a2..02275ef3b 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -1554,6 +1554,17 @@ typedef struct odp_ipsec_packet_result_t { uint32_t len; } outer_hdr; + /** Total IP length of the original ESP or AH packet before IPsec + * decapsulation. This is valid only for inbound inline and async + * processed packets. Zero value means that the length information + * is not available. + * + * If the result packet was reassembled from multiple IPsec + * protected packets, this is the sum of the lengths of all the + * involved IPsec packets. + */ + uint32_t orig_ip_len; + } odp_ipsec_packet_result_t; /** -- cgit v1.2.3 From 754688b1eb3af6df37b965167fcaf254c5683713 Mon Sep 17 00:00:00 2001 From: Janne Peltonen Date: Thu, 22 Jul 2021 10:50:38 +0300 Subject: api: packet: add odp_packet_reass_info() for reassembly details Introduce odp_packet_reass_info() that provides information on a completed reassembly. The number of fragments that were reassembled is useful for statistics. More info can be added later. Signed-off-by: Janne Peltonen Reviewed-by: Anoob Joseph Reviewed-by: Petri Savolainen --- include/odp/api/spec/packet.h | 14 ++++++++++++++ include/odp/api/spec/packet_types.h | 8 ++++++++ 2 files changed, 22 insertions(+) (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 2285a857d..e8f3cbc4a 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -179,6 +179,20 @@ odp_event_t odp_packet_to_event(odp_packet_t pkt); void odp_packet_to_event_multi(const odp_packet_t pkt[], odp_event_t ev[], int num); +/** + * Get information about successful reassembly offload that has happened + * + * This function may be called only if the reassembly status of a packet + * is ODP_PACKET_REASS_COMPLETE. + * + * @param pkt Completely reassembled packet. + * @param[out] info Pointer to the info structure to be filled + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_packet_reass_info(odp_packet_t pkt, odp_packet_reass_info_t *info); + /** * Get partial reassembly state from a packet * diff --git a/include/odp/api/spec/packet_types.h b/include/odp/api/spec/packet_types.h index 5549f03aa..52b0e22b6 100644 --- a/include/odp/api/spec/packet_types.h +++ b/include/odp/api/spec/packet_types.h @@ -285,6 +285,14 @@ typedef enum odp_packet_reass_status_t { ODP_PACKET_REASS_COMPLETE, } odp_packet_reass_status_t; +/** + * Information about a completed reassembly + */ +typedef struct odp_packet_reass_info_t { + /** Number of fragments reassembled */ + uint16_t num_frags; +} odp_packet_reass_info_t; + /** * Result from odp_packet_reass_partial_state() */ -- cgit v1.2.3 From 187d289fb05dad716647dbc7ea0834475547f388 Mon Sep 17 00:00:00 2001 From: Petri Savolainen Date: Fri, 27 Aug 2021 10:41:30 +0300 Subject: api: support: move content to std_types.h Maintain all common types and definitions in one file (std_types.h). Signed-off-by: Petri Savolainen Reviewed-by: Matias Elo --- include/odp/api/spec/classification.h | 2 +- include/odp/api/spec/comp.h | 2 +- include/odp/api/spec/crypto.h | 2 +- include/odp/api/spec/ipsec.h | 2 +- include/odp/api/spec/schedule_types.h | 2 +- include/odp/api/spec/std_types.h | 25 ++++++++++++++- include/odp/api/spec/support.h | 57 ----------------------------------- 7 files changed, 29 insertions(+), 63 deletions(-) delete mode 100644 include/odp/api/spec/support.h (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index f3cfea78b..ec15c8962 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -20,7 +20,7 @@ extern "C" { #endif #include -#include +#include #include /** @defgroup odp_classification ODP CLASSIFICATION * Packet input classification. diff --git a/include/odp/api/spec/comp.h b/include/odp/api/spec/comp.h index a09bd7254..7f64cca5d 100644 --- a/include/odp/api/spec/comp.h +++ b/include/odp/api/spec/comp.h @@ -14,7 +14,7 @@ #define ODP_API_SPEC_COMP_H_ #include -#include +#include #include #ifdef __cplusplus diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index c5c3f0936..bfda0bcee 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -15,7 +15,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 02275ef3b..6e28e7fb4 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -20,7 +20,7 @@ extern "C" { #endif #include -#include +#include #include #include #include diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 90146585f..8421b4107 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -14,7 +14,7 @@ #define ODP_API_SPEC_SCHEDULE_TYPES_H_ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/odp/api/spec/std_types.h b/include/odp/api/spec/std_types.h index 5dc350a24..0a5f55bf0 100644 --- a/include/odp/api/spec/std_types.h +++ b/include/odp/api/spec/std_types.h @@ -9,7 +9,7 @@ /** * @file * - * Standard C language types and definitions for ODP. + * Common types and definitions for ODP API files. * */ @@ -95,6 +95,29 @@ typedef struct odp_fract_u64_t { } odp_fract_u64_t; +/** + * ODP support + * + * Support levels are specified in the relative order, where ODP_SUPPORT_NO is + * the lowest level. E.g. if the examined support level is greater than + * ODP_SUPPORT_NO, the feature is supported in some form. + */ +typedef enum odp_support_t { + /** + * Feature is not supported + */ + ODP_SUPPORT_NO = 0, + /** + * Feature is supported + */ + ODP_SUPPORT_YES, + /** + * Feature is supported and preferred + */ + ODP_SUPPORT_PREFERRED + +} odp_support_t; + /** * @} */ diff --git a/include/odp/api/spec/support.h b/include/odp/api/spec/support.h deleted file mode 100644 index 10611219d..000000000 --- a/include/odp/api/spec/support.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2017-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP support API - */ - -#ifndef ODP_API_SPEC_SUPPORT_H_ -#define ODP_API_SPEC_SUPPORT_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @defgroup odp_support ODP SUPPORT - * Feature support levels. - * @{ - */ - -/** - * ODP support support - * - * Support levels are specified in the relative order, where ODP_SUPPORT_NO is - * the lowest level. E.g. if the examined support level is greater than - * ODP_SUPPORT_NO, the feature is supported in some form. - */ -typedef enum odp_support_t { - /** - * Feature is not supported - */ - ODP_SUPPORT_NO = 0, - /** - * Feature is supported - */ - ODP_SUPPORT_YES, - /** - * Feature is supported and preferred - */ - ODP_SUPPORT_PREFERRED -} odp_support_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif -- cgit v1.2.3 From 17dab693309bd6beea145ecf1edbe81c289b9f4d Mon Sep 17 00:00:00 2001 From: Petri Savolainen Date: Fri, 27 Aug 2021 10:52:40 +0300 Subject: api: feature: move content to std_types.h Maintain all common types and definitions in one file (std_types.h). Signed-off-by: Petri Savolainen Reviewed-by: Matias Elo --- include/odp/api/spec/feature.h | 76 ---------------------------------------- include/odp/api/spec/init.h | 1 - include/odp/api/spec/std_types.h | 37 +++++++++++++++++++ 3 files changed, 37 insertions(+), 77 deletions(-) delete mode 100644 include/odp/api/spec/feature.h (limited to 'include/odp/api/spec') diff --git a/include/odp/api/spec/feature.h b/include/odp/api/spec/feature.h deleted file mode 100644 index ccb5cf535..000000000 --- a/include/odp/api/spec/feature.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2017-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP features. - * Define various ODP feature sets that can be referenced by other - * components. - */ - -#ifndef ODP_API_SPEC_FEATURE_H_ -#define ODP_API_SPEC_FEATURE_H_ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @defgroup odp_features ODP_FEATURE - * List of ODP features. - * @{ - */ - -/** Definition of ODP features */ -typedef union odp_feature_t { - /** All features */ - uint32_t all_feat; - - /** Individual feature bits */ - struct { - /** Classifier APIs, e.g., odp_cls_xxx(), odp_cos_xxx() */ - uint32_t cls:1; - - /** Compression APIs, e.g., odp_comp_xxx() */ - uint32_t compress:1; - - /** Crypto APIs, e.g., odp_crypto_xxx() */ - uint32_t crypto:1; - - /** IPsec APIs, e.g., odp_ipsec_xxx() */ - uint32_t ipsec:1; - - /** Scheduler APIs, e.g., odp_schedule_xxx() */ - uint32_t schedule:1; - - /** Stash APIs, e.g., odp_stash_xxx() */ - uint32_t stash:1; - - /** Time APIs, e.g., odp_time_xxx() */ - uint32_t time:1; - - /** Timer APIs, e.g., odp_timer_xxx(), odp_timeout_xxx() */ - uint32_t timer:1; - - /** Traffic Manager APIs, e.g., odp_tm_xxx() */ - uint32_t tm:1; - } feat; - -} odp_feature_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index d52ac50b6..67e616fce 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -19,7 +19,6 @@ extern "C" { #include #include -#include #include #include diff --git a/include/odp/api/spec/std_types.h b/include/odp/api/spec/std_types.h index 0a5f55bf0..41f436065 100644 --- a/include/odp/api/spec/std_types.h +++ b/include/odp/api/spec/std_types.h @@ -118,6 +118,43 @@ typedef enum odp_support_t { } odp_support_t; +/** Definition of ODP features */ +typedef union odp_feature_t { + /** All features */ + uint32_t all_feat; + + /** Individual feature bits */ + struct { + /** Classifier APIs, e.g., odp_cls_xxx(), odp_cos_xxx() */ + uint32_t cls:1; + + /** Compression APIs, e.g., odp_comp_xxx() */ + uint32_t compress:1; + + /** Crypto APIs, e.g., odp_crypto_xxx() */ + uint32_t crypto:1; + + /** IPsec APIs, e.g., odp_ipsec_xxx() */ + uint32_t ipsec:1; + + /** Scheduler APIs, e.g., odp_schedule_xxx() */ + uint32_t schedule:1; + + /** Stash APIs, e.g., odp_stash_xxx() */ + uint32_t stash:1; + + /** Time APIs, e.g., odp_time_xxx() */ + uint32_t time:1; + + /** Timer APIs, e.g., odp_timer_xxx(), odp_timeout_xxx() */ + uint32_t timer:1; + + /** Traffic Manager APIs, e.g., odp_tm_xxx() */ + uint32_t tm:1; + } feat; + +} odp_feature_t; + /** * @} */ -- cgit v1.2.3