From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E6C427D57 for ; Thu, 24 Aug 2017 17:30:51 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2017 08:30:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,422,1498546800"; d="scan'208";a="1209969762" Received: from silpixa00389036.ir.intel.com (HELO silpixa00389036.ger.corp.intel.com) ([10.237.223.231]) by fmsmga002.fm.intel.com with ESMTP; 24 Aug 2017 08:30:50 -0700 From: Kirill Rybalchenko To: dev@dpdk.org Cc: kirill.rybalchenko@intel.com, andrey.chilikin@intel.com, beilei.xing@intel.com Date: Thu, 24 Aug 2017 16:30:34 +0100 Message-Id: <1503588634-85735-3-git-send-email-kirill.rybalchenko@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1503588634-85735-1-git-send-email-kirill.rybalchenko@intel.com> References: <1503588634-85735-1-git-send-email-kirill.rybalchenko@intel.com> Subject: [dpdk-dev] [PATCH 2/2] 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: Thu, 24 Aug 2017 15:30:52 -0000 When addidng flow director filter for raw flow type, instead of constructing packet use buffer with pre-constructed packet. Signed-off-by: Kirill Rybalchenko --- drivers/net/i40e/i40e_fdir.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 8013add..0558914 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1093,6 +1093,7 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev, struct i40e_fdir_filter *fdir_filter, *node; struct i40e_fdir_filter check_filter; /* Check if the filter exists */ int ret = 0; + uint16_t flow_type = filter->input.flow_type; if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) { PMD_DRV_LOG(ERR, "FDIR is not enabled, please" @@ -1100,7 +1101,7 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev, return -ENOTSUP; } - if (!I40E_VALID_FLOW(filter->input.flow_type)) { + if (flow_type != RTE_ETH_FLOW_RAW && !I40E_VALID_FLOW(flow_type)) { PMD_DRV_LOG(ERR, "invalid flow_type input."); return -EINVAL; } @@ -1132,20 +1133,30 @@ 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 (flow_type == RTE_ETH_FLOW_RAW) { + if (filter->input.flow.raw_flow.length > I40E_FDIR_PKT_LEN || + !filter->input.flow.raw_flow.packet || + !I40E_VALID_FLOW(filter->input.flow.raw_flow.flow)) { + PMD_DRV_LOG(ERR, "Invalid raw flow filter parameters!"); + } + memcpy(pkt, filter->input.flow.raw_flow.packet, + filter->input.flow.raw_flow.length); + flow_type = filter->input.flow.raw_flow.flow; + } 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) { /* get translated pctype value in fd pctype register */ pctype = (enum i40e_filter_pctype)i40e_read_rx_ctl( hw, I40E_GLQF_FD_PCTYPES( - (int)i40e_flowtype_to_pctype( - filter->input.flow_type))); + (int)i40e_flowtype_to_pctype(flow_type))); } else - pctype = i40e_flowtype_to_pctype(filter->input.flow_type); + pctype = i40e_flowtype_to_pctype(flow_type); ret = i40e_fdir_filter_programming(pf, pctype, filter, add); if (ret < 0) { -- 2.5.5