[dpdk-dev] [PATCH v3 11/20] i40e: implement operations to get fdir info

Jingjing Wu jingjing.wu at intel.com
Fri Sep 26 08:03:29 CEST 2014


implement operation to get flow director information in i40e pmd driver

Signed-off-by: Jingjing Wu <jingjing.wu at intel.com>
Acked-by: Chen Jing D(Mark) <jing.d.chen at intel.com>
Acked-by: Helin Zhang <helin.zhang at intel.com>
---
 lib/librte_pmd_i40e/i40e_fdir.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 82645df..d6c1793 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -92,6 +92,8 @@ static int i40e_fdir_filter_programming(struct i40e_pf *pf,
 			enum i40e_filter_pctype pctype,
 			struct rte_eth_fdir_filter *filter,
 			bool add);
+static void i40e_fdir_info_get(struct i40e_pf *pf,
+			   struct rte_eth_fdir_info *fdir);
 
 static int
 i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
@@ -865,6 +867,35 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 }
 
 /*
+ * i40e_fdir_info_get - get information of Flow Director
+ * @pf: ethernet device to get info from
+ * @fdir: a pointer to a structure of type *rte_eth_fdir_info* to be filled with
+ *    the flow director information.
+ */
+static void
+i40e_fdir_info_get(struct i40e_pf *pf, struct rte_eth_fdir_info *fdir)
+{
+	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+	uint32_t pfqf_ctl;
+
+	pfqf_ctl = I40E_READ_REG(hw, I40E_PFQF_CTL_0);
+	fdir->mode = pfqf_ctl & I40E_PFQF_CTL_0_FD_ENA_MASK ? 1 : 0;
+	fdir->info_ext.guarant_spc =
+		(uint16_t)hw->func_caps.fd_filters_guaranteed;
+	fdir->info_ext.guarant_cnt =
+		(uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &
+			    I40E_PFQF_FDSTAT_GUARANT_CNT_MASK) >>
+			    I40E_PFQF_FDSTAT_GUARANT_CNT_SHIFT);
+	fdir->info_ext.best_spc =
+		(uint16_t)hw->func_caps.fd_filters_best_effort;
+	fdir->info_ext.best_cnt =
+		(uint16_t)((I40E_READ_REG(hw, I40E_PFQF_FDSTAT) &
+			    I40E_PFQF_FDSTAT_BEST_CNT_MASK) >>
+			    I40E_PFQF_FDSTAT_BEST_CNT_SHIFT);
+	return;
+}
+
+/*
  * i40e_fdir_ctrl_func - deal with all operations on flow director.
  * @pf: board private structure
  * @filter_op:operation will be taken.
@@ -894,6 +925,9 @@ i40e_fdir_ctrl_func(struct i40e_pf *pf, enum rte_filter_op filter_op, void *arg)
 			(struct rte_eth_fdir_filter *)arg,
 			FALSE);
 		break;
+	case RTE_ETH_FILTER_OP_GET_INFO:
+		i40e_fdir_info_get(pf, (struct rte_eth_fdir_info *)arg);
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "unknown operation %u.", filter_op);
 		ret = -EINVAL;
-- 
1.8.1.4



More information about the dev mailing list