2023-12-26 09:43:23

by George Guo

[permalink] [raw]
Subject: [PATCH 01/14] netfilter: cleanup enum nft_set_class

From: George Guo <[email protected]>

Correct comments for nlpid, family, udlen and udata in struct nft_table,
and afinfo is no longer a member of enum nft_set_class.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index b157c5cafd14..18ec566cbc34 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -351,9 +351,9 @@ struct nft_set_desc {
/**
* enum nft_set_class - performance class
*
- * @NFT_LOOKUP_O_1: constant, O(1)
- * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N)
- * @NFT_LOOKUP_O_N: linear, O(N)
+ * @NFT_SET_CLASS_O_1: constant, O(1)
+ * @NFT_SET_CLASS_O_LOG_N: logarithmic, O(log N)
+ * @NFT_SET_CLASS_O_N: linear, O(N)
*/
enum nft_set_class {
NFT_SET_CLASS_O_1,
--
2.39.2



2023-12-26 09:43:48

by George Guo

[permalink] [raw]
Subject: [PATCH 02/14] netfilter: cleanup struct nft_set_elem

From: George Guo <[email protected]>

Add comment for data in struct nft_set_elem.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 18ec566cbc34..82eda4c65ae4 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -282,6 +282,7 @@ struct nft_elem_priv { };
*
* @key: element key
* @key_end: closing element key
+ * @data: element data
* @priv: element private data and extensions
*/
struct nft_set_elem {
--
2.39.2


2023-12-26 09:44:24

by George Guo

[permalink] [raw]
Subject: [PATCH 03/14] netfilter: cleanup struct nft_ctx

From: George Guo <[email protected]>

Add comment for flags in struct nft_ctx.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 82eda4c65ae4..adabddc4b0b9 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -205,6 +205,7 @@ static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
* @nla: netlink attributes
* @portid: netlink portID of the original message
* @seq: netlink sequence number
+ * @flags: modifiers to new request
* @family: protocol family
* @level: depth of the chains
* @report: notify via unicast netlink message
--
2.39.2


2023-12-26 09:45:03

by George Guo

[permalink] [raw]
Subject: [PATCH 05/14] netfilter: cleanup struct nft_set_ops

From: George Guo <[email protected]>

Add comments for commit, abort, estimate and gc_init in struct
nft_set_ops.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index a8243cf32e29..1e24db91a37e 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -424,9 +424,13 @@ struct nft_set_ext;
* @remove: remove element from set
* @walk: iterate over all set elements
* @get: get set elements
+ * @commit: commit set elements
+ * @abort: abort set elements
* @privsize: function to return size of set private data
+ * @estimate: estimate the required memory size and the lookup complexity class
* @init: initialize private data of new set instance
* @destroy: destroy private data of set instance
+ * @gc_init: initialize garbage collection
* @elemsize: element private size
*
* Operations lookup, update and delete have simpler interfaces, are faster
--
2.39.2


2023-12-26 09:45:06

by George Guo

[permalink] [raw]
Subject: [PATCH 04/14] netfilter: cleanup struct nft_set_iter

From: George Guo <[email protected]>

Add comments for timeout in struct nft_set_iter, and flags is not a
member of struct nft_set_iter, remove the comment for it.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index adabddc4b0b9..a8243cf32e29 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -327,10 +327,10 @@ struct nft_set_iter {
* @dtype: data type
* @dlen: data length
* @objtype: object type
- * @flags: flags
* @size: number of set elements
* @policy: set policy
* @gc_int: garbage collector interval
+ * @timeout: element timeout
* @field_len: length of each field in concatenation, bytes
* @field_count: number of concatenated fields in element
* @expr: set must support for expressions
--
2.39.2


2023-12-26 09:45:34

by George Guo

[permalink] [raw]
Subject: [PATCH 06/14] netfilter: cleanup struct nft_set

From: George Guo <[email protected]>

Add comments for pending_update, num_exprs, exprs and catchall_list
in struct nft_set.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 1e24db91a37e..91a1cb6fadf1 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -546,13 +546,16 @@ struct nft_set_elem_expr {
* @policy: set parameterization (see enum nft_set_policies)
* @udlen: user data length
* @udata: user data
- * @expr: stateful expression
+ * @pending_update: list of pending update set element
* @ops: set ops
* @flags: set flags
* @dead: set will be freed, never cleared
* @genmask: generation mask
* @klen: key length
* @dlen: data length
+ * @num_exprs: numbers of exprs
+ * @exprs: stateful expression
+ * @catchall_list: list of catch-all set element
* @data: private set data
*/
struct nft_set {
--
2.39.2


2023-12-26 09:45:56

by George Guo

[permalink] [raw]
Subject: [PATCH 07/14] netfilter: cleanup struct nft_set_ext_tmpl

From: George Guo <[email protected]>

Add comment for ext_len in struct nft_set_ext_tmpl.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 91a1cb6fadf1..55f1b3c7dc1f 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -701,6 +701,7 @@ extern const struct nft_set_ext_type nft_set_ext_types[];
*
* @len: length of extension area
* @offset: offsets of individual extension types
+ * @ext_len: length of the expected extension(used to sanity check)
*/
struct nft_set_ext_tmpl {
u16 len;
--
2.39.2


2023-12-26 09:46:29

by George Guo

[permalink] [raw]
Subject: [PATCH 08/14] netfilter: cleanup struct nft_expr_type

From: George Guo <[email protected]>

Add comment for inner_ops in struct nft_expr_type.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 55f1b3c7dc1f..65c41dcdd4be 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -850,6 +850,7 @@ struct nft_expr_ops;
* @select_ops: function to select nft_expr_ops
* @release_ops: release nft_expr_ops
* @ops: default ops, used when no select_ops functions is present
+ * @inner_ops: inner ops, used for inner packet operation
* @list: used internally
* @name: Identifier
* @owner: module reference
--
2.39.2


2023-12-26 09:46:48

by George Guo

[permalink] [raw]
Subject: [PATCH 09/14] netfilter: cleanup struct nft_expr_ops

From: George Guo <[email protected]>

Add comments for clone, destroy_clone, reduce, gc, offload,
offload_action, offload_stats in struct nft_expr_ops.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 65c41dcdd4be..208cfedb083c 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -892,14 +892,22 @@ struct nft_offload_ctx;
* struct nft_expr_ops - nf_tables expression operations
*
* @eval: Expression evaluation function
+ * @clone: Expression clone function
* @size: full expression size, including private data size
* @init: initialization function
* @activate: activate expression in the next generation
* @deactivate: deactivate expression in next generation
* @destroy: destruction function, called after synchronize_rcu
+ * @destroy_clone: destruction clone function
* @dump: function to dump parameters
- * @type: expression type
* @validate: validate expression, called during loop detection
+ * @reduce: reduce expression
+ * @gc: garbage collection expression
+ * @offload: hardware offload expression
+ * @offload_action: function to report true/false to allocate one slot or not in the flow
+ * offload array
+ * @offload_stats: function to synchronize hardware stats via updating the counter expression
+ * @type: expression type
* @data: extra data to attach to this expression operation
*/
struct nft_expr_ops {
--
2.39.2


2023-12-26 09:47:08

by George Guo

[permalink] [raw]
Subject: [PATCH 10/14] netfilter: cleanup struct nft_chain

From: George Guo <[email protected]>

Add comments for blob_gen_0, blob_gen_1, bound, genmask, udlen, udata,
blob_next in struct nft_chain.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 208cfedb083c..2ee906429cc9 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1060,14 +1060,21 @@ struct nft_rule_blob {
/**
* struct nft_chain - nf_tables chain
*
+ * @blob_gen_0: rule blob pointer to the current generation
+ * @blob_gen_1: rule blob pointer to the future generation
* @rules: list of rules in the chain
* @list: used internally
* @rhlhead: used internally
* @table: table that this chain belongs to
* @handle: chain handle
* @use: number of jump references to this chain
- * @flags: bitmask of enum nft_chain_flags
+ * @flags: bitmask of enum NFTA_CHAIN_FLAGS
+ * @bound: bind or not
+ * @genmask: generation mask
* @name: name of the chain
+ * @udlen: user data length
+ * @udata: user data in the chain
+ * @blob_next: rule blob pointer to the next in the chain
*/
struct nft_chain {
struct nft_rule_blob __rcu *blob_gen_0;
--
2.39.2


2023-12-26 09:47:17

by George Guo

[permalink] [raw]
Subject: [PATCH 11/14] netfilter: cleanup struct nft_base_chain

From: George Guo <[email protected]>

Add comment for flags in struct nft_base_chain.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 2ee906429cc9..526332bde1b4 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1172,6 +1172,7 @@ struct nft_hook {
* @hook_list: list of netfilter hooks (for NFPROTO_NETDEV family)
* @type: chain type
* @policy: default policy
+ * @flags: indicate the base chain disabled or not
* @stats: per-cpu chain stats
* @chain: the chain
* @flow_block: flow block (for hardware offload)
--
2.39.2


2023-12-26 09:47:40

by George Guo

[permalink] [raw]
Subject: [PATCH 12/14] netfilter: cleanup struct nft_object

From: George Guo <[email protected]>

Add comments for udlen, udata in struct nft_object.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 526332bde1b4..dab1727f3487 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1301,11 +1301,13 @@ struct nft_object_hash_key {
* struct nft_object - nf_tables stateful object
*
* @list: table stateful object list node
- * @key: keys that identify this object
* @rhlhead: nft_objname_ht node
+ * @key: keys that identify this object
* @genmask: generation mask
* @use: number of references to this stateful object
* @handle: unique object handle
+ * @udlen: length of user data
+ * @udata: user data
* @ops: object operations
* @data: object data, layout depends on type
*/
--
2.39.2


2023-12-26 09:48:00

by George Guo

[permalink] [raw]
Subject: [PATCH 13/14] netfilter: cleanup struct nft_object_ops

From: George Guo <[email protected]>

Add comment for type in struct nft_object_ops.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index dab1727f3487..505128d10073 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1373,6 +1373,7 @@ struct nft_object_type {
* @destroy: release existing stateful object
* @dump: netlink dump stateful object
* @update: update stateful object
+ * @type: pointer to object type
*/
struct nft_object_ops {
void (*eval)(struct nft_object *obj,
--
2.39.2


2023-12-26 09:48:22

by George Guo

[permalink] [raw]
Subject: [PATCH 14/14] netfilter: cleanup struct nft_flowtable

From: George Guo <[email protected]>

Add comment for hook_list in struct nft_flowtable, and remove comments
for dev_name and ops which are not members of struct nft_flowtable.

Signed-off-by: George Guo <[email protected]>
---
include/net/netfilter/nf_tables.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 505128d10073..a880e9439cc2 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1409,9 +1409,8 @@ void nft_unregister_obj(struct nft_object_type *obj_type);
* @genmask: generation mask
* @use: number of references to this flow table
* @handle: unique object handle
- * @dev_name: array of device names
+ * @hook_list: hook list for hooks per net_device in flowtables
* @data: rhashtable and garbage collector
- * @ops: array of hooks
*/
struct nft_flowtable {
struct list_head list;
--
2.39.2


2024-01-02 13:29:00

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [PATCH 01/14] netfilter: cleanup enum nft_set_class

On Tue, Dec 26, 2023 at 05:42:42PM +0800, George Guo wrote:
> From: George Guo <[email protected]>
>
> Correct comments for nlpid, family, udlen and udata in struct nft_table,
> and afinfo is no longer a member of enum nft_set_class.

Thanks for your series.

My plan is to squash this series in one single patch and then apply to
the netfilter tree.