From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>
Subject: [dpdk-dev] [PATCH v3 3/6] net/enic: flow API for NICs with advanced filters disabled
Date: Tue, 16 May 2017 20:03:45 -0700 [thread overview]
Message-ID: <20170517030348.2663-4-johndale@cisco.com> (raw)
In-Reply-To: <20170517030348.2663-1-johndale@cisco.com>
Flow support for 1300 series adapters with the 'Advanced Filter'
mode disabled via the UCS management interface. This allows:
Attributes: ingress
Items: Outer eth, ipv4, ipv6, udp, sctp, tcp, vxlan. Inner eth, ipv4,
ipv6, udp, tcp.
Actions: queue and void
Selectors: 'is', 'spec' and 'mask'. 'last' is not supported
With advanced filters disabled, an IPv4 or IPv6 item must be specified
in the pattern.
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
---
drivers/net/enic/enic_flow.c | 135 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 133 insertions(+), 2 deletions(-)
diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index 2ea8c9370..edbde98e6 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -101,8 +101,85 @@ static enic_copy_item_fn enic_copy_item_tcp_v2;
static enic_copy_item_fn enic_copy_item_sctp_v2;
static enic_copy_item_fn enic_copy_item_sctp_v2;
static enic_copy_item_fn enic_copy_item_vxlan_v2;
+static copy_action_fn enic_copy_action_v1;
static copy_action_fn enic_copy_action_v2;
+/**
+ * NICs have Advanced Filters capability but they are disabled. This means
+ * that layer 3 must be specified.
+ */
+static const struct enic_items enic_items_v2[] = {
+ [RTE_FLOW_ITEM_TYPE_ETH] = {
+ .copy_item = enic_copy_item_eth_v2,
+ .valid_start_item = 1,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_VXLAN,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_VLAN] = {
+ .copy_item = enic_copy_item_vlan_v2,
+ .valid_start_item = 1,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_IPV4] = {
+ .copy_item = enic_copy_item_ipv4_v2,
+ .valid_start_item = 1,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_VLAN,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_IPV6] = {
+ .copy_item = enic_copy_item_ipv6_v2,
+ .valid_start_item = 1,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_ETH,
+ RTE_FLOW_ITEM_TYPE_VLAN,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_UDP] = {
+ .copy_item = enic_copy_item_udp_v2,
+ .valid_start_item = 0,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_IPV6,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_TCP] = {
+ .copy_item = enic_copy_item_tcp_v2,
+ .valid_start_item = 0,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_IPV6,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_SCTP] = {
+ .copy_item = enic_copy_item_sctp_v2,
+ .valid_start_item = 0,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_IPV4,
+ RTE_FLOW_ITEM_TYPE_IPV6,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+ [RTE_FLOW_ITEM_TYPE_VXLAN] = {
+ .copy_item = enic_copy_item_vxlan_v2,
+ .valid_start_item = 0,
+ .prev_items = (const enum rte_flow_item_type[]) {
+ RTE_FLOW_ITEM_TYPE_UDP,
+ RTE_FLOW_ITEM_TYPE_END,
+ },
+ },
+};
+
/** NICs with Advanced filters enabled */
static const struct enic_items enic_items_v3[] = {
[RTE_FLOW_ITEM_TYPE_ETH] = {
@@ -178,11 +255,20 @@ static const struct enic_items enic_items_v3[] = {
/** Filtering capabilites indexed this NICs supported filter type. */
static const struct enic_filter_cap enic_filter_cap[] = {
+ [FILTER_USNIC_IP] = {
+ .item_info = enic_items_v2,
+ },
[FILTER_DPDK_1] = {
.item_info = enic_items_v3,
},
};
+/** Supported actions for older NICs */
+static const enum rte_flow_action_type enic_supported_actions_v1[] = {
+ RTE_FLOW_ACTION_TYPE_QUEUE,
+ RTE_FLOW_ACTION_TYPE_END,
+};
+
/** Supported actions for newer NICs */
static const enum rte_flow_action_type enic_supported_actions_v2[] = {
RTE_FLOW_ACTION_TYPE_QUEUE,
@@ -193,6 +279,10 @@ static const enum rte_flow_action_type enic_supported_actions_v2[] = {
/** Action capabilites indexed by NIC version information */
static const struct enic_action_cap enic_action_cap[] = {
+ [FILTER_ACTION_RQ_STEERING_FLAG] = {
+ .actions = enic_supported_actions_v1,
+ .copy_fn = enic_copy_action_v1,
+ },
[FILTER_ACTION_V2_ALL] = {
.actions = enic_supported_actions_v2,
.copy_fn = enic_copy_action_v2,
@@ -643,7 +733,6 @@ enic_copy_filter(const struct rte_flow_item pattern[],
enum rte_flow_item_type prev_item;
const struct enic_items *item_info;
- enic_filter->type = FILTER_DPDK_1;
u8 is_first_item = 1;
FLOW_TRACE();
@@ -681,6 +770,44 @@ enic_copy_filter(const struct rte_flow_item pattern[],
item, "stacking error");
return -rte_errno;
}
+
+/**
+ * Build the intenal version 1 NIC action structure from the provided pattern.
+ * The pattern is validated as the items are copied.
+ *
+ * @param actions[in]
+ * @param enic_action[out]
+ * NIC specfilc actions derived from the actions.
+ * @param error[out]
+ */
+static int
+enic_copy_action_v1(const struct rte_flow_action actions[],
+ struct filter_action_v2 *enic_action)
+{
+ FLOW_TRACE();
+
+ for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
+ if (actions->type == RTE_FLOW_ACTION_TYPE_VOID)
+ continue;
+
+ switch (actions->type) {
+ case RTE_FLOW_ACTION_TYPE_QUEUE: {
+ const struct rte_flow_action_queue *queue =
+ (const struct rte_flow_action_queue *)
+ actions->conf;
+ enic_action->rq_idx =
+ enic_rte_rq_idx_to_sop_idx(queue->index);
+ break;
+ }
+ default:
+ RTE_ASSERT(0);
+ break;
+ }
+ }
+ enic_action->type = FILTER_ACTION_RQ_STEERING;
+ return 0;
+}
+
/**
* Build the intenal version 2 NIC action structure from the provided pattern.
* The pattern is validated as the items are copied.
@@ -755,7 +882,8 @@ static const struct enic_filter_cap *
enic_get_filter_cap(struct enic *enic)
{
/* FIXME: only support advanced filters for now */
- if (enic->flow_filter_mode != FILTER_DPDK_1)
+ if ((enic->flow_filter_mode != FILTER_DPDK_1) &&
+ (enic->flow_filter_mode != FILTER_USNIC_IP))
return (const struct enic_filter_cap *)NULL;
if (enic->flow_filter_mode)
@@ -772,6 +900,8 @@ enic_get_action_cap(struct enic *enic)
if (enic->filter_tags)
ea = &enic_action_cap[FILTER_ACTION_V2_ALL];
+ else
+ ea = &enic_action_cap[FILTER_ACTION_RQ_STEERING_FLAG];
return ea;
}
/**
@@ -884,6 +1014,7 @@ enic_flow_parse(struct rte_eth_dev *dev,
NULL, "Flow API not available");
return -rte_errno;
}
+ enic_filter->type = enic->flow_filter_mode;
ret = enic_copy_filter(pattern, enic_filter_cap->item_info,
enic_filter, error);
return ret;
--
2.12.0
next prev parent reply other threads:[~2017-05-17 3:04 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 21:28 [dpdk-dev] [PATCH 1/6] net/enic: bring NIC interface functions up to date John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 2/6] net/enic: flow API skeleton John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 3/6] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 4/6] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 5/6] net/enic: flow API support for Legacy NICs John Daley
2017-03-30 21:28 ` [dpdk-dev] [PATCH 6/6] net/enic: flow API debug John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 0/7] *** flow API support for enic *** John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 1/7] net/enic: bring NIC interface functions up to date John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 2/7] net/enic: flow API skeleton John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 3/7] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 4/7] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 5/7] net/enic: flow API for Legacy NICs John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 6/7] net/enic: flow API debug John Daley
2017-03-31 2:06 ` [dpdk-dev] [PATCH v2 7/7] net/enic: flow API documentation John Daley
2017-04-02 15:18 ` Mcnamara, John
2017-05-12 12:11 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 0/6] enic flow api support John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 1/6] net/enic: flow API skeleton John Daley
2017-05-17 11:12 ` Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 2/6] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-05-17 11:12 ` Ferruh Yigit
2017-05-17 3:03 ` John Daley [this message]
2017-05-17 11:13 ` [dpdk-dev] [PATCH v3 3/6] net/enic: flow API for NICs with advanced filters disabled Ferruh Yigit
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 4/6] net/enic: flow API for Legacy NICs John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 5/6] net/enic: flow API debug John Daley
2017-05-17 3:03 ` [dpdk-dev] [PATCH v3 6/6] net/enic: flow API documentation John Daley
2017-05-17 11:13 ` Ferruh Yigit
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 0/8] enic flow api support John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 1/8] net/enic: bring NIC interface functions up to date John Daley
2017-05-22 9:49 ` Ferruh Yigit
2017-06-08 10:44 ` Jerin Jacob
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 2/8] net/enic: flow API skeleton John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 3/8] net/enic: flow API for NICs with advanced filters enabled John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 4/8] net/enic: flow API mark and flag support John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 5/8] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 6/8] net/enic: flow API for Legacy NICs John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 7/8] net/enic: flow API debug John Daley
2017-05-17 22:38 ` [dpdk-dev] [PATCH v4 8/8] net/enic: flow API documentation John Daley
2017-05-22 10:05 ` [dpdk-dev] [PATCH v4 0/8] enic flow api support Ferruh Yigit
2017-05-17 11:12 ` [dpdk-dev] [PATCH v3 0/6] " Ferruh Yigit
2017-03-31 10:12 ` [dpdk-dev] [PATCH 1/6] net/enic: bring NIC interface functions up to date Ferruh Yigit
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=20170517030348.2663-4-johndale@cisco.com \
--to=johndale@cisco.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/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).