Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / include / net / netfilter / nf_tables.h
index ac84686aaafb0b3fadd1ed1883943cecc5f19ee5..f713a053f89d4627d3166a5c2bb14f7a0f67b574 100644 (file)
@@ -103,6 +103,35 @@ struct nft_regs {
        };
 };
 
+/* Store/load an u16 or u8 integer to/from the u32 data register.
+ *
+ * Note, when using concatenations, register allocation happens at 32-bit
+ * level. So for store instruction, pad the rest part with zero to avoid
+ * garbage values.
+ */
+
+static inline void nft_reg_store16(u32 *dreg, u16 val)
+{
+       *dreg = 0;
+       *(u16 *)dreg = val;
+}
+
+static inline void nft_reg_store8(u32 *dreg, u8 val)
+{
+       *dreg = 0;
+       *(u8 *)dreg = val;
+}
+
+static inline u16 nft_reg_load16(u32 *sreg)
+{
+       return *(u16 *)sreg;
+}
+
+static inline u8 nft_reg_load8(u32 *sreg)
+{
+       return *(u8 *)sreg;
+}
+
 static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
                                 unsigned int len)
 {
@@ -203,7 +232,6 @@ struct nft_set_elem {
 struct nft_set;
 struct nft_set_iter {
        u8              genmask;
-       bool            flush;
        unsigned int    count;
        unsigned int    skip;
        int             err;
@@ -385,10 +413,11 @@ static inline struct nft_set *nft_set_container_of(const void *priv)
        return (void *)priv - offsetof(struct nft_set, data);
 }
 
-struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
-                                    const struct nlattr *nla, u8 genmask);
-struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
-                                         const struct nlattr *nla, u8 genmask);
+struct nft_set *nft_set_lookup(const struct net *net,
+                              const struct nft_table *table,
+                              const struct nlattr *nla_set_name,
+                              const struct nlattr *nla_set_id,
+                              u8 genmask);
 
 static inline unsigned long nft_set_gc_interval(const struct nft_set *set)
 {
@@ -988,9 +1017,9 @@ struct nft_object *nf_tables_obj_lookup(const struct nft_table *table,
                                        const struct nlattr *nla, u32 objtype,
                                        u8 genmask);
 
-int nft_obj_notify(struct net *net, struct nft_table *table,
-                  struct nft_object *obj, u32 portid, u32 seq,
-                  int event, int family, int report, gfp_t gfp);
+void nft_obj_notify(struct net *net, struct nft_table *table,
+                   struct nft_object *obj, u32 portid, u32 seq,
+                   int event, int family, int report, gfp_t gfp);
 
 /**
  *     struct nft_object_type - stateful object type
@@ -1016,7 +1045,8 @@ struct nft_object_type {
        unsigned int                    maxattr;
        struct module                   *owner;
        const struct nla_policy         *policy;
-       int                             (*init)(const struct nlattr * const tb[],
+       int                             (*init)(const struct nft_ctx *ctx,
+                                               const struct nlattr *const tb[],
                                                struct nft_object *obj);
        void                            (*destroy)(struct nft_object *obj);
        int                             (*dump)(struct sk_buff *skb,