aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/act_api.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h
index a72642610790..2b5ec5abfeb3 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -38,7 +38,7 @@ struct tcf_common {
38struct tcf_hashinfo { 38struct tcf_hashinfo {
39 struct tcf_common **htab; 39 struct tcf_common **htab;
40 unsigned int hmask; 40 unsigned int hmask;
41 rwlock_t *lock; 41 rwlock_t lock;
42}; 42};
43 43
44static inline unsigned int tcf_hash(u32 index, unsigned int hmask) 44static inline unsigned int tcf_hash(u32 index, unsigned int hmask)
@@ -46,6 +46,22 @@ static inline unsigned int tcf_hash(u32 index, unsigned int hmask)
46 return index & hmask; 46 return index & hmask;
47} 47}
48 48
49static inline int tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask)
50{
51 rwlock_init(&hf->lock);
52 hf->hmask = mask;
53 hf->htab = kzalloc((mask + 1) * sizeof(struct tcf_common *),
54 GFP_KERNEL);
55 if (!hf->htab)
56 return -ENOMEM;
57 return 0;
58}
59
60static inline void tcf_hashinfo_destroy(struct tcf_hashinfo *hf)
61{
62 kfree(hf->htab);
63}
64
49#ifdef CONFIG_NET_CLS_ACT 65#ifdef CONFIG_NET_CLS_ACT
50 66
51#define ACT_P_CREATED 1 67#define ACT_P_CREATED 1