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:32:16 +0100 Message-ID: <20180212153216.GB2153@nanopsycho> References: <9c8f997d-339c-5088-0bb5-124e9f55f02d@itcare.pl> <20180207070148.GA2149@nanopsycho.orion> <20180208073846.GA2041@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-wm0-f50.google.com ([74.125.82.50]:51177 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281AbeBLPcT (ORCPT ); Mon, 12 Feb 2018 10:32:19 -0500 Received: by mail-wm0-f50.google.com with SMTP id f71so10328780wmf.0 for ; Mon, 12 Feb 2018 07:32:18 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: 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.