patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized
@ 2019-06-03 17:44 Mesut Ali Ergin
  2019-10-28  7:41 ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
  0 siblings, 1 reply; 4+ messages in thread
From: Mesut Ali Ergin @ 2019-06-03 17:44 UTC (permalink / raw)
  To: beilei.xing, qi.z.zhang; +Cc: dev, stable, Mesut Ali Ergin

Runtime requests to install an rte_flow with MARK action should fail
if the device was started and a vector RX function was already chosen
for 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 function introduced in this patch
must be adjusted if/when certain vector RX functions start supporting
correct FDIR processing for MARK actions.

Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Cc: stable@dpdk.org

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

v3:
 - Check for support made in an function for future extensibility
 - Fixes code style warnings
 - CC stable w/ fix reference
v2:
 - Check added to fail MARK request only if the device was started
---
 drivers/net/i40e/i40e_flow.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 8b2e297..66d4104 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -22,6 +22,7 @@
 #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
@@ -3040,6 +3041,21 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	return 0;
 }
 
+/* Check if device supports installing a new MARK action */
+static bool i40e_device_supports_mark(struct rte_eth_dev *dev)
+{
+	if (dev->data->dev_started) {
+		/* Vector RX currently doesn't support MARK action. */
+		if (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)
+			return false;
+	}
+
+	return true;
+}
+
 /* Parse to get the action info of a FDIR filter.
  * FDIR action supports QUEUE or (QUEUE + MARK).
  */
@@ -3079,6 +3095,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_device_supports_mark(dev)) {
+			/* MARK not supported */
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "FDIR Action Error: MARK not supported.");
+			return -rte_errno;
+		}
 		filter->action.behavior = I40E_FDIR_PASSTHRU;
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
@@ -3103,6 +3126,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 			   "Invalid action.");
 			return -rte_errno;
 		}
+		if (!i40e_device_supports_mark(dev)) {
+			/* MARK not supported */
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "FDIR Action Error: MARK not supported.");
+			return -rte_errno;
+		}
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
 		filter->soft_id = mark_spec->id;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized
  2019-06-03 17:44 [dpdk-stable] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized Mesut Ali Ergin
@ 2019-10-28  7:41 ` " Ye Xiaolong
  2019-10-30 14:01   ` Ye Xiaolong
  0 siblings, 1 reply; 4+ messages in thread
From: Ye Xiaolong @ 2019-10-28  7:41 UTC (permalink / raw)
  To: Mesut Ali Ergin; +Cc: beilei.xing, qi.z.zhang, dev, stable

Sorry for missing this patch for a long time.

On 06/03, Mesut Ali Ergin wrote:
>Runtime requests to install an rte_flow with MARK action should fail
>if the device was started and a vector RX function was already chosen
>for 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 function introduced in this patch
>must be adjusted if/when certain vector RX functions start supporting
>correct FDIR processing for MARK actions.
>
>Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
>Cc: stable@dpdk.org
>
>Signed-off-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>
>
>v3:
> - Check for support made in an function for future extensibility
> - Fixes code style warnings
> - CC stable w/ fix reference
>v2:
> - Check added to fail MARK request only if the device was started
>---

Minor nit, you should put the change logs after above '---' line, then they can be
ignored when git-am, fix it while merging.

> drivers/net/i40e/i40e_flow.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized
  2019-10-28  7:41 ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
@ 2019-10-30 14:01   ` Ye Xiaolong
  0 siblings, 0 replies; 4+ messages in thread
From: Ye Xiaolong @ 2019-10-30 14:01 UTC (permalink / raw)
  To: Mesut Ali Ergin; +Cc: beilei.xing, qi.z.zhang, dev, stable

Latest update, since i40e now has added FDIR ID to vector rx after patchset
https://patches.dpdk.org/cover/60820/ being merged, this patch is no longer
needed, so just drop it from next-net-intel.

Thanks,
Xiaolong

On 10/28, Ye Xiaolong wrote:
>Sorry for missing this patch for a long time.
>
>On 06/03, Mesut Ali Ergin wrote:
>>Runtime requests to install an rte_flow with MARK action should fail
>>if the device was started and a vector RX function was already chosen
>>for 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 function introduced in this patch
>>must be adjusted if/when certain vector RX functions start supporting
>>correct FDIR processing for MARK actions.
>>
>>Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
>>Cc: stable@dpdk.org
>>
>>Signed-off-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>
>>
>>v3:
>> - Check for support made in an function for future extensibility
>> - Fixes code style warnings
>> - CC stable w/ fix reference
>>v2:
>> - Check added to fail MARK request only if the device was started
>>---
>
>Minor nit, you should put the change logs after above '---' line, then they can be
>ignored when git-am, fix it while merging.
>
>> drivers/net/i40e/i40e_flow.c | 30 ++++++++++++++++++++++++++++++
>> 1 file changed, 30 insertions(+)
>
>Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
>
>Applied to dpdk-next-net-intel. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized
@ 2019-06-03 17:40 " Mesut Ali Ergin
  0 siblings, 0 replies; 4+ messages in thread
From: Mesut Ali Ergin @ 2019-06-03 17:40 UTC (permalink / raw)
  To: mesut.a.ergin; +Cc: stable

Runtime requests to install an rte_flow with MARK action should fail
if the device was started and a vector RX function was already chosen
for 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 function introduced in this patch
must be adjusted if/when certain vector RX functions start supporting
correct FDIR processing for MARK actions.

Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Cc: stable@dpdk.org

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

v3:
 - Check for support made in an function for future extensibility
 - Fixes code style warnings
 - CC stable w/ fix reference
v2:
 - Check added to fail MARK request only if the device was started
---
 drivers/net/i40e/i40e_flow.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 8b2e297..66d4104 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -22,6 +22,7 @@
 #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
@@ -3040,6 +3041,21 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	return 0;
 }
 
+/* Check if device supports installing a new MARK action */
+static bool i40e_device_supports_mark(struct rte_eth_dev *dev)
+{
+	if (dev->data->dev_started) {
+		/* Vector RX currently doesn't support MARK action. */
+		if (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)
+			return false;
+	}
+
+	return true;
+}
+
 /* Parse to get the action info of a FDIR filter.
  * FDIR action supports QUEUE or (QUEUE + MARK).
  */
@@ -3079,6 +3095,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_device_supports_mark(dev)) {
+			/* MARK not supported */
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "FDIR Action Error: MARK not supported.");
+			return -rte_errno;
+		}
 		filter->action.behavior = I40E_FDIR_PASSTHRU;
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
@@ -3103,6 +3126,13 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 			   "Invalid action.");
 			return -rte_errno;
 		}
+		if (!i40e_device_supports_mark(dev)) {
+			/* MARK not supported */
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ACTION, act,
+					   "FDIR Action Error: MARK not supported.");
+			return -rte_errno;
+		}
 		mark_spec = act->conf;
 		filter->action.report_status = I40E_FDIR_REPORT_ID;
 		filter->soft_id = mark_spec->id;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 17:44 [dpdk-stable] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized Mesut Ali Ergin
2019-10-28  7:41 ` [dpdk-stable] [dpdk-dev] " Ye Xiaolong
2019-10-30 14:01   ` Ye Xiaolong
  -- strict thread matches above, loose matches on Subject: below --
2019-06-03 17:40 [dpdk-stable] " Mesut Ali Ergin

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox