summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry van Haaren <harry.van.haaren@intel.com>2019-10-09 16:20:04 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-21 12:04:19 +0100
commit6f3192fc12e43e0bf9512d91517a20001554ac28 (patch)
treeff59e87a61d0b49cf2ab22a1605de8925bf0d37f
parentd1b274e3b654813ae5bc06ca2e42882a6ab33a05 (diff)
downloaddpdk-next-net-intel-6f3192fc12e43e0bf9512d91517a20001554ac28.zip
dpdk-next-net-intel-6f3192fc12e43e0bf9512d91517a20001554ac28.tar.gz
dpdk-next-net-intel-6f3192fc12e43e0bf9512d91517a20001554ac28.tar.xz
net/i40e: cache FDIR enable value in Rx queue
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> Acked-by: Qi Zhang <qi.z.zhang@intel.com> Tested-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>
-rw-r--r--drivers/net/i40e/i40e_ethdev.h1
-rw-r--r--drivers/net/i40e/i40e_fdir.c20
-rw-r--r--drivers/net/i40e/i40e_flow.c4
-rw-r--r--drivers/net/i40e/i40e_rxtx.h1
4 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 2ddaffb..295ad59 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1185,6 +1185,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 b3e893a..dee007d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -609,6 +609,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
*/
int
@@ -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 e902a35..9e038fa 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 3fc619a..1028e8b 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 */