* [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt
@ 2021-11-24 17:11 Xin Long
2021-11-26 5:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2021-11-24 17:11 UTC (permalink / raw)
To: network dev, tipc-discussion; +Cc: Jon Maloy, Ying Xue, Tuong Lien, davem, kuba
When a skb comes to tipc_aead_encrypt(), it's always linear. The
unlikely check 'skb_cloned(skb) && tailen <= skb_tailroom(skb)'
can completely be taken care of in skb_cow_data() by the code
in branch "if (!skb_has_frag_list())".
Also, remove the 'TODO:' annotation, as the pages in skbs are not
writable, see more on commit 3cf4375a0904 ("tipc: do not write
skb_shinfo frags when doing decrytion").
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
---
net/tipc/crypto.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index b4d9419a015b..81116312b753 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -761,21 +761,10 @@ static int tipc_aead_encrypt(struct tipc_aead *aead, struct sk_buff *skb,
skb_tailroom(skb), tailen);
}
- if (unlikely(!skb_cloned(skb) && tailen <= skb_tailroom(skb))) {
- nsg = 1;
- trailer = skb;
- } else {
- /* TODO: We could avoid skb_cow_data() if skb has no frag_list
- * e.g. by skb_fill_page_desc() to add another page to the skb
- * with the wanted tailen... However, page skbs look not often,
- * so take it easy now!
- * Cloned skbs e.g. from link_xmit() seems no choice though :(
- */
- nsg = skb_cow_data(skb, tailen, &trailer);
- if (unlikely(nsg < 0)) {
- pr_err("TX: skb_cow_data() returned %d\n", nsg);
- return nsg;
- }
+ nsg = skb_cow_data(skb, tailen, &trailer);
+ if (unlikely(nsg < 0)) {
+ pr_err("TX: skb_cow_data() returned %d\n", nsg);
+ return nsg;
}
pskb_put(skb, trailer, tailen);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt
2021-11-24 17:11 [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt Xin Long
@ 2021-11-26 5:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-26 5:10 UTC (permalink / raw)
To: Xin Long
Cc: netdev, tipc-discussion, jmaloy, ying.xue, tuong.t.lien, davem,
kuba
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 24 Nov 2021 12:11:12 -0500 you wrote:
> When a skb comes to tipc_aead_encrypt(), it's always linear. The
> unlikely check 'skb_cloned(skb) && tailen <= skb_tailroom(skb)'
> can completely be taken care of in skb_cow_data() by the code
> in branch "if (!skb_has_frag_list())".
>
> Also, remove the 'TODO:' annotation, as the pages in skbs are not
> writable, see more on commit 3cf4375a0904 ("tipc: do not write
> skb_shinfo frags when doing decrytion").
>
> [...]
Here is the summary with links:
- [net-next] tipc: delete the unlikely branch in tipc_aead_encrypt
https://git.kernel.org/netdev/net-next/c/0c51dffcc8a2
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] 2+ messages in thread
end of thread, other threads:[~2021-11-26 5:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-24 17:11 [PATCH net-next] tipc: delete the unlikely branch in tipc_aead_encrypt Xin Long
2021-11-26 5:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).