From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D7AC1959 for ; Mon, 28 Jul 2014 10:24:30 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 28 Jul 2014 01:26:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,747,1400050800"; d="scan'208";a="576413776" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 28 Jul 2014 01:26:14 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s6S8QBsV022894; Mon, 28 Jul 2014 16:26:11 +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 s6S8Q7as031208; Mon, 28 Jul 2014 16:26:09 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s6S8Q7s2031204; Mon, 28 Jul 2014 16:26:07 +0800 From: Helin Zhang To: dev@dpdk.org Date: Mon, 28 Jul 2014 16:25:53 +0800 Message-Id: <1406535955-31070-5-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1406535955-31070-1-git-send-email-helin.zhang@intel.com> References: <1406535955-31070-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 4/6] i40e: support of 'is_command_supported' 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: Mon, 28 Jul 2014 08:24:31 -0000 'is_command_supported' is defined for the capability discovery. Actually it is to check if a command (feature) is supported on a specific type of NIC port. Now i40e supports below eight commands. Of cause, more commands can be supported later. - RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE - RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE - RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT - RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT - RTE_CMD_GET_FILTER_SWAP - RTE_CMD_SET_FILTER_SWAP - RTE_CMD_GET_HASH_FUNCTION - RTE_CMD_SET_HASH_FUNCTION Signed-off-by: Helin Zhang --- lib/librte_pmd_i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 4403af4..87a4999 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -204,6 +204,8 @@ 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_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused, + enum rte_eth_command cmd); static int i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev, enum rte_eth_command cmd, void *args); @@ -252,6 +254,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, + .is_command_supported = i40e_dev_is_command_supported, .rx_classification_filter_ctl = i40e_rx_classification_filter_ctl, }; @@ -4292,6 +4295,31 @@ i40e_get_hash_function(struct i40e_hw *hw, enum rte_i40e_hash_function *hf) } static int +i40e_dev_is_command_supported(struct rte_eth_dev *dev __rte_unused, + enum rte_eth_command cmd) +{ + uint32_t i; + /* Below commands defined in rte_eth_features.h are for i40e only */ + static const enum rte_eth_command i40e_commands[] = { + RTE_CMD_GET_SYM_HASH_ENABLE_PER_PCTYPE, + RTE_CMD_SET_SYM_HASH_ENABLE_PER_PCTYPE, + RTE_CMD_GET_SYM_HASH_ENABLE_PER_PORT, + RTE_CMD_SET_SYM_HASH_ENABLE_PER_PORT, + RTE_CMD_GET_FILTER_SWAP, + RTE_CMD_SET_FILTER_SWAP, + RTE_CMD_GET_HASH_FUNCTION, + RTE_CMD_SET_HASH_FUNCTION, + }; + + for (i = 0; i < RTE_DIM(i40e_commands); i++) { + if (i40e_commands[i] == cmd) + return 1; + } + + return 0; +} + +static int i40e_rx_classification_filter_ctl(struct rte_eth_dev *dev, enum rte_eth_command cmd, void *args) -- 1.8.1.4