From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: Fwd: u32 ht filters Date: Mon, 12 Feb 2018 16:51:02 +0100 Message-ID: <20180212155102.GC2153@nanopsycho> References: <9c8f997d-339c-5088-0bb5-124e9f55f02d@itcare.pl> <20180207070148.GA2149@nanopsycho.orion> <20180208073846.GA2041@nanopsycho> <20180212153216.GB2153@nanopsycho> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jiri Pirko , Linux Kernel Network Developers , =?utf-8?B?UGF3ZcWC?= Staszewski To: Cong Wang Return-path: Received: from mail-wr0-f179.google.com ([209.85.128.179]:35963 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753546AbeBLPvE (ORCPT ); Mon, 12 Feb 2018 10:51:04 -0500 Received: by mail-wr0-f179.google.com with SMTP id y3so15684991wrh.3 for ; Mon, 12 Feb 2018 07:51:04 -0800 (PST) Content-Disposition: inline In-Reply-To: <20180212153216.GB2153@nanopsycho> Sender: netdev-owner@vger.kernel.org List-ID: Mon, Feb 12, 2018 at 04:32:16PM CET, jiri@resnulli.us wrote: >Sat, Feb 10, 2018 at 09:41:57PM CET, xiyou.wangcong@gmail.com wrote: > >[...] > >>>>@@ -348,7 +340,7 @@ static struct tc_u_common *tc_u_common_find(const >>>>struct tcf_proto *tp) >>>> >>>> h = tc_u_hash(tp); >>>> hlist_for_each_entry(tc, &tc_u_common_hash[h], hnode) { >>>>- if (tc->block == tp->chain->block) >>>>+ if (tc->block->q == tp->chain->block->q) >>> >>> :O I don't get it. tc->block is pointer, tc->block->q is pointer. And >>> they are different at the same time for non-shared block. >> >>If you look into Pawel's script, a new block is created for each class >>therefore a different tc_u_common is created which causes the >>ht 9:22 can't be found. > >But wait. Originally this code looked like this: >static unsigned int tc_u_hash(const struct tcf_proto *tp) >{ > struct net_device *dev = tp->q->dev_queue->dev; > u32 qhandle = tp->q->handle; > int ifindex = dev->ifindex; > > return hash_64((u64)ifindex << 32 | qhandle, U32_HASH_SHIFT); >} > >static struct tc_u_common *tc_u_common_find(const struct tcf_proto *tp) >{ > struct tc_u_common *tc; > unsigned int h; > > h = tc_u_hash(tp); > hlist_for_each_entry(tc, &tc_u_common_hash[h], hnode) { > if (tc->q == tp->q) > return tc; > } > return NULL; >} > >That means that tc_u_common is identified according to tp->q. And that >is different for every class. How that could work? I'm properly confused. Okay, now I see what is wrong. I wrongly assumed 1:1 block:q. Will fix.