DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mesut Ali Ergin <mesut.a.ergin@intel.com>
To: Beilei Xing <beilei.xing@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Cc: dev@dpdk.org, Mesut Ali Ergin <mesut.a.ergin@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: Fail rte_flow MARK requests if RX func was vectorized
Date: Fri, 24 May 2019 15:49:30 -0700	[thread overview]
Message-ID: <1558738171-145415-1-git-send-email-mesut.a.ergin@intel.com> (raw)

Runtime requests to install an rte_flow with MARK action should fail
if a vector RX function was already chosen for the device during
configuration time.

Currently, i40e rte_flow driver would successfully install the flow
with MARK action, even when vector RX functions are in use. However,
those vector RX functions will fail to retrieve the MARK data from the
device descriptor into the mbuf. The original app installing the flow
would never know what went wrong. The change introduced in this patch
must be reverted if/when vector RX functions start supporting correct
FDIR processing for MARK actions.

Signed-off-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>

v2:
 - Check added to fail MARK request only if the device was started
---
 drivers/net/i40e/i40e_flow.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 3afd779..d1233ed 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -22,12 +22,20 @@
 #include "base/i40e_type.h"
 #include "base/i40e_prototype.h"
 #include "i40e_ethdev.h"
+#include "i40e_rxtx.h"
 
 #define I40E_IPV6_TC_MASK	(0xFF << I40E_FDIR_IPv6_TC_OFFSET)
 #define I40E_IPV6_FRAG_HEADER	44
 #define I40E_TENANT_ARRAY_NUM	3
 #define I40E_TCI_MASK		0xFFFF
 
+/* Check whether device RX function is vectorized  */
+#define I40E_RX_IS_VECTOR(dev)	\
+	(dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec || \
+	 dev->rx_pkt_burst == i40e_recv_pkts_vec || \
+	 dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 || \
+	 dev->rx_pkt_burst == i40e_recv_pkts_vec_avx2)
+
 static int i40e_flow_validate(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
 			      const struct rte_flow_item pattern[],
@@ -3079,6 +3087,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 		filter->action.behavior = I40E_FDIR_PASSTHRU;
 		break;
 	case RTE_FLOW_ACTION_TYPE_MARK:
+		if (I40E_RX_IS_VECTOR(dev) && dev->data->dev_started) {
+			/* MARK not supported w/ Vector RX on a started device*/
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "Action not supported: Vector RX has been active.");
+			return -rte_errno;
+		}
 		filter->action.behavior = I40E_FDIR_PASSTHRU;
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
@@ -3103,6 +3118,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 			   "Invalid action.");
 			return -rte_errno;
 		}
+		if (I40E_RX_IS_VECTOR(dev) && dev->data->dev_started) {
+			/* MARK not supported w/ Vector RX on a started device*/
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "Action not supported: Vector RX has been active.");
+			return -rte_errno;
+		}
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
 		filter->soft_id = mark_spec->id;
-- 
2.7.4


             reply	other threads:[~2019-05-24 22:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24 22:49 Mesut Ali Ergin [this message]
2019-05-25 11:56 ` Zhang, Qi Z
2019-06-03 17:44   ` Ergin, Mesut A

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=1558738171-145415-1-git-send-email-mesut.a.ergin@intel.com \
    --to=mesut.a.ergin@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --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).