Skip to contentSkip to conversation

ethdev: add NSH key field to flow API

PATCH Superseded [email protected] 3 participants 5 messages Jul 25, 2019 – Oct 8, 2019

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 ethdev: add NSH key field to flow API

From: Kiran Kumar K <[email protected]>

Add new rte_flow_item_nsh in order to match the network service header based on RFC 8300.

---
V3 changes:
* Fixed checkpatch issue

V2 changes:
* updated supported items in doc

 doc/guides/prog_guide/rte_flow.rst | 18 ++++++++++++++
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 39 ++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+)
doc/guides/prog_guide/rte_flow.rst +18 -0
index 821b524b3..4109f199a 100644
@@ -1219,6 +1219,24 @@ Matches an application specific 32 bit metadata item.
    | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
    +----------+----------+---------------------------------------+
 
+Item: ``NSH``
+^^^^^^^^^^^^^^^^^^^
+
+Matches a network service header (RFC 8300).
+
+- ``version``: normally 0x0 (2 bits).
+- ``oam_pkt``: indicate oam packet (1 bit).
+- ``reserved``: reserved bit (1 bit).
+- ``ttl``: maximum SFF hopes (6 bits).
+- ``length``: total length in 4 bytes words (6 bits).
+- ``reserved1``: reserved1 bits (4 bits).
+- ``mdtype``: ndicates format of NSH header (4 bits).
+- ``next_proto``: indicates protocol type of encap data (8 bits).
+- ``spi``: service path identifier (3 bytes).
+- ``sindex``: service index (1 byte).
+- Default ``mask`` matches mdtype, next_proto, spi, sindex.
+
+
 Actions
 ~~~~~~~
 
lib/librte_ethdev/rte_flow.c +1 -0
index 18fcb018e..39646167c 100644
@@ -75,6 +75,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
 	MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
 	MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
+	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 };
 
 /** Generate flow_action[] entry. */
lib/librte_ethdev/rte_flow.h +39 -0
index b66bf1495..f0e99fa3e 100644
@@ -434,6 +434,13 @@ enum rte_flow_item_type {
 	 * @code rte_be32_t * @endcode
 	 */
 	RTE_FLOW_ITEM_TYPE_GRE_KEY,
+
+	/**
+	 * Matches Network service header (NSH).
+	 * See struct rte_flow_item_nsh.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_NSH,
 };
 
 /**
@@ -1214,6 +1221,38 @@ struct rte_flow_item_mark {
 	uint32_t id; /**< Integer value to match against. */
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_NSH
+ *
+ * Match network service header (NSH), RFC 8300
+ *
+ */
+struct rte_flow_item_nsh {
+	uint32_t version:2;
+	uint32_t oam_pkt:1;
+	uint32_t reserved:1;
+	uint32_t ttl:6;
+	uint32_t length:6;
+	uint32_t reserved1:4;
+	uint32_t mdtype:4;
+	uint32_t next_proto:8;
+	uint32_t spi:24;
+	uint32_t sindex:8;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
+#ifndef __cplusplus
+static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
+	.mdtype = 0xf,
+	.next_proto = 0xff,
+	.spi = 0xffffff,
+	.sindex = 0xff,
+};
+#endif
+
 /**
  * Matching pattern item definition.
  *

--
2.17.1

#1 lore raw

PATCH v3 2/3 ethdev: add IGMP key field to flow API

From: Kiran Kumar K <[email protected]>

Add new rte_flow_item_igmp in order to match the Internet Group Management Protocol based on RFC 2236.

---
V3 changes:
* Fixed checkpatch issue

V2 changes:
* updated supported items in doc

 doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 31 ++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)
doc/guides/prog_guide/rte_flow.rst +12 -0
index 4109f199a..f786fa3c2 100644
@@ -1237,6 +1237,18 @@ Matches a network service header (RFC 8300).
 - Default ``mask`` matches mdtype, next_proto, spi, sindex.
 
 
+Item: ``IGMP``
+^^^^^^^^^^^^^^^^^^^
+
+Matches a Internet Group Management Protocol (RFC 2236).
+
+- ``type``: IGMP message type (Query/Report).
+- ``max_resp_time``: max time allowed before sending report.
+- ``checksum``: checksum, 1s complement of whole IGMP message.
+- ``group_addr``: group address, for Query value will be 0.
+- Default ``mask`` matches group_addr.
+
+
 Actions
 ~~~~~~~
 
lib/librte_ethdev/rte_flow.c +1 -0
index 39646167c..4dee4f9c2 100644
@@ -76,6 +76,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
 	MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
+	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 };
 
 /** Generate flow_action[] entry. */
lib/librte_ethdev/rte_flow.h +31 -0
index f0e99fa3e..ce8072613 100644
@@ -441,6 +441,14 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_NSH,
+
+	/**
+	 * Matches Internet Group Management Protocol (IGMP).
+	 * See struct rte_flow_item_igmp.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_IGMP,
+
 };
 
 /**
@@ -1253,6 +1261,29 @@ static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
 };
 #endif
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_IGMP
+ *
+ * Match Internet Group Management Protocol (IGMP), RFC 2236
+ *
+ */
+struct rte_flow_item_igmp {
+	uint32_t type:8;
+	uint32_t max_resp_time:8;
+	uint32_t checksum:16;
+	uint32_t group_addr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
+	.group_addr = 0xffffffff,
+};
+#endif
+
 /**
  * Matching pattern item definition.
  *

--
2.17.1

#2 lore raw

PATCH v3 3/3 ethdev: add AH key field to flow API

In reply to [email protected]

From: Kiran Kumar K <[email protected]>

Add new rte_flow_item_ah in order to match the Authentication Header based on RFC 2402.

---
V3 changes:
* Fixed checkpatch issue

V2 changes:
* updated supported items in doc

 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(+)
doc/guides/prog_guide/rte_flow.rst +13 -0
index f786fa3c2..f696c5fc6 100644
@@ -1249,6 +1249,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
 ~~~~~~~
 
lib/librte_ethdev/rte_flow.c +1 -0
index 4dee4f9c2..44aa9f973 100644
@@ -77,6 +77,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
 	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. */
lib/librte_ethdev/rte_flow.h +31 -0
index ce8072613..b3b8a6793 100644
@@ -449,6 +449,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,
+
 };
 
 /**
@@ -1284,6 +1291,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.17.1

#3 lore raw
In reply to [email protected]
Quoted 6 lines · On 7/25/2019 10:03 AM, [email protected] wrote:

From: Kiran Kumar K <[email protected]>

Add new rte_flow_item_nsh in order to match the network service header based on RFC 8300.

Hi Adrien, Ori,

Any concern/objection on the patchset [1], if not will be merged in next a few days.

Thanks,
ferruh

[1]
https://patches.dpdk.org/user/todo/dpdk/?series=5739
ethdev: add NSH key field to flow API
ethdev: add IGMP key field to flow API
ethdev: add AH key field to flow API

Reviewed-by
#4 lore raw
Quoted 12 lines · Ferruh
Quoted 6 lines · On 7/25/2019 10:03 AM, [email protected] wrote:

From: Kiran Kumar K <[email protected]>

Add new rte_flow_item_nsh in order to match the network service header based on RFC 8300.

Hi Adrien, Ori,

Any concern/objection on the patchset [1], if not will be merged in next a few days.

Quoted 9 lines

Thanks,
ferruh

[1]
https://patches.dpdk.org/user/todo/dpdk/?series=5739
ethdev: add NSH key field to flow API
ethdev: add IGMP key field to flow API
ethdev: add AH key field to flow API

For series,

Series applied to dpdk-next-net/master, thanks.