* [PATCH net-next v2 1/5] net/ipv4: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
@ 2024-09-04 9:32 ` Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 2/5] net/tipc: " Hongbo Li
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Hongbo Li @ 2024-09-04 9:32 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms
Cc: netdev, netfilter-devel, lihongbo22
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD(). Here we can simplify
the code.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
net/ipv4/ip_input.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d6fbcbd2358a..b6e7d4921309 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -596,9 +596,8 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
{
struct sk_buff *skb, *next, *hint = NULL;
struct dst_entry *curr_dst = NULL;
- struct list_head sublist;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
struct net_device *dev = skb->dev;
struct dst_entry *dst;
@@ -646,9 +645,8 @@ void ip_list_rcv(struct list_head *head, struct packet_type *pt,
struct net_device *curr_dev = NULL;
struct net *curr_net = NULL;
struct sk_buff *skb, *next;
- struct list_head sublist;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
struct net_device *dev = skb->dev;
struct net *net = dev_net(dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net-next v2 2/5] net/tipc: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 1/5] net/ipv4: " Hongbo Li
@ 2024-09-04 9:32 ` Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 3/5] net/netfilter: " Hongbo Li
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Hongbo Li @ 2024-09-04 9:32 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms
Cc: netdev, netfilter-devel, lihongbo22
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD(). Here we can simplify
the code.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
v2:
- Keep the reverse xmas tree order as Simon's suggested.
v1: https://lore.kernel.org/netdev/36922bd7-5174-4cf0-b7a2-5ddc77c4868d@huawei.com/T/#m3c3c6376534474346018f583eb3637ff9ecf8a1c
---
net/tipc/socket.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 1a0cd06f0eae..65dcbb54f55d 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1009,12 +1009,11 @@ static int tipc_send_group_anycast(struct socket *sock, struct msghdr *m,
struct tipc_member *mbr = NULL;
struct net *net = sock_net(sk);
u32 node, port, exclude;
- struct list_head dsts;
+ LIST_HEAD(dsts);
int lookups = 0;
int dstcnt, rc;
bool cong;
- INIT_LIST_HEAD(&dsts);
ua->sa.type = msg_nametype(hdr);
ua->scope = msg_lookup_scope(hdr);
@@ -1161,10 +1160,9 @@ static int tipc_send_group_mcast(struct socket *sock, struct msghdr *m,
struct tipc_group *grp = tsk->group;
struct tipc_msg *hdr = &tsk->phdr;
struct net *net = sock_net(sk);
- struct list_head dsts;
u32 dstcnt, exclude;
+ LIST_HEAD(dsts);
- INIT_LIST_HEAD(&dsts);
ua->sa.type = msg_nametype(hdr);
ua->scope = msg_lookup_scope(hdr);
exclude = tipc_group_exclude(grp);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net-next v2 3/5] net/netfilter: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 1/5] net/ipv4: " Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 2/5] net/tipc: " Hongbo Li
@ 2024-09-04 9:32 ` Hongbo Li
2024-09-04 10:03 ` Pablo Neira Ayuso
2024-09-04 9:32 ` [PATCH net-next v2 4/5] net/ipv6: " Hongbo Li
` (2 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Hongbo Li @ 2024-09-04 9:32 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms
Cc: netdev, netfilter-devel, lihongbo22
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD(). Here we can simplify
the code.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
v2:
- Keep the reverse xmas tree order as Pablo's suggested.
v1: https://lore.kernel.org/netdev/20240827165723.GQ1368797@kernel.org/T/#ma8c13d915dce14e01b66c03fd7c2588344596ac8
---
net/netfilter/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index b00fc285b334..b9f551f02c81 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -655,11 +655,9 @@ void nf_hook_slow_list(struct list_head *head, struct nf_hook_state *state,
const struct nf_hook_entries *e)
{
struct sk_buff *skb, *next;
- struct list_head sublist;
+ LIST_HEAD(sublist);
int ret;
- INIT_LIST_HEAD(&sublist);
-
list_for_each_entry_safe(skb, next, head, list) {
skb_list_del_init(skb);
ret = nf_hook_slow(skb, state, e, 0);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v2 3/5] net/netfilter: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 ` [PATCH net-next v2 3/5] net/netfilter: " Hongbo Li
@ 2024-09-04 10:03 ` Pablo Neira Ayuso
0 siblings, 0 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2024-09-04 10:03 UTC (permalink / raw)
To: Hongbo Li
Cc: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, kadlec,
horms, netdev, netfilter-devel
On Wed, Sep 04, 2024 at 05:32:41PM +0800, Hongbo Li wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD(). Here we can simplify
> the code.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 4/5] net/ipv6: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
` (2 preceding siblings ...)
2024-09-04 9:32 ` [PATCH net-next v2 3/5] net/netfilter: " Hongbo Li
@ 2024-09-04 9:32 ` Hongbo Li
2024-09-04 9:32 ` [PATCH net-next v2 5/5] net/core: " Hongbo Li
2024-09-07 1:20 ` [PATCH net-next v2 0/5] " patchwork-bot+netdevbpf
5 siblings, 0 replies; 8+ messages in thread
From: Hongbo Li @ 2024-09-04 9:32 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms
Cc: netdev, netfilter-devel, lihongbo22
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD(). Here we can simplify
the code.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
net/ipv6/ip6_input.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 133610a49da6..70c0e16c0ae6 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -111,9 +111,8 @@ static void ip6_list_rcv_finish(struct net *net, struct sock *sk,
{
struct sk_buff *skb, *next, *hint = NULL;
struct dst_entry *curr_dst = NULL;
- struct list_head sublist;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
struct dst_entry *dst;
@@ -327,9 +326,8 @@ void ipv6_list_rcv(struct list_head *head, struct packet_type *pt,
struct net_device *curr_dev = NULL;
struct net *curr_net = NULL;
struct sk_buff *skb, *next;
- struct list_head sublist;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
struct net_device *dev = skb->dev;
struct net *net = dev_net(dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net-next v2 5/5] net/core: make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
` (3 preceding siblings ...)
2024-09-04 9:32 ` [PATCH net-next v2 4/5] net/ipv6: " Hongbo Li
@ 2024-09-04 9:32 ` Hongbo Li
2024-09-07 1:20 ` [PATCH net-next v2 0/5] " patchwork-bot+netdevbpf
5 siblings, 0 replies; 8+ messages in thread
From: Hongbo Li @ 2024-09-04 9:32 UTC (permalink / raw)
To: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms
Cc: netdev, netfilter-devel, lihongbo22
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD(). Here we can simplify
the code.
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
net/core/dev.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 05d9624f360f..b67ad9bb81a0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5727,10 +5727,9 @@ static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemallo
struct packet_type *pt_curr = NULL;
/* Current (common) orig_dev of sublist */
struct net_device *od_curr = NULL;
- struct list_head sublist;
struct sk_buff *skb, *next;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
struct net_device *orig_dev = skb->dev;
struct packet_type *pt_prev = NULL;
@@ -5868,9 +5867,8 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
void netif_receive_skb_list_internal(struct list_head *head)
{
struct sk_buff *skb, *next;
- struct list_head sublist;
+ LIST_HEAD(sublist);
- INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) {
net_timestamp_check(READ_ONCE(net_hotdata.tstamp_prequeue),
skb);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD()
2024-09-04 9:32 [PATCH net-next v2 0/5] make use of the helper macro LIST_HEAD() Hongbo Li
` (4 preceding siblings ...)
2024-09-04 9:32 ` [PATCH net-next v2 5/5] net/core: " Hongbo Li
@ 2024-09-07 1:20 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-07 1:20 UTC (permalink / raw)
To: Hongbo Li
Cc: davem, dsahern, edumazet, kuba, pabeni, jmaloy, ying.xue, pablo,
kadlec, horms, netdev, netfilter-devel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 Sep 2024 17:32:38 +0800 you wrote:
> The macro LIST_HEAD() declares a list variable and
> initializes it, which can be used to simplify the steps
> of list initialization, thereby simplifying the code.
> These serials just do some equivalatent substitutions,
> and with no functional modifications.
>
> Changes in v2:
> - Keep the reverse xmas tree order as Simon's and
> Pablo's suggested.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/5] net/ipv4: make use of the helper macro LIST_HEAD()
https://git.kernel.org/netdev/net-next/c/cecbe5c8c803
- [net-next,v2,2/5] net/tipc: make use of the helper macro LIST_HEAD()
https://git.kernel.org/netdev/net-next/c/e636ba1a15e7
- [net-next,v2,3/5] net/netfilter: make use of the helper macro LIST_HEAD()
https://git.kernel.org/netdev/net-next/c/8b51455bbd45
- [net-next,v2,4/5] net/ipv6: make use of the helper macro LIST_HEAD()
https://git.kernel.org/netdev/net-next/c/2a7dd251b6fe
- [net-next,v2,5/5] net/core: make use of the helper macro LIST_HEAD()
https://git.kernel.org/netdev/net-next/c/17f01391903d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread