From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 24B5B276C for ; Wed, 20 Sep 2017 10:42:14 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 20 Sep 2017 01:42:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,420,1500966000"; d="scan'208";a="1016512480" Received: from silpixa00389036.ir.intel.com (HELO silpixa00389036.ger.corp.intel.com) ([10.237.223.231]) by orsmga003.jf.intel.com with ESMTP; 20 Sep 2017 01:42:12 -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: Wed, 20 Sep 2017 09:42:06 +0100 Message-Id: <1505896926-70362-3-git-send-email-kirill.rybalchenko@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1505896926-70362-1-git-send-email-kirill.rybalchenko@intel.com> References: <1503588634-85735-1-git-send-email-kirill.rybalchenko@intel.com> <1505896926-70362-1-git-send-email-kirill.rybalchenko@intel.com> Subject: [dpdk-dev] [PATCH v2 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: Wed, 20 Sep 2017 08:42:16 -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 | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 84c0a1f..d609bd5 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,11 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev, return -ENOTSUP; } - if (!I40E_VALID_FLOW(filter->input.flow_type)) { + /* + * This check against statically defined flow types will be removed + * once we implement dynamic mappings of flow types to pctypes + */ + if (flow_type != RTE_ETH_FLOW_RAW && !I40E_VALID_FLOW(flow_type)) { PMD_DRV_LOG(ERR, "invalid flow_type input."); return -EINVAL; } @@ -1132,20 +1137,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