diff mbox

[dpdk-dev,v2,2/2] i40e: define filter_ctrl ops in i40e driver

Message ID 1413783633-16222-3-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Wu, Jingjing Oct. 20, 2014, 5:40 a.m. UTC
Provides filter_ctrl ops in i40e driver.
 - i40e_dev_filter_ctrl
For kinds of filter, only provides empty functions.
Contributors can enrich them based on filter features on fortville.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
diff mbox

Patch

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index dbf231f..395ca0e 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -216,6 +216,16 @@  static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
 				    struct rte_eth_rss_conf *rss_conf);
 static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 				      struct rte_eth_rss_conf *rss_conf);
+static int i40e_hash_filter_ctrl(struct rte_eth_dev *dev,
+				 enum rte_filter_op filter_op,
+				 void *arg);
+static int i40e_fdir_filter_ctrl(struct rte_eth_dev *dev,
+				 enum rte_filter_op filter_op,
+				 void *arg);
+static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
+				enum rte_filter_type filter_type,
+				enum rte_filter_op filter_op,
+				void *arg);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1];
@@ -267,6 +277,7 @@  static struct eth_dev_ops i40e_eth_dev_ops = {
 	.reta_query                   = i40e_dev_rss_reta_query,
 	.rss_hash_update              = i40e_dev_rss_hash_update,
 	.rss_hash_conf_get            = i40e_dev_rss_hash_conf_get,
+	.filter_ctrl                  = i40e_dev_filter_ctrl,
 };
 
 static struct eth_driver rte_i40e_pmd = {
@@ -4169,3 +4180,55 @@  i40e_pf_config_mq_rx(struct i40e_pf *pf)
 
 	return 0;
 }
+
+/* Operations for hash function */
+static int
+i40e_hash_filter_ctrl(__rte_unused struct rte_eth_dev *dev,
+		      __rte_unused enum rte_filter_op filter_op,
+		      __rte_unused void *arg)
+{
+	PMD_INIT_FUNC_TRACE();
+	return -ENOSYS;
+}
+
+/* Operations for flow director */
+static int
+i40e_fdir_filter_ctrl(__rte_unused struct rte_eth_dev *dev,
+		      __rte_unused enum rte_filter_op filter_op,
+		      __rte_unused void *arg)
+{
+	PMD_INIT_FUNC_TRACE();
+	return -ENOSYS;
+}
+
+static int
+i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
+		     enum rte_filter_type filter_type,
+		     enum rte_filter_op filter_op,
+		     void *arg)
+{
+	int ret = 0;
+
+	if (dev == NULL)
+		return -EINVAL;
+
+	switch (filter_type) {
+	case RTE_ETH_FILTER_HASH:
+		/* Hash filter processing */
+		/* add empty function here to avoid compile error */
+		ret = i40e_hash_filter_ctrl(dev, filter_op, arg);
+		break;
+	case RTE_ETH_FILTER_FDIR:
+		/* FDIR filter processing */
+		/* add empty function here to avoid compile error */
+		ret = i40e_fdir_filter_ctrl(dev, filter_op, arg);
+		break;
+	default:
+		PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
+							filter_type);
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}