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
a814cf52
Commit
a814cf52
authored
Apr 29, 2003
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o net/sched: some trivial code cleanups, making some code smaller
Smaller by not calling write_unlock two times.
parent
aee01ebf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
43 deletions
+40
-43
net/sched/cls_api.c
net/sched/cls_api.c
+16
-18
net/sched/cls_fw.c
net/sched/cls_fw.c
+2
-1
net/sched/cls_u32.c
net/sched/cls_u32.c
+5
-5
net/sched/sch_api.c
net/sched/sch_api.c
+8
-8
net/sched/sch_ingress.c
net/sched/sch_ingress.c
+9
-11
No files found.
net/sched/cls_api.c
View file @
a814cf52
...
...
@@ -65,37 +65,38 @@ struct tcf_proto_ops * tcf_proto_lookup_ops(struct rtattr *kind)
int
register_tcf_proto_ops
(
struct
tcf_proto_ops
*
ops
)
{
struct
tcf_proto_ops
*
t
,
**
tp
;
int
rc
=
-
EEXIST
;
write_lock
(
&
cls_mod_lock
);
for
(
tp
=
&
tcf_proto_base
;
(
t
=*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
{
if
(
strcmp
(
ops
->
kind
,
t
->
kind
)
==
0
)
{
write_unlock
(
&
cls_mod_lock
);
return
-
EEXIST
;
}
}
for
(
tp
=
&
tcf_proto_base
;
(
t
=
*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
if
(
!
strcmp
(
ops
->
kind
,
t
->
kind
))
goto
out
;
ops
->
next
=
NULL
;
*
tp
=
ops
;
rc
=
0
;
out:
write_unlock
(
&
cls_mod_lock
);
return
0
;
return
rc
;
}
int
unregister_tcf_proto_ops
(
struct
tcf_proto_ops
*
ops
)
{
struct
tcf_proto_ops
*
t
,
**
tp
;
int
rc
=
-
ENOENT
;
write_lock
(
&
cls_mod_lock
);
for
(
tp
=
&
tcf_proto_base
;
(
t
=*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
if
(
t
==
ops
)
break
;
if
(
!
t
)
{
write_unlock
(
&
cls_mod_lock
);
return
-
ENOENT
;
}
if
(
!
t
)
goto
out
;
*
tp
=
t
->
next
;
rc
=
0
;
out:
write_unlock
(
&
cls_mod_lock
);
return
0
;
return
rc
;
}
static
int
tfilter_notify
(
struct
sk_buff
*
oskb
,
struct
nlmsghdr
*
n
,
...
...
@@ -371,11 +372,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
q
=
dev
->
qdisc_sleeping
;
else
q
=
qdisc_lookup
(
dev
,
TC_H_MAJ
(
tcm
->
tcm_parent
));
if
(
q
==
NULL
)
{
read_unlock
(
&
qdisc_tree_lock
);
dev_put
(
dev
);
return
skb
->
len
;
}
if
(
!
q
)
goto
out
;
if
((
cops
=
q
->
ops
->
cl_ops
)
==
NULL
)
goto
errout
;
if
(
TC_H_MIN
(
tcm
->
tcm_parent
))
{
...
...
@@ -425,7 +423,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
errout:
if
(
cl
)
cops
->
put
(
q
,
cl
);
out:
read_unlock
(
&
qdisc_tree_lock
);
dev_put
(
dev
);
return
skb
->
len
;
...
...
net/sched/cls_fw.c
View file @
a814cf52
...
...
@@ -152,7 +152,7 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
struct
fw_filter
**
fp
;
if
(
head
==
NULL
||
f
==
NULL
)
return
-
EINVAL
;
goto
out
;
for
(
fp
=&
head
->
ht
[
fw_hash
(
f
->
id
)];
*
fp
;
fp
=
&
(
*
fp
)
->
next
)
{
if
(
*
fp
==
f
)
{
...
...
@@ -171,6 +171,7 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
return
0
;
}
}
out:
return
-
EINVAL
;
}
...
...
net/sched/cls_u32.c
View file @
a814cf52
...
...
@@ -203,17 +203,17 @@ static __inline__ struct tc_u_knode *
u32_lookup_key
(
struct
tc_u_hnode
*
ht
,
u32
handle
)
{
unsigned
sel
;
struct
tc_u_knode
*
n
;
struct
tc_u_knode
*
n
=
NULL
;
sel
=
TC_U32_HASH
(
handle
);
if
(
sel
>
ht
->
divisor
)
return
0
;
goto
out
;
for
(
n
=
ht
->
ht
[
sel
];
n
;
n
=
n
->
next
)
if
(
n
->
handle
==
handle
)
return
n
;
return
NULL
;
break
;
out:
return
n
;
}
...
...
net/sched/sch_api.c
View file @
a814cf52
...
...
@@ -139,21 +139,19 @@ static rwlock_t qdisc_mod_lock = RW_LOCK_UNLOCKED;
/* The list of all installed queueing disciplines. */
static
struct
Qdisc_ops
*
qdisc_base
=
NULL
;
static
struct
Qdisc_ops
*
qdisc_base
;
/* Register/uregister queueing discipline */
int
register_qdisc
(
struct
Qdisc_ops
*
qops
)
{
struct
Qdisc_ops
*
q
,
**
qp
;
int
rc
=
-
EEXIST
;
write_lock
(
&
qdisc_mod_lock
);
for
(
qp
=
&
qdisc_base
;
(
q
=*
qp
)
!=
NULL
;
qp
=
&
q
->
next
)
{
if
(
strcmp
(
qops
->
id
,
q
->
id
)
==
0
)
{
write_unlock
(
&
qdisc_mod_lock
);
return
-
EEXIST
;
}
}
for
(
qp
=
&
qdisc_base
;
(
q
=
*
qp
)
!=
NULL
;
qp
=
&
q
->
next
)
if
(
!
strcmp
(
qops
->
id
,
q
->
id
))
goto
out
;
if
(
qops
->
enqueue
==
NULL
)
qops
->
enqueue
=
noop_qdisc_ops
.
enqueue
;
...
...
@@ -164,8 +162,10 @@ int register_qdisc(struct Qdisc_ops *qops)
qops
->
next
=
NULL
;
*
qp
=
qops
;
rc
=
0
;
out:
write_unlock
(
&
qdisc_mod_lock
);
return
0
;
return
rc
;
}
int
unregister_qdisc
(
struct
Qdisc_ops
*
qops
)
...
...
net/sched/sch_ingress.c
View file @
a814cf52
...
...
@@ -45,7 +45,7 @@
/* Thanks to Doron Oz for this hack
*/
static
int
nf_registered
=
0
;
static
int
nf_registered
;
struct
ingress_qdisc_data
{
struct
Qdisc
*
q
;
...
...
@@ -237,15 +237,13 @@ used on the egress (might slow things for an iota)
}
/* after ipt_filter */
static
struct
nf_hook_ops
ing_ops
=
{
{
NULL
,
NULL
},
ing_hook
,
THIS_MODULE
,
PF_INET
,
NF_IP_PRE_ROUTING
,
NF_IP_PRI_FILTER
+
1
};
static
struct
nf_hook_ops
ing_ops
=
{
.
hook
=
ing_hook
,
.
owner
=
THIS_MODULE
,
.
pf
=
PF_INET
,
.
hooknum
=
NF_IP_PRE_ROUTING
,
.
priority
=
NF_IP_PRI_FILTER
+
1
,
}
int
ingress_init
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
{
...
...
@@ -255,7 +253,7 @@ int ingress_init(struct Qdisc *sch,struct rtattr *opt)
if
(
nf_register_hook
(
&
ing_ops
)
<
0
)
{
printk
(
"ingress qdisc registration error
\n
"
);
goto
error
;
}
}
nf_registered
++
;
}
...
...
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