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
Show 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)
...
@@ -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
)
int
register_tcf_proto_ops
(
struct
tcf_proto_ops
*
ops
)
{
{
struct
tcf_proto_ops
*
t
,
**
tp
;
struct
tcf_proto_ops
*
t
,
**
tp
;
int
rc
=
-
EEXIST
;
write_lock
(
&
cls_mod_lock
);
write_lock
(
&
cls_mod_lock
);
for
(
tp
=
&
tcf_proto_base
;
(
t
=*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
{
for
(
tp
=
&
tcf_proto_base
;
(
t
=
*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
if
(
strcmp
(
ops
->
kind
,
t
->
kind
)
==
0
)
{
if
(
!
strcmp
(
ops
->
kind
,
t
->
kind
))
write_unlock
(
&
cls_mod_lock
);
goto
out
;
return
-
EEXIST
;
}
}
ops
->
next
=
NULL
;
ops
->
next
=
NULL
;
*
tp
=
ops
;
*
tp
=
ops
;
rc
=
0
;
out:
write_unlock
(
&
cls_mod_lock
);
write_unlock
(
&
cls_mod_lock
);
return
0
;
return
rc
;
}
}
int
unregister_tcf_proto_ops
(
struct
tcf_proto_ops
*
ops
)
int
unregister_tcf_proto_ops
(
struct
tcf_proto_ops
*
ops
)
{
{
struct
tcf_proto_ops
*
t
,
**
tp
;
struct
tcf_proto_ops
*
t
,
**
tp
;
int
rc
=
-
ENOENT
;
write_lock
(
&
cls_mod_lock
);
write_lock
(
&
cls_mod_lock
);
for
(
tp
=
&
tcf_proto_base
;
(
t
=*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
for
(
tp
=
&
tcf_proto_base
;
(
t
=*
tp
)
!=
NULL
;
tp
=
&
t
->
next
)
if
(
t
==
ops
)
if
(
t
==
ops
)
break
;
break
;
if
(
!
t
)
{
if
(
!
t
)
write_unlock
(
&
cls_mod_lock
);
goto
out
;
return
-
ENOENT
;
}
*
tp
=
t
->
next
;
*
tp
=
t
->
next
;
rc
=
0
;
out:
write_unlock
(
&
cls_mod_lock
);
write_unlock
(
&
cls_mod_lock
);
return
0
;
return
rc
;
}
}
static
int
tfilter_notify
(
struct
sk_buff
*
oskb
,
struct
nlmsghdr
*
n
,
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)
...
@@ -371,11 +372,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
q
=
dev
->
qdisc_sleeping
;
q
=
dev
->
qdisc_sleeping
;
else
else
q
=
qdisc_lookup
(
dev
,
TC_H_MAJ
(
tcm
->
tcm_parent
));
q
=
qdisc_lookup
(
dev
,
TC_H_MAJ
(
tcm
->
tcm_parent
));
if
(
q
==
NULL
)
{
if
(
!
q
)
read_unlock
(
&
qdisc_tree_lock
);
goto
out
;
dev_put
(
dev
);
return
skb
->
len
;
}
if
((
cops
=
q
->
ops
->
cl_ops
)
==
NULL
)
if
((
cops
=
q
->
ops
->
cl_ops
)
==
NULL
)
goto
errout
;
goto
errout
;
if
(
TC_H_MIN
(
tcm
->
tcm_parent
))
{
if
(
TC_H_MIN
(
tcm
->
tcm_parent
))
{
...
@@ -425,7 +423,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
...
@@ -425,7 +423,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
errout:
errout:
if
(
cl
)
if
(
cl
)
cops
->
put
(
q
,
cl
);
cops
->
put
(
q
,
cl
);
out:
read_unlock
(
&
qdisc_tree_lock
);
read_unlock
(
&
qdisc_tree_lock
);
dev_put
(
dev
);
dev_put
(
dev
);
return
skb
->
len
;
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)
...
@@ -152,7 +152,7 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
struct
fw_filter
**
fp
;
struct
fw_filter
**
fp
;
if
(
head
==
NULL
||
f
==
NULL
)
if
(
head
==
NULL
||
f
==
NULL
)
return
-
EINVAL
;
goto
out
;
for
(
fp
=&
head
->
ht
[
fw_hash
(
f
->
id
)];
*
fp
;
fp
=
&
(
*
fp
)
->
next
)
{
for
(
fp
=&
head
->
ht
[
fw_hash
(
f
->
id
)];
*
fp
;
fp
=
&
(
*
fp
)
->
next
)
{
if
(
*
fp
==
f
)
{
if
(
*
fp
==
f
)
{
...
@@ -171,6 +171,7 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
...
@@ -171,6 +171,7 @@ static int fw_delete(struct tcf_proto *tp, unsigned long arg)
return
0
;
return
0
;
}
}
}
}
out:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
net/sched/cls_u32.c
View file @
a814cf52
...
@@ -203,17 +203,17 @@ static __inline__ struct tc_u_knode *
...
@@ -203,17 +203,17 @@ static __inline__ struct tc_u_knode *
u32_lookup_key
(
struct
tc_u_hnode
*
ht
,
u32
handle
)
u32_lookup_key
(
struct
tc_u_hnode
*
ht
,
u32
handle
)
{
{
unsigned
sel
;
unsigned
sel
;
struct
tc_u_knode
*
n
;
struct
tc_u_knode
*
n
=
NULL
;
sel
=
TC_U32_HASH
(
handle
);
sel
=
TC_U32_HASH
(
handle
);
if
(
sel
>
ht
->
divisor
)
if
(
sel
>
ht
->
divisor
)
return
0
;
goto
out
;
for
(
n
=
ht
->
ht
[
sel
];
n
;
n
=
n
->
next
)
for
(
n
=
ht
->
ht
[
sel
];
n
;
n
=
n
->
next
)
if
(
n
->
handle
==
handle
)
if
(
n
->
handle
==
handle
)
break
;
out:
return
n
;
return
n
;
return
NULL
;
}
}
...
...
net/sched/sch_api.c
View file @
a814cf52
...
@@ -139,21 +139,19 @@ static rwlock_t qdisc_mod_lock = RW_LOCK_UNLOCKED;
...
@@ -139,21 +139,19 @@ static rwlock_t qdisc_mod_lock = RW_LOCK_UNLOCKED;
/* The list of all installed queueing disciplines. */
/* The list of all installed queueing disciplines. */
static
struct
Qdisc_ops
*
qdisc_base
=
NULL
;
static
struct
Qdisc_ops
*
qdisc_base
;
/* Register/uregister queueing discipline */
/* Register/uregister queueing discipline */
int
register_qdisc
(
struct
Qdisc_ops
*
qops
)
int
register_qdisc
(
struct
Qdisc_ops
*
qops
)
{
{
struct
Qdisc_ops
*
q
,
**
qp
;
struct
Qdisc_ops
*
q
,
**
qp
;
int
rc
=
-
EEXIST
;
write_lock
(
&
qdisc_mod_lock
);
write_lock
(
&
qdisc_mod_lock
);
for
(
qp
=
&
qdisc_base
;
(
q
=*
qp
)
!=
NULL
;
qp
=
&
q
->
next
)
{
for
(
qp
=
&
qdisc_base
;
(
q
=
*
qp
)
!=
NULL
;
qp
=
&
q
->
next
)
if
(
strcmp
(
qops
->
id
,
q
->
id
)
==
0
)
{
if
(
!
strcmp
(
qops
->
id
,
q
->
id
))
write_unlock
(
&
qdisc_mod_lock
);
goto
out
;
return
-
EEXIST
;
}
}
if
(
qops
->
enqueue
==
NULL
)
if
(
qops
->
enqueue
==
NULL
)
qops
->
enqueue
=
noop_qdisc_ops
.
enqueue
;
qops
->
enqueue
=
noop_qdisc_ops
.
enqueue
;
...
@@ -164,8 +162,10 @@ int register_qdisc(struct Qdisc_ops *qops)
...
@@ -164,8 +162,10 @@ int register_qdisc(struct Qdisc_ops *qops)
qops
->
next
=
NULL
;
qops
->
next
=
NULL
;
*
qp
=
qops
;
*
qp
=
qops
;
rc
=
0
;
out:
write_unlock
(
&
qdisc_mod_lock
);
write_unlock
(
&
qdisc_mod_lock
);
return
0
;
return
rc
;
}
}
int
unregister_qdisc
(
struct
Qdisc_ops
*
qops
)
int
unregister_qdisc
(
struct
Qdisc_ops
*
qops
)
...
...
net/sched/sch_ingress.c
View file @
a814cf52
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
/* Thanks to Doron Oz for this hack
/* Thanks to Doron Oz for this hack
*/
*/
static
int
nf_registered
=
0
;
static
int
nf_registered
;
struct
ingress_qdisc_data
{
struct
ingress_qdisc_data
{
struct
Qdisc
*
q
;
struct
Qdisc
*
q
;
...
@@ -237,15 +237,13 @@ used on the egress (might slow things for an iota)
...
@@ -237,15 +237,13 @@ used on the egress (might slow things for an iota)
}
}
/* after ipt_filter */
/* after ipt_filter */
static
struct
nf_hook_ops
ing_ops
=
static
struct
nf_hook_ops
ing_ops
=
{
{
.
hook
=
ing_hook
,
{
NULL
,
NULL
},
.
owner
=
THIS_MODULE
,
ing_hook
,
.
pf
=
PF_INET
,
THIS_MODULE
,
.
hooknum
=
NF_IP_PRE_ROUTING
,
PF_INET
,
.
priority
=
NF_IP_PRI_FILTER
+
1
,
NF_IP_PRE_ROUTING
,
}
NF_IP_PRI_FILTER
+
1
};
int
ingress_init
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
int
ingress_init
(
struct
Qdisc
*
sch
,
struct
rtattr
*
opt
)
{
{
...
...
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