From 67f8d7b6203b1875342b2014a4e5b58283483df7 Mon Sep 17 00:00:00 2001 From: Kiran Kumar K Date: Thu, 25 Jul 2019 14:33:45 +0530 Subject: [PATCH] ethdev: add AH key field to flow API Add new rte_flow_item_ah in order to match the Authentication Header based on RFC 2402. Signed-off-by: Kiran Kumar K Reviewed-by: Ferruh Yigit --- doc/guides/prog_guide/rte_flow.rst | 13 +++++++++++++ lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 799086aeba..b032f2d433 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1277,6 +1277,19 @@ Matches a Internet Group Management Protocol (RFC 2236). - Default ``mask`` matches group_addr. +Item: ``AH`` +^^^^^^^^^^^^ + +Matches a IP Authentication Header (RFC 4302). + +- ``next_hdr``: next payload after AH. +- ``payload_len``: total length of AH in 4B words. +- ``reserved``: reserved bits. +- ``spi``: security parameters index. +- ``seq_num``: counter value increased by 1 on each packet sent. +- Default ``mask`` matches spi. + + Actions ~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 2dfe88ca02..81a85b9951 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -82,6 +82,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { sizeof(struct rte_flow_item_pppoe_proto_id)), MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)), MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)), + MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 350566cac8..bcfc06cdc7 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -484,6 +484,13 @@ enum rte_flow_item_type { * */ RTE_FLOW_ITEM_TYPE_IGMP, + + /** + * Matches IP Authentication Header (AH). + * See struct rte_flow_item_ah. + * + */ + RTE_FLOW_ITEM_TYPE_AH, }; /** @@ -1376,6 +1383,30 @@ static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_AH + * + * Match IP Authentication Header (AH), RFC 4302 + * + */ +struct rte_flow_item_ah { + uint32_t next_hdr:8; + uint32_t payload_len:8; + uint32_t reserved:16; + uint32_t spi; + uint32_t seq_num; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_AH. */ +#ifndef __cplusplus +static const struct rte_flow_item_ah rte_flow_item_ah_mask = { + .spi = 0xffffffff, +}; +#endif + /** * Matching pattern item definition. * -- 2.20.1