From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 4BEE91B331 for ; Tue, 10 Oct 2017 22:29:10 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 10 Oct 2017 13:29:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,359,1503385200"; d="scan'208";a="1204393779" Received: from silpixa00389036.ir.intel.com (HELO silpixa00389036.ger.corp.intel.com) ([10.237.223.231]) by fmsmga001.fm.intel.com with ESMTP; 10 Oct 2017 13:29:07 -0700 From: Kirill Rybalchenko To: dev@dpdk.org Cc: kirill.rybalchenko@intel.com, andrey.chilikin@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com Date: Tue, 10 Oct 2017 21:28:56 +0100 Message-Id: <1507667338-15742-3-git-send-email-kirill.rybalchenko@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1507667338-15742-1-git-send-email-kirill.rybalchenko@intel.com> References: <1507666412-15320-1-git-send-email-kirill.rybalchenko@intel.com> <1507667338-15742-1-git-send-email-kirill.rybalchenko@intel.com> Subject: [dpdk-dev] [PATCH v5 2/4] net/i40e: add support for raw flow type for flow director 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: , X-List-Received-Date: Tue, 10 Oct 2017 20:29:10 -0000 When addidng flow director filter for raw flow type, instead of constructing packet use buffer with pre-constructed packet. v3: Merge with dynamic pctype to flow type mapping patch. v5: Fix code style warning. Signed-off-by: Kirill Rybalchenko --- drivers/net/i40e/i40e_fdir.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 491c643..ae5cf9a 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1456,7 +1456,18 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev, return -ENOTSUP; } - pctype = i40e_flowtype_to_pctype(pf->adapter, filter->input.flow_type); + if (filter->input.flow_type == RTE_ETH_FLOW_RAW) { + if (filter->input.flow.raw_flow.length > I40E_FDIR_PKT_LEN || + !filter->input.flow.raw_flow.packet) { + PMD_DRV_LOG(ERR, "Invalid raw flow filter parameters!"); + return -EINVAL; + } + pctype = i40e_flowtype_to_pctype(pf->adapter, + filter->input.flow.raw_flow.flow); + } else { + pctype = i40e_flowtype_to_pctype(pf->adapter, + filter->input.flow_type); + } if (pctype == I40E_FILTER_PCTYPE_INVALID) { PMD_DRV_LOG(ERR, "invalid flow_type input."); return -EINVAL; @@ -1473,10 +1484,15 @@ 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 (filter->input.flow_type == RTE_ETH_FLOW_RAW) { + memcpy(pkt, filter->input.flow.raw_flow.packet, + filter->input.flow.raw_flow.length); + } 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) { -- 2.5.5