From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 208F02B9E for ; Fri, 1 Dec 2017 11:43:34 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 9E182800059; Fri, 1 Dec 2017 10:43:32 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 1 Dec 2017 02:43:30 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Fri, 1 Dec 2017 02:43:30 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vB1AhSQl010253; Fri, 1 Dec 2017 10:43:28 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id vB1AhSAL013507; Fri, 1 Dec 2017 10:43:28 GMT From: Andrew Rybchenko To: CC: Adrien Mazarguil , Jingjing Wu , Roman Zhukov Date: Fri, 1 Dec 2017 10:43:15 +0000 Message-ID: <1512124996-13388-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1512124996-13388-1-git-send-email-arybchenko@solarflare.com> References: <1511166121-743-1-git-send-email-arybchenko@solarflare.com> <1512124996-13388-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1512125013-aBGsB8HWIOoN Subject: [dpdk-dev] [PATCH v2 1/2] ethdev: add GENEVE flow pattern item X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 10:43:34 -0000 From: Roman Zhukov Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API. Add default mask for the item. Signed-off-by: Roman Zhukov Signed-off-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++ lib/librte_ether/rte_flow.c | 1 + lib/librte_ether/rte_flow.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index d158be5..5b8f9c5 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -980,6 +980,18 @@ Matches an ESP header. - ``hdr``: ESP header definition (``rte_esp.h``). - Default ``mask`` matches SPI only. +Item: ``GENEVE`` +^^^^^^^^^^^^^^^ + +Matches a GENEVE header. + +- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b), + OAM packet (1b), critical options present (1b), reserved 0 (6b). +- ``protocol``: protocol type. +- ``vni``: virtual network identifier. +- ``rsvd1``: reserved, normally 0x00. +- Default ``mask`` matches VNI only. + Actions ~~~~~~~ diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c index 6659063..913d1a5 100644 --- a/lib/librte_ether/rte_flow.c +++ b/lib/librte_ether/rte_flow.c @@ -81,6 +81,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)), MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)), MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)), + MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 47c88ea..e0402cf 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -344,6 +344,13 @@ enum rte_flow_item_type { * See struct rte_flow_item_esp. */ RTE_FLOW_ITEM_TYPE_ESP, + + /** + * Matches a GENEVE header. + * + * See struct rte_flow_item_geneve. + */ + RTE_FLOW_ITEM_TYPE_GENEVE, }; /** @@ -813,6 +820,29 @@ static const struct rte_flow_item_esp rte_flow_item_esp_mask = { #endif /** + * RTE_FLOW_ITEM_TYPE_GENEVE. + * + * Matches a GENEVE header. + */ +struct rte_flow_item_geneve { + /** + * Version (2b), length of the options fields (6b), OAM packet (1b), + * critical options present (1b), reserved 0 (6b). + */ + rte_be16_t ver_opt_len_o_c_rsvd0; + rte_be16_t protocol; /**< Protocol type. */ + uint8_t vni[3]; /**< Virtual Network Identifier. */ + uint8_t rsvd1; /**< Reserved, normally 0x00. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */ +#ifndef __cplusplus +static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = { + .vni = "\xff\xff\xff", +}; +#endif + +/** * Matching pattern item definition. * * A pattern is formed by stacking items starting from the lowest protocol -- 2.7.4