#include <asm/uaccess.h>
#include "br_private.h"
+static kmem_cache_t *br_fdb_cache;
+
+void __init br_fdb_init(void)
+{
+ br_fdb_cache = kmem_cache_create("bridge_fdb_cache",
+ sizeof(struct net_bridge_fdb_entry),
+ 0,
+ SLAB_HWCACHE_ALIGN, NULL, NULL);
+}
+
+void __exit br_fdb_fini(void)
+{
+ kmem_cache_destroy(br_fdb_cache);
+}
+
+
/* if topology_changing then use forward_delay (default 15 sec)
* otherwise keep longer (default 5 minutes)
*/
&& time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
}
-static __inline__ void copy_fdb(struct __fdb_entry *ent,
+static inline void copy_fdb(struct __fdb_entry *ent,
const struct net_bridge_fdb_entry *f)
{
memset(ent, 0, sizeof(struct __fdb_entry));
void br_fdb_put(struct net_bridge_fdb_entry *ent)
{
if (atomic_dec_and_test(&ent->use_count))
- kfree(ent);
+ kmem_cache_free(br_fdb_cache, ent);
}
int br_fdb_get_entries(struct net_bridge *br,
/* entry was deleted during copy_to_user */
if (atomic_dec_and_test(&f->use_count)) {
- kfree(f);
+ kmem_cache_free(br_fdb_cache, f);
num = -EAGAIN;
goto out;
}
}
}
- fdb = kmalloc(sizeof(*fdb), GFP_ATOMIC);
+ fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC);
if (unlikely(fdb == NULL)) {
ret = -ENOMEM;
goto out;
extern int br_dev_xmit(struct sk_buff *skb, struct net_device *dev);
/* br_fdb.c */
+extern void br_fdb_init(void);
+extern void br_fdb_fini(void);
extern void br_fdb_changeaddr(struct net_bridge_port *p,
const unsigned char *newaddr);
extern void br_fdb_cleanup(unsigned long arg);