Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
9b5d073a
Commit
9b5d073a
authored
Jan 19, 2005
by
Patrick McHardy
Browse files
Options
Browse Files
Download
Plain Diff
Merge coreworks.de:/home/kaber/src/bk-repos/net-2.6
into coreworks.de:/home/kaber/src/net/net-2.6-sched
parents
b43db25d
7ca60095
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
200 deletions
+110
-200
net/sched/cls_api.c
net/sched/cls_api.c
+3
-1
net/sched/cls_route.c
net/sched/cls_route.c
+16
-16
net/sched/cls_rsvp.h
net/sched/cls_rsvp.h
+8
-8
net/sched/sch_cbq.c
net/sched/sch_cbq.c
+26
-53
net/sched/sch_hfsc.c
net/sched/sch_hfsc.c
+11
-34
net/sched/sch_htb.c
net/sched/sch_htb.c
+16
-44
net/sched/sch_prio.c
net/sched/sch_prio.c
+30
-44
No files found.
net/sched/cls_api.c
View file @
9b5d073a
...
@@ -239,8 +239,10 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
...
@@ -239,8 +239,10 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
* replay the request. We indicate this using
* replay the request. We indicate this using
* -EAGAIN.
* -EAGAIN.
*/
*/
if
(
tp_ops
!=
NULL
)
if
(
tp_ops
!=
NULL
)
{
module_put
(
tp_ops
->
owner
);
err
=
-
EAGAIN
;
err
=
-
EAGAIN
;
}
}
}
#endif
#endif
kfree
(
tp
);
kfree
(
tp
);
...
...
net/sched/cls_route.c
View file @
9b5d073a
...
@@ -125,20 +125,20 @@ static __inline__ int route4_hash_wild(void)
...
@@ -125,20 +125,20 @@ static __inline__ int route4_hash_wild(void)
return
32
;
return
32
;
}
}
#define ROUTE4_APPLY_RESULT()
\
#define ROUTE4_APPLY_RESULT() \
do
{ \
{ \
*res = f->res; \
*res = f->res; \
if (tcf_exts_is_available(&f->exts)) { \
if (tcf_exts_is_available(&f->exts)) { \
int r = tcf_exts_exec(skb, &f->exts, res); \
int r = tcf_exts_exec(skb, &f->exts, res); \
if (r < 0) { \
if (r < 0) { \
dont_cache = 1; \
dont_cache = 1; \
continue; \
continue; \
} \
} \
return r; \
return r; \
} else if (!dont_cache) \
} else if (!dont_cache) \
route4_set_fastmap(head, id, iif, f); \
route4_set_fastmap(head, id, iif, f); \
return 0; \
return 0; \
} while(0)
}
static
int
route4_classify
(
struct
sk_buff
*
skb
,
struct
tcf_proto
*
tp
,
static
int
route4_classify
(
struct
sk_buff
*
skb
,
struct
tcf_proto
*
tp
,
struct
tcf_result
*
res
)
struct
tcf_result
*
res
)
...
@@ -384,9 +384,9 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
...
@@ -384,9 +384,9 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
id
=
*
(
u32
*
)
RTA_DATA
(
tb
[
TCA_ROUTE4_IIF
-
1
]);
id
=
*
(
u32
*
)
RTA_DATA
(
tb
[
TCA_ROUTE4_IIF
-
1
]);
if
(
id
>
0x7FFF
)
if
(
id
>
0x7FFF
)
goto
errout
;
goto
errout
;
nhandle
=
(
id
|
0x8000
)
<<
16
;
nhandle
|
=
(
id
|
0x8000
)
<<
16
;
}
else
}
else
nhandle
=
0xFFFF
<<
16
;
nhandle
|
=
0xFFFF
<<
16
;
if
(
handle
&&
new
)
{
if
(
handle
&&
new
)
{
nhandle
|=
handle
&
0x7F00
;
nhandle
|=
handle
&
0x7F00
;
...
...
net/sched/cls_rsvp.h
View file @
9b5d073a
...
@@ -123,14 +123,14 @@ static struct tcf_ext_map rsvp_ext_map = {
...
@@ -123,14 +123,14 @@ static struct tcf_ext_map rsvp_ext_map = {
.
action
=
TCA_RSVP_ACT
.
action
=
TCA_RSVP_ACT
};
};
#define RSVP_APPLY_RESULT()
\
#define RSVP_APPLY_RESULT() \
do
{ \
{ \
int r = tcf_exts_exec(skb, &f->exts, res); \
int r = tcf_exts_exec(skb, &f->exts, res); \
if (r < 0) \
if (r < 0) \
continue; \
continue; \
else if (r > 0) \
else if (r > 0) \
return r; \
return r; \
} while(0)
}
static
int
rsvp_classify
(
struct
sk_buff
*
skb
,
struct
tcf_proto
*
tp
,
static
int
rsvp_classify
(
struct
sk_buff
*
skb
,
struct
tcf_proto
*
tp
,
struct
tcf_result
*
res
)
struct
tcf_result
*
res
)
...
...
net/sched/sch_cbq.c
View file @
9b5d073a
...
@@ -241,7 +241,7 @@ cbq_reclassify(struct sk_buff *skb, struct cbq_class *this)
...
@@ -241,7 +241,7 @@ cbq_reclassify(struct sk_buff *skb, struct cbq_class *this)
*/
*/
static
struct
cbq_class
*
static
struct
cbq_class
*
cbq_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
res
)
cbq_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
err
)
{
{
struct
cbq_sched_data
*
q
=
qdisc_priv
(
sch
);
struct
cbq_sched_data
*
q
=
qdisc_priv
(
sch
);
struct
cbq_class
*
head
=
&
q
->
link
;
struct
cbq_class
*
head
=
&
q
->
link
;
...
@@ -255,13 +255,11 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
...
@@ -255,13 +255,11 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
*/
*/
if
(
TC_H_MAJ
(
prio
^
sch
->
handle
)
==
0
&&
if
(
TC_H_MAJ
(
prio
^
sch
->
handle
)
==
0
&&
(
cl
=
cbq_class_lookup
(
q
,
prio
))
!=
NULL
)
(
cl
=
cbq_class_lookup
(
q
,
prio
))
!=
NULL
)
return
cl
;
return
cl
;
*
qerr
=
NET_XMIT_DROP
;
for
(;;)
{
for
(;;)
{
int
result
=
0
;
int
result
=
0
;
#ifdef CONFIG_NET_CLS_ACT
int
terminal
=
0
;
#endif
defmap
=
head
->
defaults
;
defmap
=
head
->
defaults
;
/*
/*
...
@@ -282,27 +280,13 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
...
@@ -282,27 +280,13 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
#ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_ACT
switch
(
result
)
{
switch
(
result
)
{
case
TC_ACT_SHOT
:
/* Stop and kfree */
*
qres
=
NET_XMIT_DROP
;
terminal
=
1
;
break
;
case
TC_ACT_QUEUED
:
case
TC_ACT_QUEUED
:
case
TC_ACT_STOLEN
:
case
TC_ACT_STOLEN
:
terminal
=
1
;
*
qerr
=
NET_XMIT_SUCCESS
;
break
;
case
TC_ACT_SHOT
:
case
TC_ACT_RECLASSIFY
:
/* Things look good */
case
TC_ACT_OK
:
case
TC_ACT_UNSPEC
:
default:
break
;
}
if
(
terminal
)
{
kfree_skb
(
skb
);
return
NULL
;
return
NULL
;
}
}
#else
#elif defined(CONFIG_NET_CLS_POLICE)
#ifdef CONFIG_NET_CLS_POLICE
switch
(
result
)
{
switch
(
result
)
{
case
TC_POLICE_RECLASSIFY
:
case
TC_POLICE_RECLASSIFY
:
return
cbq_reclassify
(
skb
,
cl
);
return
cbq_reclassify
(
skb
,
cl
);
...
@@ -311,7 +295,6 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
...
@@ -311,7 +295,6 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
default:
default:
break
;
break
;
}
}
#endif
#endif
#endif
if
(
cl
->
level
==
0
)
if
(
cl
->
level
==
0
)
return
cl
;
return
cl
;
...
@@ -423,45 +406,35 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
...
@@ -423,45 +406,35 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
{
struct
cbq_sched_data
*
q
=
qdisc_priv
(
sch
);
struct
cbq_sched_data
*
q
=
qdisc_priv
(
sch
);
int
len
=
skb
->
len
;
int
len
=
skb
->
len
;
int
ret
=
NET_XMIT_SUCCESS
;
int
ret
;
struct
cbq_class
*
cl
=
cbq_classify
(
skb
,
sch
,
&
ret
);
struct
cbq_class
*
cl
=
cbq_classify
(
skb
,
sch
,
&
ret
);
#ifdef CONFIG_NET_CLS_POLICE
#ifdef CONFIG_NET_CLS_POLICE
q
->
rx_class
=
cl
;
q
->
rx_class
=
cl
;
#endif
#endif
if
(
cl
)
{
if
(
cl
==
NULL
)
{
#ifdef CONFIG_NET_CLS_POLICE
if
(
ret
==
NET_XMIT_DROP
)
cl
->
q
->
__parent
=
sch
;
sch
->
qstats
.
drops
++
;
#endif
if
((
ret
=
cl
->
q
->
enqueue
(
skb
,
cl
->
q
))
==
NET_XMIT_SUCCESS
)
{
sch
->
q
.
qlen
++
;
sch
->
bstats
.
packets
++
;
sch
->
bstats
.
bytes
+=
len
;
cbq_mark_toplevel
(
q
,
cl
);
if
(
!
cl
->
next_alive
)
cbq_activate_class
(
cl
);
return
ret
;
}
}
#ifndef CONFIG_NET_CLS_ACT
sch
->
qstats
.
drops
++
;
if
(
cl
==
NULL
)
kfree_skb
(
skb
);
kfree_skb
(
skb
);
else
{
return
ret
;
cbq_mark_toplevel
(
q
,
cl
);
cl
->
qstats
.
drops
++
;
}
#else
if
(
NET_XMIT_DROP
==
ret
)
{
sch
->
qstats
.
drops
++
;
}
}
if
(
cl
!=
NULL
)
{
#ifdef CONFIG_NET_CLS_POLICE
cl
->
q
->
__parent
=
sch
;
#endif
if
((
ret
=
cl
->
q
->
enqueue
(
skb
,
cl
->
q
))
==
NET_XMIT_SUCCESS
)
{
sch
->
q
.
qlen
++
;
sch
->
bstats
.
packets
++
;
sch
->
bstats
.
bytes
+=
len
;
cbq_mark_toplevel
(
q
,
cl
);
cbq_mark_toplevel
(
q
,
cl
);
cl
->
qstats
.
drops
++
;
if
(
!
cl
->
next_alive
)
cbq_activate_class
(
cl
);
return
ret
;
}
}
#endif
sch
->
qstats
.
drops
++
;
cbq_mark_toplevel
(
q
,
cl
);
cl
->
qstats
.
drops
++
;
return
ret
;
return
ret
;
}
}
...
...
net/sched/sch_hfsc.c
View file @
9b5d073a
...
@@ -1214,7 +1214,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
...
@@ -1214,7 +1214,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
}
}
static
struct
hfsc_class
*
static
struct
hfsc_class
*
hfsc_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
res
)
hfsc_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
err
)
{
{
struct
hfsc_sched
*
q
=
qdisc_priv
(
sch
);
struct
hfsc_sched
*
q
=
qdisc_priv
(
sch
);
struct
hfsc_class
*
cl
;
struct
hfsc_class
*
cl
;
...
@@ -1227,35 +1227,20 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
...
@@ -1227,35 +1227,20 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
if
(
cl
->
level
==
0
)
if
(
cl
->
level
==
0
)
return
cl
;
return
cl
;
*
qerr
=
NET_XMIT_DROP
;
tcf
=
q
->
root
.
filter_list
;
tcf
=
q
->
root
.
filter_list
;
while
(
tcf
&&
(
result
=
tc_classify
(
skb
,
tcf
,
&
res
))
>=
0
)
{
while
(
tcf
&&
(
result
=
tc_classify
(
skb
,
tcf
,
&
res
))
>=
0
)
{
#ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_ACT
int
terminal
=
0
;
switch
(
result
)
{
switch
(
result
)
{
case
TC_ACT_SHOT
:
*
qres
=
NET_XMIT_DROP
;
terminal
=
1
;
break
;
case
TC_ACT_QUEUED
:
case
TC_ACT_QUEUED
:
case
TC_ACT_STOLEN
:
case
TC_ACT_STOLEN
:
terminal
=
1
;
*
qerr
=
NET_XMIT_SUCCESS
;
break
;
case
TC_ACT_SHOT
:
case
TC_ACT_RECLASSIFY
:
case
TC_ACT_OK
:
case
TC_ACT_UNSPEC
:
default:
break
;
}
if
(
terminal
)
{
kfree_skb
(
skb
);
return
NULL
;
return
NULL
;
}
}
#else
#elif defined(CONFIG_NET_CLS_POLICE)
#ifdef CONFIG_NET_CLS_POLICE
if
(
result
==
TC_POLICE_SHOT
)
if
(
result
==
TC_POLICE_SHOT
)
return
NULL
;
return
NULL
;
#endif
#endif
#endif
if
((
cl
=
(
struct
hfsc_class
*
)
res
.
class
)
==
NULL
)
{
if
((
cl
=
(
struct
hfsc_class
*
)
res
.
class
)
==
NULL
)
{
if
((
cl
=
hfsc_find_class
(
res
.
classid
,
sch
))
==
NULL
)
if
((
cl
=
hfsc_find_class
(
res
.
classid
,
sch
))
==
NULL
)
...
@@ -1652,27 +1637,19 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
...
@@ -1652,27 +1637,19 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
static
int
static
int
hfsc_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
hfsc_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
{
{
int
ret
=
NET_XMIT_SUCCESS
;
struct
hfsc_class
*
cl
;
struct
hfsc_class
*
cl
=
hfsc_classify
(
skb
,
sch
,
&
ret
);
unsigned
int
len
;
unsigned
int
len
=
skb
->
len
;
int
err
;
int
err
;
cl
=
hfsc_classify
(
skb
,
sch
,
&
err
);
#ifdef CONFIG_NET_CLS_ACT
if
(
cl
==
NULL
)
{
if
(
cl
==
NULL
)
{
if
(
NET_XMIT_DROP
==
ret
)
{
if
(
err
==
NET_XMIT_DROP
)
sch
->
qstats
.
drops
++
;
sch
->
qstats
.
drops
++
;
}
return
ret
;
}
#else
if
(
cl
==
NULL
)
{
kfree_skb
(
skb
);
kfree_skb
(
skb
);
sch
->
qstats
.
drops
++
;
return
err
;
return
NET_XMIT_DROP
;
}
}
#endif
len
=
skb
->
len
;
err
=
cl
->
qdisc
->
enqueue
(
skb
,
cl
->
qdisc
);
err
=
cl
->
qdisc
->
enqueue
(
skb
,
cl
->
qdisc
);
if
(
unlikely
(
err
!=
NET_XMIT_SUCCESS
))
{
if
(
unlikely
(
err
!=
NET_XMIT_SUCCESS
))
{
cl
->
qstats
.
drops
++
;
cl
->
qstats
.
drops
++
;
...
...
net/sched/sch_htb.c
View file @
9b5d073a
...
@@ -305,7 +305,7 @@ static inline u32 htb_classid(struct htb_class *cl)
...
@@ -305,7 +305,7 @@ static inline u32 htb_classid(struct htb_class *cl)
return
(
cl
&&
cl
!=
HTB_DIRECT
)
?
cl
->
classid
:
TC_H_UNSPEC
;
return
(
cl
&&
cl
!=
HTB_DIRECT
)
?
cl
->
classid
:
TC_H_UNSPEC
;
}
}
static
struct
htb_class
*
htb_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
res
)
static
struct
htb_class
*
htb_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
q
err
)
{
{
struct
htb_sched
*
q
=
qdisc_priv
(
sch
);
struct
htb_sched
*
q
=
qdisc_priv
(
sch
);
struct
htb_class
*
cl
;
struct
htb_class
*
cl
;
...
@@ -321,35 +321,20 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, in
...
@@ -321,35 +321,20 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, in
if
((
cl
=
htb_find
(
skb
->
priority
,
sch
))
!=
NULL
&&
cl
->
level
==
0
)
if
((
cl
=
htb_find
(
skb
->
priority
,
sch
))
!=
NULL
&&
cl
->
level
==
0
)
return
cl
;
return
cl
;
*
qerr
=
NET_XMIT_DROP
;
tcf
=
q
->
filter_list
;
tcf
=
q
->
filter_list
;
while
(
tcf
&&
(
result
=
tc_classify
(
skb
,
tcf
,
&
res
))
>=
0
)
{
while
(
tcf
&&
(
result
=
tc_classify
(
skb
,
tcf
,
&
res
))
>=
0
)
{
#ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_ACT
int
terminal
=
0
;
switch
(
result
)
{
switch
(
result
)
{
case
TC_ACT_SHOT
:
/* Stop and kfree */
*
qres
=
NET_XMIT_DROP
;
terminal
=
1
;
break
;
case
TC_ACT_QUEUED
:
case
TC_ACT_QUEUED
:
case
TC_ACT_STOLEN
:
case
TC_ACT_STOLEN
:
terminal
=
1
;
*
qerr
=
NET_XMIT_SUCCESS
;
break
;
case
TC_ACT_SHOT
:
case
TC_ACT_RECLASSIFY
:
/* Things look good */
case
TC_ACT_OK
:
case
TC_ACT_UNSPEC
:
default:
break
;
}
if
(
terminal
)
{
kfree_skb
(
skb
);
return
NULL
;
return
NULL
;
}
}
#else
#elif defined(CONFIG_NET_CLS_POLICE)
#ifdef CONFIG_NET_CLS_POLICE
if
(
result
==
TC_POLICE_SHOT
)
if
(
result
==
TC_POLICE_SHOT
)
return
NULL
;
return
HTB_DIRECT
;
#endif
#endif
#endif
if
((
cl
=
(
void
*
)
res
.
class
)
==
NULL
)
{
if
((
cl
=
(
void
*
)
res
.
class
)
==
NULL
)
{
if
(
res
.
classid
==
sch
->
handle
)
if
(
res
.
classid
==
sch
->
handle
)
...
@@ -723,37 +708,24 @@ htb_deactivate(struct htb_sched *q,struct htb_class *cl)
...
@@ -723,37 +708,24 @@ htb_deactivate(struct htb_sched *q,struct htb_class *cl)
static
int
htb_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
static
int
htb_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
{
{
int
ret
=
NET_XMIT_SUCCESS
;
int
ret
;
struct
htb_sched
*
q
=
qdisc_priv
(
sch
);
struct
htb_sched
*
q
=
qdisc_priv
(
sch
);
struct
htb_class
*
cl
=
htb_classify
(
skb
,
sch
,
&
ret
);
struct
htb_class
*
cl
=
htb_classify
(
skb
,
sch
,
&
ret
);
if
(
cl
==
HTB_DIRECT
)
{
#ifdef CONFIG_NET_CLS_ACT
if
(
cl
==
HTB_DIRECT
)
{
if
(
q
->
direct_queue
.
qlen
<
q
->
direct_qlen
)
{
__skb_queue_tail
(
&
q
->
direct_queue
,
skb
);
q
->
direct_pkts
++
;
}
}
else
if
(
!
cl
)
{
if
(
NET_XMIT_DROP
==
ret
)
{
sch
->
qstats
.
drops
++
;
}
return
ret
;
}
#else
if
(
cl
==
HTB_DIRECT
||
!
cl
)
{
/* enqueue to helper queue */
/* enqueue to helper queue */
if
(
q
->
direct_queue
.
qlen
<
q
->
direct_qlen
&&
cl
)
{
if
(
q
->
direct_queue
.
qlen
<
q
->
direct_qlen
)
{
__skb_queue_tail
(
&
q
->
direct_queue
,
skb
);
__skb_queue_tail
(
&
q
->
direct_queue
,
skb
);
q
->
direct_pkts
++
;
q
->
direct_pkts
++
;
}
else
{
kfree_skb
(
skb
);
sch
->
qstats
.
drops
++
;
return
NET_XMIT_DROP
;
}
}
}
#ifdef CONFIG_NET_CLS_ACT
}
else
if
(
!
cl
)
{
if
(
ret
==
NET_XMIT_DROP
)
sch
->
qstats
.
drops
++
;
kfree_skb
(
skb
);
return
ret
;
#endif
#endif
else
if
(
cl
->
un
.
leaf
.
q
->
enqueue
(
skb
,
cl
->
un
.
leaf
.
q
)
!=
NET_XMIT_SUCCESS
)
{
}
else
if
(
cl
->
un
.
leaf
.
q
->
enqueue
(
skb
,
cl
->
un
.
leaf
.
q
)
!=
NET_XMIT_SUCCESS
)
{
sch
->
qstats
.
drops
++
;
sch
->
qstats
.
drops
++
;
cl
->
qstats
.
drops
++
;
cl
->
qstats
.
drops
++
;
return
NET_XMIT_DROP
;
return
NET_XMIT_DROP
;
...
...
net/sched/sch_prio.c
View file @
9b5d073a
...
@@ -47,37 +47,23 @@ struct prio_sched_data
...
@@ -47,37 +47,23 @@ struct prio_sched_data
};
};
static
struct
Qdisc
*
prio_classify
(
struct
sk_buff
*
skb
,
static
struct
Qdisc
*
struct
Qdisc
*
sch
,
int
*
r
)
prio_classify
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
,
int
*
qer
r
)
{
{
struct
prio_sched_data
*
q
=
qdisc_priv
(
sch
);
struct
prio_sched_data
*
q
=
qdisc_priv
(
sch
);
u32
band
=
skb
->
priority
;
u32
band
=
skb
->
priority
;
struct
tcf_result
res
;
struct
tcf_result
res
;
*
qerr
=
NET_XMIT_DROP
;
if
(
TC_H_MAJ
(
skb
->
priority
)
!=
sch
->
handle
)
{
if
(
TC_H_MAJ
(
skb
->
priority
)
!=
sch
->
handle
)
{
#ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_ACT
int
result
=
0
,
terminal
=
0
;
switch
(
tc_classify
(
skb
,
q
->
filter_list
,
&
res
))
{
result
=
tc_classify
(
skb
,
q
->
filter_list
,
&
res
);
case
TC_ACT_STOLEN
:
case
TC_ACT_QUEUED
:
switch
(
result
)
{
*
qerr
=
NET_XMIT_SUCCESS
;
case
TC_ACT_SHOT
:
case
TC_ACT_SHOT
:
*
r
=
NET_XMIT_DROP
;
terminal
=
1
;
break
;
case
TC_ACT_STOLEN
:
case
TC_ACT_QUEUED
:
terminal
=
1
;
break
;
case
TC_ACT_RECLASSIFY
:
case
TC_ACT_OK
:
case
TC_ACT_UNSPEC
:
default:
break
;
};
if
(
terminal
)
{
kfree_skb
(
skb
);
return
NULL
;
return
NULL
;
}
}
;
if
(
!
q
->
filter_list
)
{
if
(
!
q
->
filter_list
)
{
#else
#else
...
@@ -97,15 +83,20 @@ static struct Qdisc *prio_classify(struct sk_buff *skb,
...
@@ -97,15 +83,20 @@ static struct Qdisc *prio_classify(struct sk_buff *skb,
}
}
static
int
static
int
prio_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
prio_enqueue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
{
{
struct
Qdisc
*
qdisc
;
struct
Qdisc
*
qdisc
;
int
ret
=
NET_XMIT_SUCCESS
;
int
ret
;
qdisc
=
prio_classify
(
skb
,
sch
,
&
ret
);
qdisc
=
prio_classify
(
skb
,
sch
,
&
ret
);
#ifdef CONFIG_NET_CLS_ACT
if
(
NULL
==
qdisc
)
if
(
qdisc
==
NULL
)
{
goto
dropped
;
if
(
ret
==
NET_XMIT_DROP
)
sch
->
qstats
.
drops
++
;
kfree_skb
(
skb
);
return
ret
;
}
#endif
if
((
ret
=
qdisc
->
enqueue
(
skb
,
qdisc
))
==
NET_XMIT_SUCCESS
)
{
if
((
ret
=
qdisc
->
enqueue
(
skb
,
qdisc
))
==
NET_XMIT_SUCCESS
)
{
sch
->
bstats
.
bytes
+=
skb
->
len
;
sch
->
bstats
.
bytes
+=
skb
->
len
;
...
@@ -113,17 +104,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc* sch)
...
@@ -113,17 +104,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc* sch)
sch
->
q
.
qlen
++
;
sch
->
q
.
qlen
++
;
return
NET_XMIT_SUCCESS
;
return
NET_XMIT_SUCCESS
;
}
}
sch
->
qstats
.
drops
++
;
dropped:
#ifdef CONFIG_NET_CLS_ACT
if
(
NET_XMIT_DROP
==
ret
)
{
#endif
sch
->
qstats
.
drops
++
;
#ifdef CONFIG_NET_CLS_ACT
}
else
{
sch
->
qstats
.
overlimits
++
;
/* abuse, but noone uses it */
}
#endif
return
ret
;
return
ret
;
}
}
...
@@ -132,18 +113,23 @@ static int
...
@@ -132,18 +113,23 @@ static int
prio_requeue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
prio_requeue
(
struct
sk_buff
*
skb
,
struct
Qdisc
*
sch
)
{
{
struct
Qdisc
*
qdisc
;
struct
Qdisc
*
qdisc
;
int
ret
=
NET_XMIT_DROP
;
int
ret
;
qdisc
=
prio_classify
(
skb
,
sch
,
&
ret
);
qdisc
=
prio_classify
(
skb
,
sch
,
&
ret
);
if
(
qdisc
==
NULL
)
#ifdef CONFIG_NET_CLS_ACT
goto
dropped
;
if
(
qdisc
==
NULL
)
{
if
(
ret
==
NET_XMIT_DROP
)
sch
->
qstats
.
drops
++
;
kfree_skb
(
skb
);
return
ret
;
}
#endif
if
((
ret
=
qdisc
->
ops
->
requeue
(
skb
,
qdisc
))
==
0
)
{
if
((
ret
=
qdisc
->
ops
->
requeue
(
skb
,
qdisc
))
==
NET_XMIT_SUCCESS
)
{
sch
->
q
.
qlen
++
;
sch
->
q
.
qlen
++
;
sch
->
qstats
.
requeues
++
;
sch
->
qstats
.
requeues
++
;
return
0
;
return
0
;
}
}
dropped:
sch
->
qstats
.
drops
++
;
sch
->
qstats
.
drops
++
;
return
NET_XMIT_DROP
;
return
NET_XMIT_DROP
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment