DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, mesut.a.ergin@intel.com,
	Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/3] net/i40e: cache fdir enable value in rx queue
Date: Wed,  9 Oct 2019 16:20:04 +0100	[thread overview]
Message-ID: <20191009152006.5768-2-harry.van.haaren@intel.com> (raw)
In-Reply-To: <20191009152006.5768-1-harry.van.haaren@intel.com>

This commit adds a fdir_enable flag in a uint8_t sized hole
the rx queue structure The flag enables the rx code path to
easily identify if fdir is active. This can be used to skip
fdir id processing when it is not required.

The flag is zero by default (as rxq is zmalloc-ed at startup),
and the flag is set to 1 on configuration of a flow director rule.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

v2:
- Disable FDIR processing on flush (Qi)
- Disable FDIR processing on last rule deletion (Qi)
- Moved enable/disable to seperate function to avoid code duplication
- Added PMD_LOG INFO level print for FDIR RX Processing enable/disable
---
 drivers/net/i40e/i40e_ethdev.h |  1 +
 drivers/net/i40e/i40e_fdir.c   | 20 ++++++++++++++++++++
 drivers/net/i40e/i40e_flow.c   |  4 ++++
 drivers/net/i40e/i40e_rxtx.h   |  1 +
 4 files changed, 26 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 38ac3ead6..743bead25 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1153,6 +1153,7 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name,
 					uint32_t len,
 					int socket_id);
 int i40e_fdir_configure(struct rte_eth_dev *dev);
+void i40e_fdir_rx_proc_enable(struct rte_eth_dev *dev, bool on);
 void i40e_fdir_teardown(struct i40e_pf *pf);
 enum i40e_filter_pctype
 	i40e_flowtype_to_pctype(const struct i40e_adapter *adapter,
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index b3e893a5b..dee007daa 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -608,6 +608,23 @@ i40e_set_flex_mask_on_pctype(struct i40e_pf *pf,
 	}
 }
 
+/*
+ * Enable/disable flow director RX processing in vector routines.
+ */
+void
+i40e_fdir_rx_proc_enable(struct rte_eth_dev *dev, bool on)
+{
+	int32_t i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		struct i40e_rx_queue *rxq = dev->data->rx_queues[i];
+		if (!rxq)
+			continue;
+		rxq->fdir_enabled = on;
+	}
+	PMD_DRV_LOG(DEBUG, "Flow Director processing on RX set to %d", on);
+}
+
 /*
  * Configure flow director related setting
  */
@@ -675,6 +692,9 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
 		PMD_DRV_LOG(ERR, "Not support flexible payload.");
 	}
 
+	/* Enable FDIR processing in RX routines */
+	i40e_fdir_rx_proc_enable(dev, 1);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index e902a35d7..9e038fa48 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4775,6 +4775,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev,
 			i40e_fdir_teardown(pf);
 			dev->data->dev_conf.fdir_conf.mode =
 				   RTE_FDIR_MODE_NONE;
+			i40e_fdir_rx_proc_enable(dev, 0);
 		}
 		break;
 	case RTE_ETH_FILTER_HASH:
@@ -4931,6 +4932,9 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
 		return -rte_errno;
 	}
 
+	/* Disable FDIR processing as all FDIR rules are now flushed */
+	i40e_fdir_rx_proc_enable(dev, 0);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 3fc619af9..1028e8b68 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -96,6 +96,7 @@ struct i40e_rx_queue {
 
 	uint16_t port_id; /**< device port ID */
 	uint8_t crc_len; /**< 0 if CRC stripped, 4 otherwise */
+	uint8_t fdir_enabled; /**< 0 if FDIR disabled, 1 when enabled */
 	uint16_t queue_id; /**< RX queue index */
 	uint16_t reg_idx; /**< RX queue register index */
 	uint8_t drop_en; /**< if not 0, set register bit */
-- 
2.17.1


  reply	other threads:[~2019-10-09 15:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  9:07 [dpdk-dev] [PATCH 0/3] net/i40e: add FDIR ID to vector rx Harry van Haaren
2019-10-07  9:07 ` [dpdk-dev] [PATCH 1/3] net/i40e: cache fdir enable value in rx queue Harry van Haaren
2019-10-07  9:07 ` [dpdk-dev] [PATCH 2/3] net/i40e: add flow mark capability to SSE vector routine Harry van Haaren
2019-10-07  9:07 ` [dpdk-dev] [PATCH 3/3] net/i40e: add flow director support to avx rx path Harry van Haaren
2019-10-09 15:20 ` [dpdk-dev] [PATCH v2 0/3] net/i40e: add FDIR ID to vector rx Harry van Haaren
2019-10-09 15:20   ` Harry van Haaren [this message]
2019-10-09 15:20   ` [dpdk-dev] [PATCH v2 2/3] net/i40e: add flow mark capability to SSE vector routine Harry van Haaren
2019-10-09 15:20   ` [dpdk-dev] [PATCH v2 3/3] net/i40e: add flow director support to avx rx path Harry van Haaren
2019-10-10  0:02   ` [dpdk-dev] [PATCH v2 0/3] net/i40e: add FDIR ID to vector rx Zhang, Qi Z
2019-10-10 16:23     ` Ergin, Mesut A
2019-10-21  6:04   ` Ye Xiaolong

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=20191009152006.5768-2-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=mesut.a.ergin@intel.com \
    --cc=qi.z.zhang@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).