From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-dev] [PATCH 15/15] net/softnic: add parsing for raw flow item
Date: Thu, 6 Sep 2018 17:27:02 +0100 [thread overview]
Message-ID: <1536251222-17275-16-git-send-email-reshma.pattan@intel.com> (raw)
In-Reply-To: <1536251222-17275-1-git-send-email-reshma.pattan@intel.com>
Added support for parsing raw flow item.
flow_item_raw_preprocess() is added for the same.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
drivers/net/softnic/rte_eth_softnic_flow.c | 108 +++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c
index da235ff7f..656200445 100644
--- a/drivers/net/softnic/rte_eth_softnic_flow.c
+++ b/drivers/net/softnic/rte_eth_softnic_flow.c
@@ -297,6 +297,106 @@ flow_item_is_proto(enum rte_flow_item_type type,
}
}
+static int
+flow_item_raw_preprocess(const struct rte_flow_item *item,
+ union flow_item *item_spec,
+ union flow_item *item_mask,
+ size_t *item_size,
+ int *item_disabled,
+ struct rte_flow_error *error)
+{
+ const struct rte_flow_item_raw *item_raw_spec = item->spec;
+ const struct rte_flow_item_raw *item_raw_mask = item->mask;
+ const uint8_t *pattern;
+ const uint8_t *pattern_mask;
+ uint8_t *spec = (uint8_t *)item_spec;
+ uint8_t *mask = (uint8_t *)item_mask;
+ size_t pattern_length, pattern_offset, i;
+ int disabled;
+
+ if (!item->spec)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Null specification");
+
+ if (item->last)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Range not allowed (last must be NULL)");
+
+ if (item_raw_spec->relative == 0)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Absolute offset not supported");
+
+ if (item_raw_spec->search)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Search not supported");
+
+ if (item_raw_spec->offset < 0)
+ return rte_flow_error_set(error,
+ ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Negative offset not supported");
+
+ if (item_raw_spec->length == 0)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Zero pattern length");
+
+ if (item_raw_spec->offset + item_raw_spec->length >
+ TABLE_RULE_MATCH_SIZE_MAX)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Item too big");
+
+ if (!item_raw_spec->pattern && item_raw_mask && item_raw_mask->pattern)
+ return rte_flow_error_set(error,
+ ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ITEM,
+ item,
+ "RAW: Non-NULL pattern mask not allowed with NULL pattern");
+
+ pattern = item_raw_spec->pattern;
+ pattern_mask = (item_raw_mask) ? item_raw_mask->pattern : NULL;
+ pattern_length = (size_t)item_raw_spec->length;
+ pattern_offset = (size_t)item_raw_spec->offset;
+
+ disabled = 0;
+ if (pattern_mask == NULL)
+ disabled = 1;
+ else
+ for (i = 0; i < pattern_length; i++)
+ if ((pattern)[i])
+ disabled = 1;
+
+ memset(spec, 0, TABLE_RULE_MATCH_SIZE_MAX);
+ if (pattern)
+ memcpy(&spec[pattern_offset], pattern, pattern_length);
+
+ memset(mask, 0, TABLE_RULE_MATCH_SIZE_MAX);
+ if (pattern_mask)
+ memcpy(&mask[pattern_offset], pattern_mask, pattern_length);
+
+ *item_size = pattern_offset + pattern_length;
+ *item_disabled = disabled;
+
+ return 0;
+}
+
static int
flow_item_proto_preprocess(const struct rte_flow_item *item,
union flow_item *item_spec,
@@ -317,6 +417,14 @@ flow_item_proto_preprocess(const struct rte_flow_item *item,
item,
"Item type not supported");
+ if (item->type == RTE_FLOW_ITEM_TYPE_RAW)
+ return flow_item_raw_preprocess(item,
+ item_spec,
+ item_mask,
+ item_size,
+ item_disabled,
+ error);
+
/* spec */
if (!item->spec) {
/* If spec is NULL, then last and mask also have to be NULL. */
--
2.14.4
next prev parent reply other threads:[~2018-09-06 16:27 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 16:26 [dpdk-dev] [PATCH 00/15] add flow API support to softnic Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 01/15] net/softnic: add infrastructure for flow API Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 02/15] net/softnic: rte flow attr mapping to pipeline Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 03/15] net/softnic: add new cli for flow attribute map Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 04/15] net/softnic: various data type changes Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 05/15] net/softnic: add free table and find out port functions Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 06/15] net/softnic: add function to get eth device from softnic Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 07/15] net/softnic: flow API validate support Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 08/15] net/softnic: validate and map flow rule with acl table match Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 09/15] net/softnic: parse flow protocol for " Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 10/15] net/softnic: validate and map flow with hash " Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 11/15] net/softnic: validate and map flow action with table action Reshma Pattan
2018-09-06 16:26 ` [dpdk-dev] [PATCH 12/15] net/softnic: add flow create API Reshma Pattan
2018-09-06 16:27 ` [dpdk-dev] [PATCH 13/15] net/softnic: add flow destroy API Reshma Pattan
2018-09-06 16:27 ` [dpdk-dev] [PATCH 14/15] net/softnic: add flow query API Reshma Pattan
2018-09-06 16:27 ` Reshma Pattan [this message]
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 00/15] add flow API support to softnic Reshma Pattan
2018-09-28 10:36 ` Dumitrescu, Cristian
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 01/15] net/softnic: add infrastructure for flow API Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 02/15] net/softnic: map flow attributes to pipeline table Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 03/15] net/softnic: add new cli for flow attribute map Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 04/15] net/softnic: replace some pointers with arrays Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 05/15] net/softnic: add free table and find out port functions Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 06/15] net/softnic: add function to get eth device from softnic Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 07/15] net/softnic: implement flow validate API Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 08/15] net/softnic: validate and map flow rule with acl table match Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 09/15] net/softnic: parse flow protocol for " Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 10/15] net/softnic: validate and map flow with hash " Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 11/15] net/softnic: validate and map flow action with table action Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 12/15] net/softnic: add flow create API Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 13/15] net/softnic: add flow destroy API Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 14/15] net/softnic: add flow query API Reshma Pattan
2018-09-11 14:20 ` [dpdk-dev] [PATCH v2 15/15] net/softnic: add parsing for raw flow item Reshma Pattan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536251222-17275-16-git-send-email-reshma.pattan@intel.com \
--to=reshma.pattan@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).