From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [net-next, RFC PATCH] net: sched: cls_range: Introduce Range classifier Date: Fri, 14 Sep 2018 11:58:13 +0200 Message-ID: <20180914095813.GL25110@nanopsycho> References: <153687160312.43503.11156697286063840163.stgit@anamhost.jf.intel.com> <153687192654.43503.1433255216543560934.stgit@anamhost.jf.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, alexander.h.duyck@intel.com, jakub.kicinski@netronome.com, sridhar.samudrala@intel.com, jhs@mojatatu.com, jesse.brandeburg@intel.com, xiyou.wangcong@gmail.com To: Amritha Nambiar Return-path: Received: from mail-wr1-f68.google.com ([209.85.221.68]:42692 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726868AbeINPQM (ORCPT ); Fri, 14 Sep 2018 11:16:12 -0400 Received: by mail-wr1-f68.google.com with SMTP id v17-v6so9875607wrr.9 for ; Fri, 14 Sep 2018 03:02:25 -0700 (PDT) Content-Disposition: inline In-Reply-To: <153687192654.43503.1433255216543560934.stgit@anamhost.jf.intel.com> Sender: netdev-owner@vger.kernel.org List-ID: Thu, Sep 13, 2018 at 10:52:06PM CEST, amritha.nambiar@intel.com wrote: [...] >+static struct cls_range_filter *range_lookup(struct cls_range_head *head, >+ struct range_flow_key *key, >+ struct range_flow_key *mkey, >+ bool is_skb) >+{ >+ struct cls_range_filter *filter, *next_filter; >+ struct range_params range; >+ int ret; >+ size_t cmp_size; >+ >+ list_for_each_entry_safe(filter, next_filter, &head->filters, flist) { This really should be list_for_each_entry_rcu() also, as I wrote in the previous email, this should be done in cls_flower. Look at fl_lookup() it looks-up hashtable. You just need to add linked list traversal and range comparison to that function for the hit in the hashtable. >+ if (!is_skb) { >+ /* Existing filter comparison */ >+ cmp_size = sizeof(filter->mkey); >+ } else { >+ /* skb classification */ >+ ret = range_compare_params(&range, filter, key, >+ RANGE_PORT_DST); >+ if (ret < 0) >+ continue; >+ >+ ret = range_compare_params(&range, filter, key, >+ RANGE_PORT_SRC); >+ if (ret < 0) >+ continue; >+ >+ /* skb does not have min and max values */ >+ cmp_size = RANGE_KEY_MEMBER_OFFSET(tp_min); >+ } >+ if (!memcmp(mkey, &filter->mkey, cmp_size)) >+ return filter; >+ } >+ return NULL; [...]