From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9A31AA04A4; Wed, 3 Jun 2020 16:21:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CED21D581; Wed, 3 Jun 2020 16:20:51 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A45201D567 for ; Wed, 3 Jun 2020 16:20:49 +0200 (CEST) IronPort-SDR: 3yZvMDuXKqcMwMahiAkISxDEWM9gI/xVg9SY91NJr1+DtBUveYrH0UYZ3SfjOw29i0JezTL0Zi eiYOf7vybmgQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 07:20:32 -0700 IronPort-SDR: QkVkZYlI+JiGZJgV2hrhHXpxULFZVFy/DMbiOdF1R15PZ18re9m5lzpvOLz1iuIt2RRL0aJa/o jEcD5KwHpMzA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,467,1583222400"; d="scan'208";a="416572788" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2020 07:20:30 -0700 From: Bernard Iremonger To: dev@dpdk.org, beilei.xing@intel.com, qi.z.zhang@intel.com, declan.doherty@intel.com, orika@mellanox.com Cc: Bernard Iremonger Date: Wed, 3 Jun 2020 15:20:07 +0100 Message-Id: <1591194009-4086-7-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1591194009-4086-1-git-send-email-bernard.iremonger@intel.com> References: <1591194009-4086-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH 6/8] net/i40e: add map functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" add i40e_map_conf_init() add i40e_config_map_filter() initialize map_config_list in pf call rte_pmd_i40e_flow_type_mapping_update() Signed-off-by: Bernard Iremonger --- drivers/net/i40e/i40e_ethdev.c | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 970a31c..c7f0eec 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1660,6 +1660,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) /* initialize RSS rule list */ TAILQ_INIT(&pf->rss_config_list); + /* initialize MAP rule list */ + TAILQ_INIT(&pf->map_config_list); + /* initialize Traffic Manager configuration */ i40e_tm_conf_init(dev); @@ -13411,6 +13414,59 @@ i40e_config_rss_filter(struct i40e_pf *pf, return 0; } +int +i40e_map_conf_init(struct i40e_rte_flow_map_conf *out, + const struct rte_flow_action_map *in) +{ + int ret = 0; + + if ((in->pctype >= I40E_FILTER_PCTYPE_MAX) || + (in->flowtype >= I40E_FLOW_TYPE_MAX)) + ret = EINVAL; + else + out->conf = (struct rte_flow_action_map){ + .pctype = in->pctype, + .flowtype = in->flowtype, + }; + return ret; +} + +int +i40e_config_map_filter(struct i40e_pf *pf, + struct i40e_rte_flow_map_conf *map_conf, bool add) +{ + struct i40e_rte_flow_map_conf *map_info = &pf->map_info; + struct rte_flow_action_map update_conf = map_info->conf; + struct rte_pmd_i40e_flow_type_mapping type_map; + int ret; + + if (add) { + update_conf.flowtype = map_conf->conf.flowtype; + update_conf.pctype = map_conf->conf.pctype; + + type_map.flow_type = map_conf->conf.flowtype; + type_map.pctype = (1ULL << map_conf->conf.pctype); + ret = rte_pmd_i40e_flow_type_mapping_update( + pf->dev_data->port_id, &type_map, 1, 0); + if (ret) + return ret; + + /* Update MAP info in pf */ + if (i40e_map_conf_init(map_info, &update_conf)) + return -EINVAL; + + } else { + if (!map_conf->valid) + return 0; + + map_info->conf.flowtype = 0; + map_info->conf.pctype = 0; + map_info->valid = false; + } + + return 0; +} + RTE_INIT(i40e_init_log) { i40e_logtype_init = rte_log_register("pmd.net.i40e.init"); -- 2.7.4