From: Matteo Croce <mcroce@linux.microsoft.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Julia Lawall <julia.lawall@inria.fr>
Subject: Re: [PATCH net-next 2/3] net: use skb_for_each_frag() helper where possible
Date: Fri, 9 Apr 2021 22:44:50 +0200 [thread overview]
Message-ID: <CAFnufp0fGEBHnuerrMVLaGUgAP3NYpiEMyW3R-AwDeG=R0sgHQ@mail.gmail.com> (raw)
In-Reply-To: <20210409115455.49e24450@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Fri, Apr 9, 2021 at 8:54 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 9 Apr 2021 20:06:04 +0200 Matteo Croce wrote:
> > From: Matteo Croce <mcroce@microsoft.com>
> >
> > use the new helper macro skb_for_each_frag() which allows to iterate
> > through all the SKB fragments.
> >
> > The patch was created with Coccinelle, this was the semantic patch:
>
> Bunch of set but not used warnings here. Please make sure the code
> builds cleanly allmodconfig, W=1 C=1 before posting.
>
Will do.
> What pops to mind (although quite nit picky) is the question if the
> assembly changes much between driver which used to cache nr_frags and
> now always going skb_shinfo(skb)->nr_frags? It's a relatively common
> pattern.
Since skb_shinfo() is a macro and skb_end_pointer() a static inline,
it should be the same, but I was curious to check so, this is a diff
between the following snippet before and afer the macro:
int frags = skb_shinfo(skb)->nr_frags;
int i;
for (i = 0; i < frags; i++)
kfree(skb->frags[i]);
1 file changed, 8 insertions(+), 7 deletions(-)
--- ins1.s 2021-04-09 22:35:59.384523865 +0200
+++ ins2.s 2021-04-09 22:36:08.132594737 +0200
@@ -1,26 +1,27 @@
iter:
movsx rax, DWORD PTR [rdi+16]
mov rdx, QWORD PTR [rdi+8]
mov eax, DWORD PTR [rdx+rax]
test eax, eax
jle .L6
push rbp
- sub eax, 1
+ mov rbp, rdi
push rbx
- lea rbp, [rdi+32+rax*8]
- lea rbx, [rdi+24]
+ xor ebx, ebx
sub rsp, 8
.L3:
- mov rdi, QWORD PTR [rbx]
- add rbx, 8
+ mov rdi, QWORD PTR [rbp+24+rbx*8]
+ add rbx, 1
call kfree
- cmp rbx, rbp
- jne .L3
+ movsx rax, DWORD PTR [rbp+16]
+ mov rdx, QWORD PTR [rbp+8]
+ cmp DWORD PTR [rdx+rax], ebx
+ jg .L3
add rsp, 8
xor eax, eax
pop rbx
pop rbp
ret
.L6:
xor eax, eax
ret
--
per aspera ad upstream
next prev parent reply other threads:[~2021-04-09 20:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 18:06 [PATCH net-next 0/3] introduce skb_for_each_frag() Matteo Croce
2021-04-09 18:06 ` [PATCH net-next 1/3] skbuff: add helper to walk over the fraglist Matteo Croce
2021-04-09 18:06 ` [PATCH net-next 2/3] net: use skb_for_each_frag() helper where possible Matteo Croce
2021-04-09 18:54 ` Jakub Kicinski
2021-04-09 20:44 ` Matteo Croce [this message]
2021-04-09 21:28 ` Jakub Kicinski
2021-04-10 0:53 ` Matteo Croce
2021-04-09 21:21 ` kernel test robot
2021-04-09 21:21 ` kernel test robot
2021-04-10 0:27 ` kernel test robot
2021-04-10 0:27 ` kernel test robot
2021-04-09 18:06 ` [PATCH net-next 3/3] net: use skb_for_each_frag() in illegal_highdma() Matteo Croce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFnufp0fGEBHnuerrMVLaGUgAP3NYpiEMyW3R-AwDeG=R0sgHQ@mail.gmail.com' \
--to=mcroce@linux.microsoft.com \
--cc=davem@davemloft.net \
--cc=julia.lawall@inria.fr \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.