DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org, beilei.xing@intel.com, qi.z.zhang@intel.com,
	declan.doherty@intel.com, orika@mellanox.com
Cc: Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-dev] [PATCH 6/8] net/i40e: add map functions
Date: Wed,  3 Jun 2020 15:20:07 +0100	[thread overview]
Message-ID: <1591194009-4086-7-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1591194009-4086-1-git-send-email-bernard.iremonger@intel.com>

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 <bernard.iremonger@intel.com>
---
 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


  parent reply	other threads:[~2020-06-03 14:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 14:20 [dpdk-dev] [PATCH 0/8] add flow action map Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 1/8] librte_ethdev: add new flow types and action Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 2/8] librte_ethdev: add map filter type Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 3/8] librte_ethdev: add map action Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 4/8] app/testpmd: parse map actions Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 5/8] net/i40e: add map filter Bernard Iremonger
2020-06-03 14:20 ` Bernard Iremonger [this message]
2020-06-03 14:20 ` [dpdk-dev] [PATCH 7/8] net/i40e: parse map pattern and action Bernard Iremonger
2020-06-03 14:20 ` [dpdk-dev] [PATCH 8/8] doc: release note Bernard Iremonger
2020-06-04  6:05 ` [dpdk-dev] [PATCH 0/8] add flow action map Ori Kam
2020-06-04 11:21   ` Iremonger, Bernard
2020-06-04 13:12     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1591194009-4086-7-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=orika@mellanox.com \
    --cc=qi.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).