tcf_generic_walker(): what's going on?

From: Denis Vlasenko
Date: Thu Apr 06 2006 - 02:28:08 EST


While hunting down oversized inlines
I stumbled on tcf_generic_walker().

It is defined in two separate files:
once as an inline in include/net/pkt_act.h
(really big one, ~750 bytes of code)
and once as a static function in net/sched/act_police.c

These two instances are not identical.
Second one has one extra parameter (int type)
and it uses it like this:

for (i = 0; i < MY_TAB_SIZE; i++) {
p = tcf_police_ht[tcf_police_hash(i)];

for (; p; p = p->next) {
index++;
if (index < s_i)
continue;
a->priv = p;
a->order = index;
r = (struct rtattr*) skb->tail;
RTA_PUT(skb, a->order, 0, NULL);
+ if (type == RTM_DELACTION)
+ err = tcf_action_dump_1(skb, a, 0, 1);
+ else
+ err = tcf_action_dump_1(skb, a, 0, 0);

Having two functions with same name is rather confusing.
Worse, they are both are called via five different
tc_action_ops structs:

static struct tc_action_ops act_ipt_ops = {
...
.walk = tcf_generic_walker

and I fail to understand how it is supposed to work,
considering the fact that these two tcf_generic_walker's
have different prototypes.

1) What should I do with tcf_generic_walker?
2) Should I deinline huge inlines in include/net/pkt_act.h?
If yes, to which .c file should I move them?
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/