From patchwork Fri May 24 22:49:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ergin, Mesut A" X-Patchwork-Id: 53696 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E2A714EC; Sat, 25 May 2019 00:49:57 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 98A2F3DC for ; Sat, 25 May 2019 00:49:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2019 15:49:54 -0700 X-ExtLoop1: 1 Received: from skx-pink.jf.intel.com ([10.54.80.236]) by fmsmga006.fm.intel.com with ESMTP; 24 May 2019 15:49:54 -0700 From: Mesut Ali Ergin To: Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Mesut Ali Ergin Date: Fri, 24 May 2019 15:49:30 -0700 Message-Id: <1558738171-145415-1-git-send-email-mesut.a.ergin@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v2] net/i40e: Fail rte_flow MARK requests if RX func was vectorized X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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;