git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nfs4: minor callback code simplification, comment
[safe/jmp/linux-2.6]
/
net
/
sched
/
em_meta.c
diff --git
a/net/sched/em_meta.c
b/net/sched/em_meta.c
index
9c2ec19
..
3bcac8a
100644
(file)
--- a/
net/sched/em_meta.c
+++ b/
net/sched/em_meta.c
@@
-58,6
+58,7
@@
* only available if that subsystem is enabled in the kernel.
*/
* only available if that subsystem is enabled in the kernel.
*/
+#include <linux/slab.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
@@
-177,7
+178,9
@@
META_COLLECTOR(var_dev)
META_COLLECTOR(int_vlan_tag)
{
unsigned short tag;
META_COLLECTOR(int_vlan_tag)
{
unsigned short tag;
- if (vlan_get_tag(skb, &tag) < 0)
+
+ tag = vlan_tx_tag_get(skb);
+ if (!tag && __vlan_get_tag(skb, &tag))
*err = -1;
else
dst->value = tag;
*err = -1;
else
dst->value = tag;
@@
-244,11
+247,11
@@
META_COLLECTOR(int_tcindex)
META_COLLECTOR(int_rtclassid)
{
META_COLLECTOR(int_rtclassid)
{
- if (unlikely(skb
->dst
== NULL))
+ if (unlikely(skb
_dst(skb)
== NULL))
*err = -1;
else
#ifdef CONFIG_NET_CLS_ROUTE
*err = -1;
else
#ifdef CONFIG_NET_CLS_ROUTE
- dst->value = skb
->dst
->tclassid;
+ dst->value = skb
_dst(skb)
->tclassid;
#else
dst->value = 0;
#endif
#else
dst->value = 0;
#endif
@@
-256,10
+259,10
@@
META_COLLECTOR(int_rtclassid)
META_COLLECTOR(int_rtiif)
{
META_COLLECTOR(int_rtiif)
{
- if (unlikely(skb
->dst
== NULL))
+ if (unlikely(skb
_rtable(skb)
== NULL))
*err = -1;
else
*err = -1;
else
- dst->value =
((struct rtable*) skb->dst
)->fl.iif;
+ dst->value =
skb_rtable(skb
)->fl.iif;
}
/**************************************************************************
}
/**************************************************************************
@@
-301,17
+304,18
@@
META_COLLECTOR(var_sk_bound_if)
{
SKIP_NONLOCAL(skb);
{
SKIP_NONLOCAL(skb);
-
if (skb->sk->sk_bound_dev_if == 0) {
+ if (skb->sk->sk_bound_dev_if == 0) {
dst->value = (unsigned long) "any";
dst->len = 3;
dst->value = (unsigned long) "any";
dst->len = 3;
-
} else
{
+
} else
{
struct net_device *dev;
struct net_device *dev;
- dev = dev_get_by_index(&init_net, skb->sk->sk_bound_dev_if);
+ rcu_read_lock();
+ dev = dev_get_by_index_rcu(sock_net(skb->sk),
+ skb->sk->sk_bound_dev_if);
*err = var_dev(dev, dst);
*err = var_dev(dev, dst);
- if (dev)
- dev_put(dev);
- }
+ rcu_read_unlock();
+ }
}
META_COLLECTOR(int_sk_refcnt)
}
META_COLLECTOR(int_sk_refcnt)
@@
-347,13
+351,13
@@
META_COLLECTOR(int_sk_type)
META_COLLECTOR(int_sk_rmem_alloc)
{
SKIP_NONLOCAL(skb);
META_COLLECTOR(int_sk_rmem_alloc)
{
SKIP_NONLOCAL(skb);
- dst->value =
atomic_read(&skb->sk->sk_rmem_alloc
);
+ dst->value =
sk_rmem_alloc_get(skb->sk
);
}
META_COLLECTOR(int_sk_wmem_alloc)
{
SKIP_NONLOCAL(skb);
}
META_COLLECTOR(int_sk_wmem_alloc)
{
SKIP_NONLOCAL(skb);
- dst->value =
atomic_read(&skb->sk->sk_wmem_alloc
);
+ dst->value =
sk_wmem_alloc_get(skb->sk
);
}
META_COLLECTOR(int_sk_omem_alloc)
}
META_COLLECTOR(int_sk_omem_alloc)
@@
-687,8
+691,8
@@
static inline struct meta_type_ops * meta_type_ops(struct meta_value *v)
* Core
**************************************************************************/
* Core
**************************************************************************/
-static in
line in
t meta_get(struct sk_buff *skb, struct tcf_pkt_info *info,
-
struct meta_value *v, struct meta_obj *dst)
+static int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info,
+ struct meta_value *v, struct meta_obj *dst)
{
int err = 0;
{
int err = 0;
@@
-733,13
+737,15
@@
static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m,
return 0;
}
return 0;
}
-static
inline
void meta_delete(struct meta_match *meta)
+static void meta_delete(struct meta_match *meta)
{
{
- struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
+ if (meta) {
+ struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);
- if (ops && ops->destroy) {
- ops->destroy(&meta->lvalue);
- ops->destroy(&meta->rvalue);
+ if (ops && ops->destroy) {
+ ops->destroy(&meta->lvalue);
+ ops->destroy(&meta->rvalue);
+ }
}
kfree(meta);
}
kfree(meta);