2022-03-01 08:28:15

by Xiaomeng Tong

[permalink] [raw]
Subject: [PATCH 5/6] net/core: remove iterator use outside the loop

Demonstrations for:
- list_for_each_entry_safe_reverse_inside

Signed-off-by: Xiaomeng Tong <[email protected]>
---
net/core/gro.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/gro.c b/net/core/gro.c
index a11b286d1..4d4f1f2fb 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -286,9 +286,8 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
bool flush_old)
{
struct list_head *head = &napi->gro_hash[index].list;
- struct sk_buff *skb, *p;

- list_for_each_entry_safe_reverse(skb, p, head, list) {
+ list_for_each_entry_safe_reverse_inside(skb, p, struct sk_buff, head, list) {
if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
return;
skb_list_del_init(skb);
--
2.17.1


2022-03-01 14:37:56

by Xiaomeng Tong

[permalink] [raw]
Subject: Re: [PATCH 5/6] net/core: remove iterator use outside the loop

I'm sorry for have created the confusion. I made this patch to remove
the use of iterator (in this patch is "skp", "p") outside
the list_for_each_entry* loop, using the new *_inside macros instead
which are introduced in PATCH 2/6, and to prove the effectiveness of
the new macros.

Best regards,
--
Xiaomeng Tong