From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0A9FD2BAD for ; Fri, 23 Dec 2016 13:19:32 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 23 Dec 2016 04:19:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,393,1477983600"; d="scan'208";a="1075593843" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.29]) ([10.237.220.29]) by orsmga001.jf.intel.com with ESMTP; 23 Dec 2016 04:19:30 -0800 To: Nelio Laranjeiro , dev@dpdk.org References: Cc: Adrien Mazarguil From: Ferruh Yigit Message-ID: <21927e17-26fc-6c45-8953-3215fe47ce85@intel.com> Date: Fri, 23 Dec 2016 12:19:30 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 2/4] net/mlx5: add software support for rte_flow 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: Fri, 23 Dec 2016 12:19:33 -0000 On 12/21/2016 3:19 PM, Nelio Laranjeiro wrote: > Introduce initial software validation for rte_flow rules. > > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5.h | 2 + > drivers/net/mlx5/mlx5_flow.c | 202 ++++++++++++++++++++++++++++++++++------ > drivers/net/mlx5/mlx5_trigger.c | 2 + > 3 files changed, 177 insertions(+), 29 deletions(-) <...> > + for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) { > + if (items->type == RTE_FLOW_ITEM_TYPE_VOID) { > + continue; > + } else if (items->type == RTE_FLOW_ITEM_TYPE_ETH) { > + if (ilast) > + goto exit_item_not_supported; > + ilast = items; > + } else if ((items->type == RTE_FLOW_ITEM_TYPE_IPV4) || > + (items->type == RTE_FLOW_ITEM_TYPE_IPV6)) { > + if (!ilast) > + goto exit_item_not_supported; > + else if (ilast->type != RTE_FLOW_ITEM_TYPE_ETH) > + goto exit_item_not_supported; > + ilast = items; > + } else if ((items->type == RTE_FLOW_ITEM_TYPE_UDP) || > + (items->type == RTE_FLOW_ITEM_TYPE_TCP)) { > + if (!ilast) > + goto exit_item_not_supported; > + else if ((ilast->type != RTE_FLOW_ITEM_TYPE_IPV4) && > + (ilast->type != RTE_FLOW_ITEM_TYPE_IPV6)) > + goto exit_item_not_supported; > + ilast = items; > + } else { > + goto exit_item_not_supported; > + } > + } I was thinking rte_flow_validate() is validating rule against hardware / PMD, but here the API input validation is also done. In patch 3/4 API input validation continues with validating each item one by one. Shouldn't each PMD needs to do this kind of input validation? Why not move generic input validation to rte_flow API? And if it is valid, call PMD specific one.