From: Kiran Kumar K <kirankum...@marvell.com>

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

Signed-off-by: Kiran Kumar K <kirankum...@marvell.com>
---
 lib/librte_ethdev/rte_flow.c |  1 +
 lib/librte_ethdev/rte_flow.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 39646167c..4dee4f9c2 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -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. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index f0e99fa3e..ce8072613 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -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

Reply via email to