From e0e5d23b3cc4c76fe55b109e76b923faa73aea57 Mon Sep 17 00:00:00 2001 From: Kiran Kumar K Date: Fri, 26 Jul 2019 14:33:03 +0530 Subject: [PATCH 1/1] net/octeontx2: support GRE key parsing 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 Acked-by: Jerin Jacob --- doc/guides/nics/octeontx2.rst | 7 +++++++ drivers/net/octeontx2/otx2_flow_parse.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index 5f511feb71..9a76567a81 100644 --- a/doc/guides/nics/octeontx2.rst +++ b/doc/guides/nics/octeontx2.rst @@ -268,6 +268,13 @@ Patterns: +----+--------------------------------+ | 22 | RTE_FLOW_ITEM_TYPE_ANY | +----+--------------------------------+ + | 23 | RTE_FLOW_ITEM_TYPE_GRE_KEY | + +----+--------------------------------+ + +.. note:: + + ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing + bits in the GRE header are equal to 0. Actions: diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c index 6e65db8e44..6670c1a702 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; -- 2.20.1