From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 32AC22C19 for ; Mon, 4 Sep 2017 12:38:19 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 03:38:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,474,1498546800"; d="scan'208";a="1214452567" Received: from rnicolau-mobl.ger.corp.intel.com (HELO [10.237.221.79]) ([10.237.221.79]) by fmsmga002.fm.intel.com with ESMTP; 04 Sep 2017 03:38:17 -0700 To: Kirill Rybalchenko , dev@dpdk.org Cc: andrey.chilikin@intel.com, beilei.xing@intel.com References: <1503588634-85735-1-git-send-email-kirill.rybalchenko@intel.com> <1503588634-85735-3-git-send-email-kirill.rybalchenko@intel.com> From: Radu Nicolau Message-ID: Date: Mon, 4 Sep 2017 11:38:16 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <1503588634-85735-3-git-send-email-kirill.rybalchenko@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [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: Mon, 04 Sep 2017 10:38:20 -0000 On 8/24/2017 4:30 PM, Kirill Rybalchenko wrote: > 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)) { Why not expand I40E_VALID_FLOW to check for RTE_ETH_FLOW_RAW as well? > 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) {