From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D2014A0096 for ; Mon, 3 Jun 2019 19:40:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A97351BB2A; Mon, 3 Jun 2019 19:40:21 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8E1F51BB2A for ; Mon, 3 Jun 2019 19:40:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 10:40:18 -0700 X-ExtLoop1: 1 Received: from skx-pink.jf.intel.com ([10.54.80.236]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2019 10:40:18 -0700 From: Mesut Ali Ergin To: mesut.a.ergin@intel.com Cc: stable@dpdk.org Date: Mon, 3 Jun 2019 10:40:16 -0700 Message-Id: <1559583616-277366-1-git-send-email-mesut.a.ergin@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-stable] [PATCH v3] net/i40e: Fail rte_flow MARK requests if RX func was vectorized X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "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 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