net/octeontx2: add gre key parsing support

Message ID 20190726090303.7809-1-kirankumark@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/octeontx2: add gre key parsing support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Kiran Kumar Kokkilagadda July 26, 2019, 9:03 a.m. UTC
  From: Kiran Kumar K <kirankumark@marvell.com>

Adding support to parse GRE KEY for octeontx2 Flow.
Matching on GRE Key will only work, if checksum and routing
bits in the GRE header are equal to 0.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 doc/guides/nics/octeontx2.rst           | 96 +++++++++++++------------
 drivers/net/octeontx2/otx2_flow_parse.c |  7 ++
 2 files changed, 56 insertions(+), 47 deletions(-)
  

Comments

Jerin Jacob Kollanukkaran July 28, 2019, 5:22 p.m. UTC | #1
> -----Original Message-----
> From: kirankumark@marvell.com <kirankumark@marvell.com>
> Sent: Friday, July 26, 2019 2:33 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Nithin Kumar
> Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/octeontx2: add gre key parsing support
> 
> From: Kiran Kumar K <kirankumark@marvell.com>
> 
> Adding support to parse GRE KEY for octeontx2 Flow.
> Matching on GRE Key will only work, if checksum and routing bits in the GRE
> header are equal to 0.
> 
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>

Instead of introducing a new colum for RTE_FLOW_ITEM_TYPE_GRE_KEY comment,
add the comment as NOTE

Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-mrvl/master. Thanks
  

Patch

diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst
index 5f511feb7..ce54de478 100644
--- a/doc/guides/nics/octeontx2.rst
+++ b/doc/guides/nics/octeontx2.rst
@@ -221,53 +221,55 @@  Patterns:
 
 .. table:: Item types
 
-   +----+--------------------------------+
-   | #  | Pattern Type                   |
-   +====+================================+
-   | 1  | RTE_FLOW_ITEM_TYPE_ETH         |
-   +----+--------------------------------+
-   | 2  | RTE_FLOW_ITEM_TYPE_VLAN        |
-   +----+--------------------------------+
-   | 3  | RTE_FLOW_ITEM_TYPE_E_TAG       |
-   +----+--------------------------------+
-   | 4  | RTE_FLOW_ITEM_TYPE_IPV4        |
-   +----+--------------------------------+
-   | 5  | RTE_FLOW_ITEM_TYPE_IPV6        |
-   +----+--------------------------------+
-   | 6  | RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4|
-   +----+--------------------------------+
-   | 7  | RTE_FLOW_ITEM_TYPE_MPLS        |
-   +----+--------------------------------+
-   | 8  | RTE_FLOW_ITEM_TYPE_ICMP        |
-   +----+--------------------------------+
-   | 9  | RTE_FLOW_ITEM_TYPE_UDP         |
-   +----+--------------------------------+
-   | 10 | RTE_FLOW_ITEM_TYPE_TCP         |
-   +----+--------------------------------+
-   | 11 | RTE_FLOW_ITEM_TYPE_SCTP        |
-   +----+--------------------------------+
-   | 12 | RTE_FLOW_ITEM_TYPE_ESP         |
-   +----+--------------------------------+
-   | 13 | RTE_FLOW_ITEM_TYPE_GRE         |
-   +----+--------------------------------+
-   | 14 | RTE_FLOW_ITEM_TYPE_NVGRE       |
-   +----+--------------------------------+
-   | 15 | RTE_FLOW_ITEM_TYPE_VXLAN       |
-   +----+--------------------------------+
-   | 16 | RTE_FLOW_ITEM_TYPE_GTPC        |
-   +----+--------------------------------+
-   | 17 | RTE_FLOW_ITEM_TYPE_GTPU        |
-   +----+--------------------------------+
-   | 18 | RTE_FLOW_ITEM_TYPE_GENEVE      |
-   +----+--------------------------------+
-   | 19 | RTE_FLOW_ITEM_TYPE_VXLAN_GPE   |
-   +----+--------------------------------+
-   | 20 | RTE_FLOW_ITEM_TYPE_IPV6_EXT    |
-   +----+--------------------------------+
-   | 21 | RTE_FLOW_ITEM_TYPE_VOID        |
-   +----+--------------------------------+
-   | 22 | RTE_FLOW_ITEM_TYPE_ANY         |
-   +----+--------------------------------+
+   +----+--------------------------------+-----------------------------------+
+   | #  | Pattern Type                   |         Comment                   |
+   +====+================================+===================================+
+   | 1  | RTE_FLOW_ITEM_TYPE_ETH         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 2  | RTE_FLOW_ITEM_TYPE_VLAN        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 3  | RTE_FLOW_ITEM_TYPE_E_TAG       |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 4  | RTE_FLOW_ITEM_TYPE_IPV4        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 5  | RTE_FLOW_ITEM_TYPE_IPV6        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 6  | RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4|                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 7  | RTE_FLOW_ITEM_TYPE_MPLS        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 8  | RTE_FLOW_ITEM_TYPE_ICMP        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 9  | RTE_FLOW_ITEM_TYPE_UDP         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 10 | RTE_FLOW_ITEM_TYPE_TCP         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 11 | RTE_FLOW_ITEM_TYPE_SCTP        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 12 | RTE_FLOW_ITEM_TYPE_ESP         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 13 | RTE_FLOW_ITEM_TYPE_GRE         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 14 | RTE_FLOW_ITEM_TYPE_NVGRE       |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 15 | RTE_FLOW_ITEM_TYPE_VXLAN       |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 16 | RTE_FLOW_ITEM_TYPE_GTPC        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 17 | RTE_FLOW_ITEM_TYPE_GTPU        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 18 | RTE_FLOW_ITEM_TYPE_GENEVE      |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 19 | RTE_FLOW_ITEM_TYPE_VXLAN_GPE   |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 20 | RTE_FLOW_ITEM_TYPE_IPV6_EXT    |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 21 | RTE_FLOW_ITEM_TYPE_VOID        |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 22 | RTE_FLOW_ITEM_TYPE_ANY         |                                   |
+   +----+--------------------------------+-----------------------------------+
+   | 23 | RTE_FLOW_ITEM_TYPE_GRE_KEY     | chksum & routing should be 0      |
+   +----+--------------------------------+-----------------------------------+
 
 Actions:
 
diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c
index 6e65db8e4..6670c1a70 100644
--- a/drivers/net/octeontx2/otx2_flow_parse.c
+++ b/drivers/net/octeontx2/otx2_flow_parse.c
@@ -389,6 +389,7 @@  int
 otx2_flow_parse_ld(struct otx2_parse_state *pst)
 {
 	char hw_mask[NPC_MAX_EXTRACT_DATA_LEN];
+	uint32_t gre_key_mask = 0xffffffff;
 	struct otx2_flow_item_info info;
 	int lid, lt, lflags;
 	int rc;
@@ -450,6 +451,12 @@  otx2_flow_parse_ld(struct otx2_parse_state *pst)
 		info.def_mask = &rte_flow_item_gre_mask;
 		info.len = sizeof(struct rte_flow_item_gre);
 		break;
+	case RTE_FLOW_ITEM_TYPE_GRE_KEY:
+		lt = NPC_LT_LD_GRE;
+		info.def_mask = &gre_key_mask;
+		info.len = sizeof(gre_key_mask);
+		info.hw_hdr_len = 4;
+		break;
 	case RTE_FLOW_ITEM_TYPE_NVGRE:
 		lt = NPC_LT_LD_GRE;
 		lflags = NPC_F_GRE_NVGRE;