Skip to contentSkip to conversation

net/sched/: possible cleanups

PATCH Applied Adrian Bunk 5 participants 7 messages Dec 15, 2004 – Dec 28, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/sched/: possible cleanups

The patch below contans the following possible cleanups:
- make some needlessly global code static
- sch_htb.c: #undef HTB_DEBUG

diffstat output:

 include/net/act_api.h   |    3 ---
 net/sched/gact.c        |    2 +-
 net/sched/police.c      |    8 ++++----
 net/sched/sch_api.c     |   11 ++++++-----
 net/sched/sch_dsmark.c  |    2 +-
 net/sched/sch_generic.c |    4 ++--
 net/sched/sch_htb.c     |    2 +-
 net/sched/sch_ingress.c |    2 +-
 net/sched/sch_prio.c    |    3 ++-
 9 files changed, 18 insertions(+), 19 deletions(-)
net/sched/gact.c renamed from net/sched/gact.c.old +1 -1
@@ -68,7 +68,7 @@
 }
 
 
-g_rand gact_rand[MAX_RAND]= { NULL,gact_net_rand, gact_determ};
+static g_rand gact_rand[MAX_RAND]= { NULL,gact_net_rand, gact_determ};
 
 #endif
 static int
include/net/act_api.h renamed from include/net/act_api.h.old +0 -3
@@ -82,9 +82,6 @@
 extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
 extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
 extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *);
-extern int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,struct tc_action *,int , int );
-extern int tcf_act_police_dump(struct sk_buff *, struct tc_action *, int, int);
-extern int tcf_act_police(struct sk_buff **skb, struct tc_action *a);
 #endif /* CONFIG_NET_CLS_ACT */
 
 extern int tcf_police(struct sk_buff *skb, struct tcf_police *p);
net/sched/police.c renamed from net/sched/police.c.old +4 -4
@@ -163,7 +163,7 @@
 }
 
 #ifdef CONFIG_NET_CLS_ACT
-int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,struct tc_action *a, int ovr, int bind)
+static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,struct tc_action *a, int ovr, int bind)
 {
 	unsigned h;
 	int ret = 0;
@@ -265,7 +265,7 @@
 	return -1;
 }
 
-int tcf_act_police_cleanup(struct tc_action *a, int bind)
+static int tcf_act_police_cleanup(struct tc_action *a, int bind)
 {
 	struct tcf_police *p;
 	p = PRIV(a);
@@ -275,7 +275,7 @@
 	return 0;
 }
 
-int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
+static int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
 {
 	psched_time_t now;
 	struct sk_buff *skb = *pskb;
@@ -338,7 +338,7 @@
 	return p->action;
 }
 
-int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
+static int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
 	unsigned char	 *b = skb->tail;
 	struct tc_police opt;
net/sched/sch_api.c renamed from net/sched/sch_api.c.old +6 -5
@@ -207,7 +207,7 @@
 	return NULL;
 }
 
-struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
+static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
 {
 	unsigned long cl;
 	struct Qdisc *leaf;
@@ -226,7 +226,7 @@
 
 /* Find queueing discipline by name */
 
-struct Qdisc_ops *qdisc_lookup_ops(struct rtattr *kind)
+static struct Qdisc_ops *qdisc_lookup_ops(struct rtattr *kind)
 {
 	struct Qdisc_ops *q = NULL;
 
@@ -290,7 +290,7 @@
 
 /* Allocate an unique handle from space managed by kernel */
 
-u32 qdisc_alloc_handle(struct net_device *dev)
+static u32 qdisc_alloc_handle(struct net_device *dev)
 {
 	int i = 0x10000;
 	static u32 autohandle = TC_H_MAKE(0x80000000U, 0);
@@ -356,8 +356,9 @@
    Old qdisc is not destroyed but returned in *old.
  */
 
-int qdisc_graft(struct net_device *dev, struct Qdisc *parent, u32 classid,
-		struct Qdisc *new, struct Qdisc **old)
+static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
+		       u32 classid,
+		       struct Qdisc *new, struct Qdisc **old)
 {
 	int err = 0;
 	struct Qdisc *q = *old;
net/sched/sch_dsmark.c renamed from net/sched/sch_dsmark.c.old +1 -1
@@ -320,7 +320,7 @@
 }
 
 
-int dsmark_init(struct Qdisc *sch,struct rtattr *opt)
+static int dsmark_init(struct Qdisc *sch,struct rtattr *opt)
 {
 	struct dsmark_qdisc_data *p = PRIV(sch);
 	struct rtattr *tb[TCA_DSMARK_MAX];
net/sched/sch_generic.c renamed from net/sched/sch_generic.c.old +2 -2
@@ -283,7 +283,7 @@
 	.list		=	LIST_HEAD_INIT(noop_qdisc.list),
 };
 
-struct Qdisc_ops noqueue_qdisc_ops = {
+static struct Qdisc_ops noqueue_qdisc_ops = {
 	.next		=	NULL,
 	.cl_ops		=	NULL,
 	.id		=	"noqueue",
@@ -294,7 +294,7 @@
 	.owner		=	THIS_MODULE,
 };
 
-struct Qdisc noqueue_qdisc = {
+static struct Qdisc noqueue_qdisc = {
 	.enqueue	=	NULL,
 	.dequeue	=	noop_dequeue,
 	.flags		=	TCQ_F_BUILTIN,
net/sched/sch_ingress.c renamed from net/sched/sch_ingress.c.old +1 -1
@@ -274,7 +274,7 @@
 #endif
 #endif
 
-int ingress_init(struct Qdisc *sch,struct rtattr *opt)
+static int ingress_init(struct Qdisc *sch,struct rtattr *opt)
 {
 	struct ingress_qdisc_data *p = PRIV(sch);
 
net/sched/sch_prio.c renamed from net/sched/sch_prio.c.old +2 -1
@@ -47,7 +47,8 @@
 };
 
 
-struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r)
+static struct Qdisc *prio_classify(struct sk_buff *skb,
+				   struct Qdisc *sch, int *r)
 {
 	struct prio_sched_data *q = qdisc_priv(sch);
 	u32 band = skb->priority;
net/sched/sch_htb.c renamed from net/sched/sch_htb.c.old +1 -1
@@ -71,7 +71,7 @@
 
 #define HTB_HSIZE 16	/* classid hash size */
 #define HTB_EWMAC 2	/* rate average over HTB_EWMAC*HTB_HSIZE sec */
-#define HTB_DEBUG 1	/* compile debugging support (activated by tc tool) */
+#undef HTB_DEBUG	/* compile debugging support (activated by tc tool) */
 #define HTB_RATECM 1    /* whether to use rate computer */
 #define HTB_HYSTERESIS 1/* whether to use mode hysteresis for speedup */
 #define HTB_QLOCK(S) spin_lock_bh(&(S)->dev->queue_lock)
#1 lore raw
Quoted 7 lines · Adrian Bunk

The patch below contans the following possible cleanups:
- make some needlessly global code static
- sch_htb.c: #undef HTB_DEBUG

diffstat output:

 include/net/act_api.h   |    3 ---

Adrian, may I suggest that you post the networking related patches only to netdev?

- Arnaldo

#2 lore raw
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 5 lines · Adrian Bunk

The patch below contans the following possible cleanups:
- make some needlessly global code static
- sch_htb.c: #undef HTB_DEBUG

Quoted 5 lines
Quoted 2 lines

diffstat output:
include/net/act_api.h | 3 ---

Adrian, may I suggest that you post the networking related patches only to netdev?

Until now I thought it's never a bad idea to Cc linux-kernel on any patches. Is there a specific reason why you consider this being a bad thing (well, bandwith shouldn't be that much of an issue considering how high-volume linux-kernel is...)?

Quoted 1 line

- Arnaldo

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
Quoted 9 lines · Adrian Bunk
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 5 lines · Adrian Bunk

The patch below contans the following possible cleanups:
- make some needlessly global code static
- sch_htb.c: #undef HTB_DEBUG

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

diffstat output:
include/net/act_api.h | 3 ---

Adrian, may I suggest that you post the networking related patches only to netdev?

Until now I thought it's never a bad idea to Cc linux-kernel on any patches. Is there a specific reason why you consider this being a bad thing (well, bandwith shouldn't be that much of an issue considering how high-volume linux-kernel is...)?

I mentioned that when making the same request to another person one or two days ago: all the networking hackers I know are subscribed to netdev, several of them aren't subscribed to linux-kernel.

- Arnaldo

#4 lore raw
In reply to Adrian Bunk

* Adrian Bunk <[email protected]> 2004-12-15 02:27

include/net/act_api.h line 87

Quoted 3 lines
include/net/act_api.h renamed from include/net/act_api.h.old +0 -3
-extern int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,struct tc_action *,int , int );
-extern int tcf_act_police_dump(struct sk_buff *, struct tc_action *, int, int);
-extern int tcf_act_police(struct sk_buff **skb, struct tc_action *a);

This looks like a police compat API for action policers but I think it's fine, Jamal?

The other changes all make sense to me.

#5 lore raw

This is fine. The new architecture doesnt require classifiers explicitly call those function. Rest also looks fine to me. Good effort Adrian.

cheers,
jamal

Quoted 11 lines · Thomas Graf

* Adrian Bunk <[email protected]> 2004-12-15 02:27

include/net/act_api.h line 87

Quoted 3 lines
include/net/act_api.h renamed from include/net/act_api.h.old +0 -3
-extern int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,struct tc_action *,int , int );
-extern int tcf_act_police_dump(struct sk_buff *, struct tc_action *, int, int);
-extern int tcf_act_police(struct sk_buff **skb, struct tc_action *a);

This looks like a police compat API for action policers but I think it's fine, Jamal?

The other changes all make sense to me.

maintainer Applied
#6 lore raw
In reply to Adrian Bunk
Quoted 3 lines · On Wed, 15 Dec 2004 02:27:54 +0100 Adrian Bunk <[email protected]> wrote:

The patch below contans the following possible cleanups:
- make some needlessly global code static
- sch_htb.c: #undef HTB_DEBUG

Applied, thanks Adrian.