DPDK patches and discussions
 help / color / mirror / Atom feed
From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com, john.mcnamara@intel.com
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>
Subject: [dpdk-dev] [PATCH v2 2/7] net/enic: flow API skeleton
Date: Thu, 30 Mar 2017 19:06:17 -0700	[thread overview]
Message-ID: <20170331020622.25498-3-johndale@cisco.com> (raw)
In-Reply-To: <20170331020622.25498-1-johndale@cisco.com>

Stub callbacks for the generic flow API and a new FLOW debug define.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
---
 config/common_base             |   1 +
 drivers/net/enic/Makefile      |   1 +
 drivers/net/enic/enic.h        |   1 +
 drivers/net/enic/enic_ethdev.c |  21 +++++-
 drivers/net/enic/enic_flow.c   | 154 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 175 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/enic/enic_flow.c

diff --git a/config/common_base b/config/common_base
index 80006650b..d4edb2033 100644
--- a/config/common_base
+++ b/config/common_base
@@ -249,6 +249,7 @@ CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n
 #
 CONFIG_RTE_LIBRTE_ENIC_PMD=y
 CONFIG_RTE_LIBRTE_ENIC_DEBUG=n
+CONFIG_RTE_LIBRTE_ENIC_DEBUG_FLOW=n
 
 #
 # Compile burst-oriented Netronome NFP PMD driver
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index 2c7496dc5..db48ff2da 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -56,6 +56,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_flow.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_cq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_wq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_dev.c
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index e921de405..af1098b05 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -306,4 +306,5 @@ void copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,
 		  __rte_unused struct rte_eth_fdir_masks *masks);
 void copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input,
 		  struct rte_eth_fdir_masks *masks);
+extern const struct rte_flow_ops enic_flow_ops;
 #endif /* _ENIC_H_ */
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 2c2e29e97..79098520d 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -115,13 +115,28 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev,
 		     enum rte_filter_op filter_op,
 		     void *arg)
 {
-	int ret = -EINVAL;
+	int ret = 0;
+
+	ENICPMD_FUNC_TRACE();
 
-	if (RTE_ETH_FILTER_FDIR == filter_type)
+	if (dev == NULL)
+		return -EINVAL;
+
+	switch (filter_type) {
+	case RTE_ETH_FILTER_GENERIC:
+		if (filter_op != RTE_ETH_FILTER_GET)
+			return -EINVAL;
+		*(const void **)arg = &enic_flow_ops;
+		break;
+	case RTE_ETH_FILTER_FDIR:
 		ret = enicpmd_fdir_ctrl_func(dev, filter_op, arg);
-	else
+		break;
+	default:
 		dev_warning(enic, "Filter type (%d) not supported",
 			filter_type);
+		ret = -EINVAL;
+		break;
+	}
 
 	return ret;
 }
diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
new file mode 100644
index 000000000..d25390f8a
--- /dev/null
+++ b/drivers/net/enic/enic_flow.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2008-2017 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2017, Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <errno.h>
+#include <rte_log.h>
+#include <rte_ethdev.h>
+#include <rte_flow_driver.h>
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_udp.h>
+
+#include "enic_compat.h"
+#include "enic.h"
+#include "vnic_dev.h"
+#include "vnic_nic.h"
+
+#ifdef RTE_LIBRTE_ENIC_DEBUG_FLOW
+#define FLOW_TRACE() \
+	RTE_LOG(DEBUG, PMD, "%s()\n", __func__)
+#define FLOW_LOG(level, fmt, args...) \
+	RTE_LOG(level, PMD, fmt, ## args)
+#else
+#define FLOW_TRACE() do { } while (0)
+#define FLOW_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+/*
+ * The following functions are callbacks for Generic flow API.
+ */
+
+/**
+ * Validate a flow supported by the NIC.
+ *
+ * @see rte_flow_validate()
+ * @see rte_flow_ops
+ */
+static int
+enic_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attrs,
+		   const struct rte_flow_item pattern[],
+		   const struct rte_flow_action actions[],
+		   struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)attrs;
+	(void)pattern;
+	(void)actions;
+	(void)error;
+
+	FLOW_TRACE();
+
+	return 0;
+}
+
+/**
+ * Create a flow supported by the NIC.
+ *
+ * @see rte_flow_create()
+ * @see rte_flow_ops
+ */
+static struct rte_flow *
+enic_flow_create(struct rte_eth_dev *dev,
+		 const struct rte_flow_attr *attrs,
+		 const struct rte_flow_item pattern[],
+		 const struct rte_flow_action actions[],
+		 struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)attrs;
+	(void)pattern;
+	(void)actions;
+	(void)error;
+
+	FLOW_TRACE();
+
+	return NULL;
+}
+
+/**
+ * Destroy a flow supported by the NIC.
+ *
+ * @see rte_flow_destroy()
+ * @see rte_flow_ops
+ */
+static int
+enic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
+		  __rte_unused struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)flow;
+
+	FLOW_TRACE();
+
+	return 0;
+}
+
+/**
+ * Flush all flows on the device.
+ *
+ * @see rte_flow_flush()
+ * @see rte_flow_ops
+ */
+static int
+enic_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)error;
+
+	FLOW_TRACE();
+
+	return 0;
+}
+
+/**
+ * Flow callback registration.
+ *
+ * @see rte_flow_ops
+ */
+const struct rte_flow_ops enic_flow_ops = {
+	.validate = enic_flow_validate,
+	.create = enic_flow_create,
+	.destroy = enic_flow_destroy,
+	.flush = enic_flow_flush,
+};
-- 
2.12.0

  parent reply	other threads:[~2017-03-31  2:06 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   ` John Daley [this message]
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       ` [dpdk-dev] [PATCH v3 3/6] net/enic: flow API for NICs with advanced filters disabled John Daley
2017-05-17 11:13         ` 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=20170331020622.25498-3-johndale@cisco.com \
    --to=johndale@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=john.mcnamara@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).