[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75045c087db24b6e87b7ed14aa5a721c@AcuMS.aculab.com>
Date: Tue, 13 Apr 2021 07:53:14 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Matteo Croce' <mcroce@...ux.microsoft.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Julia Lawall <julia.lawall@...ia.fr>
Subject: RE: [PATCH net-next v2 0/3] introduce skb_for_each_frag()
From: Matteo Croce
> Sent: 12 April 2021 01:38
>
> Introduce skb_for_each_frag, an helper macro to iterate over the SKB frags.
The real question is why, the change is:
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+ skb_for_each_frag(skb, i) {
The existing code isn't complicated or obscure and 'does what it
says on the tin'.
The 'helper' requires you go and look up its definition to see
what it is really doing.
Unless you have a cunning plan to change the definition
there is zero point.
A more interesting change would be something that generated:
unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
for (i = 0; i < nr_frags; i++) {
since that will run faster for most loops.
But that is ~impossible to do since you can't declare
variables inside the (...) that are scoped to the loop.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists