X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=datapath%2Ftable.h;h=3a0c2a66998b967362855a0f98a4d3133394aa05;hb=de5cdb90f7c02d22b0595c7dc311c5306291b02f;hp=dac57476a5526a2107eabcfc01f930fdbfbe2b06;hpb=ac0ceab6e39da04d146b41a8a2828c7288941a00;p=sliver-openvswitch.git diff --git a/datapath/table.h b/datapath/table.h index dac57476a..3a0c2a669 100644 --- a/datapath/table.h +++ b/datapath/table.h @@ -34,7 +34,7 @@ struct tbl_node { struct tbl { struct rcu_head rcu; unsigned int n_buckets; - struct tbl_bucket ***buckets; + struct tbl_bucket __rcu ***buckets; unsigned int count; void (*obj_destructor)(struct tbl_node *); }; @@ -47,18 +47,22 @@ struct tbl { #define TBL_L1_SIZE (1 << TBL_L1_BITS) #define TBL_L1_SHIFT TBL_L2_BITS +/* For 4 kB pages, this is 1,024 on 32-bit or 512 on 64-bit. */ +#define TBL_MIN_BUCKETS TBL_L2_SIZE + /* For 4 kB pages, this is 1,048,576 on 32-bit or 262,144 on 64-bit. */ #define TBL_MAX_BUCKETS (TBL_L1_SIZE * TBL_L2_SIZE) struct tbl *tbl_create(unsigned int n_buckets); void tbl_destroy(struct tbl *, void (*destructor)(struct tbl_node *)); -struct tbl_node *tbl_lookup(struct tbl *, void *target, u32 hash, - int (*cmp)(const struct tbl_node *, void *target)); +struct tbl_node *tbl_lookup(struct tbl *, void *target, int len, u32 hash, + int (*cmp)(const struct tbl_node *, void *target, int len)); int tbl_insert(struct tbl *, struct tbl_node *, u32 hash); int tbl_remove(struct tbl *, struct tbl_node *); unsigned int tbl_count(struct tbl *); int tbl_foreach(struct tbl *, int (*callback)(struct tbl_node *, void *aux), void *aux); +struct tbl_node *tbl_next(struct tbl *, u32 *bucketp, u32 *objp); int tbl_n_buckets(struct tbl *); struct tbl *tbl_expand(struct tbl *);