Sat, Feb 10, 2018 at 09:41:57PM CET, xiyou.wangc...@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.