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
Kirill Smelkov
linux
Commits
d56dc016
Commit
d56dc016
authored
Mar 23, 2004
by
Dmitry Torokhov
Committed by
David S. Miller
Mar 23, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET_SCHED]: Trailing whitespace cleanup in TBF qdisc.
parent
85b86d74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
34 deletions
+34
-34
net/sched/sch_tbf.c
net/sched/sch_tbf.c
+34
-34
No files found.
net/sched/sch_tbf.c
View file @
d56dc016
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
Algorithm.
Algorithm.
----------
----------
Let N(t_i) be B/R initially and N(t) grow continuously with time as:
Let N(t_i) be B/R initially and N(t) grow continuously with time as:
N(t+delta) = min{B/R, N(t) + delta}
N(t+delta) = min{B/R, N(t) + delta}
...
@@ -146,15 +146,15 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
...
@@ -146,15 +146,15 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
if
(
sch
->
reshape_fail
==
NULL
||
sch
->
reshape_fail
(
skb
,
sch
))
if
(
sch
->
reshape_fail
==
NULL
||
sch
->
reshape_fail
(
skb
,
sch
))
#endif
#endif
kfree_skb
(
skb
);
kfree_skb
(
skb
);
return
NET_XMIT_DROP
;
return
NET_XMIT_DROP
;
}
}
if
((
ret
=
q
->
qdisc
->
enqueue
(
skb
,
q
->
qdisc
))
!=
0
)
{
if
((
ret
=
q
->
qdisc
->
enqueue
(
skb
,
q
->
qdisc
))
!=
0
)
{
sch
->
stats
.
drops
++
;
sch
->
stats
.
drops
++
;
return
ret
;
return
ret
;
}
}
sch
->
q
.
qlen
++
;
sch
->
q
.
qlen
++
;
sch
->
stats
.
bytes
+=
skb
->
len
;
sch
->
stats
.
bytes
+=
skb
->
len
;
sch
->
stats
.
packets
++
;
sch
->
stats
.
packets
++
;
...
@@ -165,10 +165,10 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
...
@@ -165,10 +165,10 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
{
{
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
int
ret
;
int
ret
;
if
((
ret
=
q
->
qdisc
->
ops
->
requeue
(
skb
,
q
->
qdisc
))
==
0
)
if
((
ret
=
q
->
qdisc
->
ops
->
requeue
(
skb
,
q
->
qdisc
))
==
0
)
sch
->
q
.
qlen
++
;
sch
->
q
.
qlen
++
;
return
ret
;
return
ret
;
}
}
...
@@ -176,7 +176,7 @@ static unsigned int tbf_drop(struct Qdisc* sch)
...
@@ -176,7 +176,7 @@ static unsigned int tbf_drop(struct Qdisc* sch)
{
{
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
unsigned
int
len
;
unsigned
int
len
;
if
((
len
=
q
->
qdisc
->
ops
->
drop
(
q
->
qdisc
))
!=
0
)
{
if
((
len
=
q
->
qdisc
->
ops
->
drop
(
q
->
qdisc
))
!=
0
)
{
sch
->
q
.
qlen
--
;
sch
->
q
.
qlen
--
;
sch
->
stats
.
drops
++
;
sch
->
stats
.
drops
++
;
...
@@ -196,7 +196,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
...
@@ -196,7 +196,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
{
{
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
skb
=
q
->
qdisc
->
dequeue
(
q
->
qdisc
);
skb
=
q
->
qdisc
->
dequeue
(
q
->
qdisc
);
if
(
skb
)
{
if
(
skb
)
{
...
@@ -204,7 +204,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
...
@@ -204,7 +204,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
long
toks
;
long
toks
;
long
ptoks
=
0
;
long
ptoks
=
0
;
unsigned
int
len
=
skb
->
len
;
unsigned
int
len
=
skb
->
len
;
PSCHED_GET_TIME
(
now
);
PSCHED_GET_TIME
(
now
);
toks
=
PSCHED_TDIFF_SAFE
(
now
,
q
->
t_c
,
q
->
buffer
,
0
);
toks
=
PSCHED_TDIFF_SAFE
(
now
,
q
->
t_c
,
q
->
buffer
,
0
);
...
@@ -248,13 +248,13 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
...
@@ -248,13 +248,13 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
This is the main idea of all FQ algorithms
This is the main idea of all FQ algorithms
(cf. CSZ, HPFQ, HFSC)
(cf. CSZ, HPFQ, HFSC)
*/
*/
if
(
q
->
qdisc
->
ops
->
requeue
(
skb
,
q
->
qdisc
)
!=
NET_XMIT_SUCCESS
)
{
if
(
q
->
qdisc
->
ops
->
requeue
(
skb
,
q
->
qdisc
)
!=
NET_XMIT_SUCCESS
)
{
/* When requeue fails skb is dropped */
/* When requeue fails skb is dropped */
sch
->
q
.
qlen
--
;
sch
->
q
.
qlen
--
;
sch
->
stats
.
drops
++
;
sch
->
stats
.
drops
++
;
}
}
sch
->
flags
|=
TCQ_F_THROTTLED
;
sch
->
flags
|=
TCQ_F_THROTTLED
;
sch
->
stats
.
overlimits
++
;
sch
->
stats
.
overlimits
++
;
}
}
...
@@ -279,24 +279,24 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit)
...
@@ -279,24 +279,24 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit)
struct
Qdisc
*
q
=
qdisc_create_dflt
(
dev
,
&
bfifo_qdisc_ops
);
struct
Qdisc
*
q
=
qdisc_create_dflt
(
dev
,
&
bfifo_qdisc_ops
);
struct
rtattr
*
rta
;
struct
rtattr
*
rta
;
int
ret
;
int
ret
;
if
(
q
)
{
if
(
q
)
{
rta
=
kmalloc
(
RTA_LENGTH
(
sizeof
(
struct
tc_fifo_qopt
)),
GFP_KERNEL
);
rta
=
kmalloc
(
RTA_LENGTH
(
sizeof
(
struct
tc_fifo_qopt
)),
GFP_KERNEL
);
if
(
rta
)
{
if
(
rta
)
{
rta
->
rta_type
=
RTM_NEWQDISC
;
rta
->
rta_type
=
RTM_NEWQDISC
;
rta
->
rta_len
=
RTA_LENGTH
(
sizeof
(
struct
tc_fifo_qopt
));
rta
->
rta_len
=
RTA_LENGTH
(
sizeof
(
struct
tc_fifo_qopt
));
((
struct
tc_fifo_qopt
*
)
RTA_DATA
(
rta
))
->
limit
=
limit
;
((
struct
tc_fifo_qopt
*
)
RTA_DATA
(
rta
))
->
limit
=
limit
;
ret
=
q
->
ops
->
change
(
q
,
rta
);
ret
=
q
->
ops
->
change
(
q
,
rta
);
kfree
(
rta
);
kfree
(
rta
);
if
(
ret
==
0
)
if
(
ret
==
0
)
return
q
;
return
q
;
}
}
qdisc_destroy
(
q
);
qdisc_destroy
(
q
);
}
}
return
NULL
;
return
NULL
;
}
}
static
int
tbf_change
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
static
int
tbf_change
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
...
@@ -340,7 +340,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
...
@@ -340,7 +340,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
}
}
if
(
max_size
<
0
)
if
(
max_size
<
0
)
goto
done
;
goto
done
;
if
(
q
->
qdisc
==
&
noop_qdisc
)
{
if
(
q
->
qdisc
==
&
noop_qdisc
)
{
if
((
child
=
tbf_create_dflt_qdisc
(
sch
->
dev
,
qopt
->
limit
))
==
NULL
)
if
((
child
=
tbf_create_dflt_qdisc
(
sch
->
dev
,
qopt
->
limit
))
==
NULL
)
goto
done
;
goto
done
;
...
@@ -369,17 +369,17 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
...
@@ -369,17 +369,17 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
static
int
tbf_init
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
static
int
tbf_init
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
{
{
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
if
(
opt
==
NULL
)
if
(
opt
==
NULL
)
return
-
EINVAL
;
return
-
EINVAL
;
PSCHED_GET_TIME
(
q
->
t_c
);
PSCHED_GET_TIME
(
q
->
t_c
);
init_timer
(
&
q
->
wd_timer
);
init_timer
(
&
q
->
wd_timer
);
q
->
wd_timer
.
function
=
tbf_watchdog
;
q
->
wd_timer
.
function
=
tbf_watchdog
;
q
->
wd_timer
.
data
=
(
unsigned
long
)
sch
;
q
->
wd_timer
.
data
=
(
unsigned
long
)
sch
;
q
->
qdisc
=
&
noop_qdisc
;
q
->
qdisc
=
&
noop_qdisc
;
return
tbf_change
(
sch
,
opt
);
return
tbf_change
(
sch
,
opt
);
}
}
...
@@ -393,7 +393,7 @@ static void tbf_destroy(struct Qdisc *sch)
...
@@ -393,7 +393,7 @@ static void tbf_destroy(struct Qdisc *sch)
qdisc_put_rtab
(
q
->
P_tab
);
qdisc_put_rtab
(
q
->
P_tab
);
if
(
q
->
R_tab
)
if
(
q
->
R_tab
)
qdisc_put_rtab
(
q
->
R_tab
);
qdisc_put_rtab
(
q
->
R_tab
);
qdisc_destroy
(
q
->
qdisc
);
qdisc_destroy
(
q
->
qdisc
);
q
->
qdisc
=
&
noop_qdisc
;
q
->
qdisc
=
&
noop_qdisc
;
}
}
...
@@ -404,10 +404,10 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
...
@@ -404,10 +404,10 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
unsigned
char
*
b
=
skb
->
tail
;
unsigned
char
*
b
=
skb
->
tail
;
struct
rtattr
*
rta
;
struct
rtattr
*
rta
;
struct
tc_tbf_qopt
opt
;
struct
tc_tbf_qopt
opt
;
rta
=
(
struct
rtattr
*
)
b
;
rta
=
(
struct
rtattr
*
)
b
;
RTA_PUT
(
skb
,
TCA_OPTIONS
,
0
,
NULL
);
RTA_PUT
(
skb
,
TCA_OPTIONS
,
0
,
NULL
);
opt
.
limit
=
q
->
limit
;
opt
.
limit
=
q
->
limit
;
opt
.
rate
=
q
->
R_tab
->
rate
;
opt
.
rate
=
q
->
R_tab
->
rate
;
if
(
q
->
P_tab
)
if
(
q
->
P_tab
)
...
@@ -427,13 +427,13 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
...
@@ -427,13 +427,13 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
}
}
static
int
tbf_dump_class
(
struct
Qdisc
*
sch
,
unsigned
long
cl
,
static
int
tbf_dump_class
(
struct
Qdisc
*
sch
,
unsigned
long
cl
,
struct
sk_buff
*
skb
,
struct
tcmsg
*
tcm
)
struct
sk_buff
*
skb
,
struct
tcmsg
*
tcm
)
{
{
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
struct
tbf_sched_data
*
q
=
(
struct
tbf_sched_data
*
)
sch
->
data
;
if
(
cl
!=
1
)
/* only one class */
if
(
cl
!=
1
)
/* only one class */
return
-
ENOENT
;
return
-
ENOENT
;
tcm
->
tcm_handle
|=
TC_H_MIN
(
1
);
tcm
->
tcm_handle
|=
TC_H_MIN
(
1
);
tcm
->
tcm_info
=
q
->
qdisc
->
handle
;
tcm
->
tcm_info
=
q
->
qdisc
->
handle
;
...
@@ -448,12 +448,12 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
...
@@ -448,12 +448,12 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
if
(
new
==
NULL
)
if
(
new
==
NULL
)
new
=
&
noop_qdisc
;
new
=
&
noop_qdisc
;
sch_tree_lock
(
sch
);
sch_tree_lock
(
sch
);
*
old
=
xchg
(
&
q
->
qdisc
,
new
);
*
old
=
xchg
(
&
q
->
qdisc
,
new
);
qdisc_reset
(
*
old
);
qdisc_reset
(
*
old
);
sch
->
q
.
qlen
=
0
;
sch
->
q
.
qlen
=
0
;
sch_tree_unlock
(
sch
);
sch_tree_unlock
(
sch
);
return
0
;
return
0
;
}
}
...
@@ -473,7 +473,7 @@ static void tbf_put(struct Qdisc *sch, unsigned long arg)
...
@@ -473,7 +473,7 @@ static void tbf_put(struct Qdisc *sch, unsigned long arg)
}
}
static
int
tbf_change_class
(
struct
Qdisc
*
sch
,
u32
classid
,
u32
parentid
,
static
int
tbf_change_class
(
struct
Qdisc
*
sch
,
u32
classid
,
u32
parentid
,
struct
rtattr
**
tca
,
unsigned
long
*
arg
)
struct
rtattr
**
tca
,
unsigned
long
*
arg
)
{
{
return
-
ENOSYS
;
return
-
ENOSYS
;
}
}
...
@@ -497,7 +497,7 @@ static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
...
@@ -497,7 +497,7 @@ static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
static
struct
Qdisc_class_ops
tbf_class_ops
=
static
struct
Qdisc_class_ops
tbf_class_ops
=
{
{
.
graft
=
tbf_graft
,
.
graft
=
tbf_graft
,
.
leaf
=
tbf_leaf
,
.
leaf
=
tbf_leaf
,
.
get
=
tbf_get
,
.
get
=
tbf_get
,
.
put
=
tbf_put
,
.
put
=
tbf_put
,
...
@@ -529,7 +529,7 @@ static int __init tbf_module_init(void)
...
@@ -529,7 +529,7 @@ static int __init tbf_module_init(void)
return
register_qdisc
(
&
tbf_qdisc_ops
);
return
register_qdisc
(
&
tbf_qdisc_ops
);
}
}
static
void
__exit
tbf_module_exit
(
void
)
static
void
__exit
tbf_module_exit
(
void
)
{
{
unregister_qdisc
(
&
tbf_qdisc_ops
);
unregister_qdisc
(
&
tbf_qdisc_ops
);
}
}
...
...
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