From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9B5C37ED0 for ; Wed, 22 Oct 2014 02:54:00 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 21 Oct 2014 18:02:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,766,1406617200"; d="scan'208";a="609014741" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 21 Oct 2014 18:02:17 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s9M12Fx1006086; Wed, 22 Oct 2014 09:02:15 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s9M12DK3011296; Wed, 22 Oct 2014 09:02:15 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s9M12DEl011292; Wed, 22 Oct 2014 09:02:13 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Wed, 22 Oct 2014 09:01:18 +0800 Message-Id: <1413939687-11177-13-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1413939687-11177-1-git-send-email-jingjing.wu@intel.com> References: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> <1413939687-11177-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v4 12/21] i40e: implement operations to get fdir info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 00:54:01 -0000 implement operation to get flow director information in i40e pmd driver Signed-off-by: Jingjing Wu --- lib/librte_pmd_i40e/i40e_fdir.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c index 8996a1c..d2c8304 100644 --- a/lib/librte_pmd_i40e/i40e_fdir.c +++ b/lib/librte_pmd_i40e/i40e_fdir.c @@ -89,6 +89,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) @@ -874,6 +876,36 @@ 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 ? + RTE_FDIR_MODE_PERFECT : RTE_FDIR_MODE_NONE; + 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. @@ -903,6 +935,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_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