DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
To: dev@dpdk.org
Cc: kirill.rybalchenko@intel.com, andrey.chilikin@intel.com,
	beilei.xing@intel.com, jingjing.wu@intel.com
Subject: [dpdk-dev] [PATCH v2 2/2] net/i40e: add support for raw flow type for flow director
Date: Wed, 20 Sep 2017 09:42:06 +0100	[thread overview]
Message-ID: <1505896926-70362-3-git-send-email-kirill.rybalchenko@intel.com> (raw)
In-Reply-To: <1505896926-70362-1-git-send-email-kirill.rybalchenko@intel.com>

When addidng flow director filter for raw flow type, instead
of constructing packet use buffer with pre-constructed packet.

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
 drivers/net/i40e/i40e_fdir.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 84c0a1f..d609bd5 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1093,6 +1093,7 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
 	struct i40e_fdir_filter *fdir_filter, *node;
 	struct i40e_fdir_filter check_filter; /* Check if the filter exists */
 	int ret = 0;
+	uint16_t flow_type = filter->input.flow_type;
 
 	if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) {
 		PMD_DRV_LOG(ERR, "FDIR is not enabled, please"
@@ -1100,7 +1101,11 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
 		return -ENOTSUP;
 	}
 
-	if (!I40E_VALID_FLOW(filter->input.flow_type)) {
+	/*
+	 * This check against statically defined flow types will be removed
+	 * once we implement dynamic mappings of flow types to pctypes
+	 */
+	if (flow_type != RTE_ETH_FLOW_RAW && !I40E_VALID_FLOW(flow_type)) {
 		PMD_DRV_LOG(ERR, "invalid flow_type input.");
 		return -EINVAL;
 	}
@@ -1132,20 +1137,30 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
 
 	memset(pkt, 0, I40E_FDIR_PKT_LEN);
 
-	ret = i40e_fdir_construct_pkt(pf, &filter->input, pkt);
-	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "construct packet for fdir fails.");
-		return ret;
+	if (flow_type == RTE_ETH_FLOW_RAW) {
+		if (filter->input.flow.raw_flow.length > I40E_FDIR_PKT_LEN ||
+		    !filter->input.flow.raw_flow.packet ||
+		    !I40E_VALID_FLOW(filter->input.flow.raw_flow.flow)) {
+			PMD_DRV_LOG(ERR, "Invalid raw flow filter parameters!");
+		}
+		memcpy(pkt, filter->input.flow.raw_flow.packet,
+		       filter->input.flow.raw_flow.length);
+		flow_type = filter->input.flow.raw_flow.flow;
+	} else {
+		ret = i40e_fdir_construct_pkt(pf, &filter->input, pkt);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "construct packet for fdir fails.");
+			return ret;
+		}
 	}
 
 	if (hw->mac.type == I40E_MAC_X722) {
 		/* get translated pctype value in fd pctype register */
 		pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl(
 			hw, I40E_GLQF_FD_PCTYPES(
-			(int)i40e_flowtype_to_pctype(
-			filter->input.flow_type)));
+			(int)i40e_flowtype_to_pctype(flow_type)));
 	} else
-		pctype = i40e_flowtype_to_pctype(filter->input.flow_type);
+		pctype = i40e_flowtype_to_pctype(flow_type);
 
 	ret = i40e_fdir_filter_programming(pf, pctype, filter, add);
 	if (ret < 0) {
-- 
2.5.5

  parent reply	other threads:[~2017-09-20  8:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 15:30 [dpdk-dev] [PATCH 0/2] ethdev: " Kirill Rybalchenko
2017-08-24 15:30 ` [dpdk-dev] [PATCH 1/2] " Kirill Rybalchenko
2017-09-04 10:35   ` Radu Nicolau
2017-08-24 15:30 ` [dpdk-dev] [PATCH 2/2] net/i40e: " Kirill Rybalchenko
2017-09-04 10:38   ` Radu Nicolau
2017-09-20  8:42 ` [dpdk-dev] [PATCH v2 0/2] ethdev: " Kirill Rybalchenko
2017-09-20  8:42   ` [dpdk-dev] [PATCH v2 1/2] " Kirill Rybalchenko
2017-09-20  8:42   ` Kirill Rybalchenko [this message]
2017-10-03 19:02   ` [dpdk-dev] [PATCH v2 0/2] " Ferruh Yigit
2017-10-04 16:57     ` Thomas Monjalon
2017-10-04 17:44       ` Ferruh Yigit
2017-10-04 17:56         ` Thomas Monjalon
2017-10-04 19:47           ` Ferruh Yigit
2017-10-04 22:42             ` Thomas Monjalon
2017-10-05  9:09             ` Rybalchenko, Kirill
2017-10-05 20:52   ` [dpdk-dev] [PATCH v3 0/4] " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 1/4] " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 2/4] net/i40e: " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
2017-10-05 20:52     ` [dpdk-dev] [PATCH v3 4/4] doc: add description of raw flow type in flow director in testpmd Kirill Rybalchenko
2017-10-10 20:13     ` [dpdk-dev] [PATCH v4 0/4] add support for raw flow type for flow director Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 1/4] ethdev: " Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 2/4] net/i40e: " Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
2017-10-10 20:13       ` [dpdk-dev] [PATCH v4 4/4] doc: add description of raw mode in flow director in testpmd Kirill Rybalchenko
2017-10-10 20:28       ` [dpdk-dev] [PATCH v5 0/4] add support for raw flow type for flow director Kirill Rybalchenko
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 1/4] ethdev: " Kirill Rybalchenko
2017-10-11 22:26           ` Thomas Monjalon
2017-10-12 11:41             ` Rybalchenko, Kirill
2017-10-12 12:01               ` Thomas Monjalon
2017-10-12 16:14               ` Adrien Mazarguil
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 2/4] net/i40e: " Kirill Rybalchenko
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: add raw flow type to " Kirill Rybalchenko
2017-10-13  3:27           ` Wu, Jingjing
2017-10-10 20:28         ` [dpdk-dev] [PATCH v5 4/4] doc: add description of raw mode in flow director in testpmd Kirill Rybalchenko

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=1505896926-70362-3-git-send-email-kirill.rybalchenko@intel.com \
    --to=kirill.rybalchenko@intel.com \
    --cc=andrey.chilikin@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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).