netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@ilport.com.ua>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	kuznet@ms2.inr.ac.ru, "David S. Miller" <davem@davemloft.net>
Subject: tcf_generic_walker(): what's going on?
Date: Thu, 6 Apr 2006 09:11:00 +0300	[thread overview]
Message-ID: <200604060911.01140.vda@ilport.com.ua> (raw)

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

             reply	other threads:[~2006-04-06  6:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06  6:11 Denis Vlasenko [this message]
2006-04-06  8:50 ` tcf_generic_walker(): what's going on? Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604060911.01140.vda@ilport.com.ua \
    --to=vda@ilport.com.ua \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).