diff mbox series

[net-next] inet: add indirect call wrapper for getfrag() calls

Message ID 20241203173617.2595451-1-edumazet@google.com (mailing list archive)
State Accepted
Commit 5204ccbfa22358f95afd031a3f337e6d9a74baea
Delegated to: Netdev Maintainers
Headers show
Series [net-next] inet: add indirect call wrapper for getfrag() calls | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: horms@kernel.org dsahern@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 304 this patch: 304
netdev/checkpatch warning CHECK: Alignment should match open parenthesis
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-04--15-02 (tests: 760)

Commit Message

Eric Dumazet Dec. 3, 2024, 5:36 p.m. UTC
UDP send path suffers from one indirect call to ip_generic_getfrag()

We can use INDIRECT_CALL_1() to avoid it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Cc: Willem de Bruijn <willemb@google.com>
Cc: Brian Vazquez <brianvv@google.com>
---
 net/ipv4/ip_output.c  | 13 +++++++++----
 net/ipv6/ip6_output.c | 13 ++++++++-----
 2 files changed, 17 insertions(+), 9 deletions(-)

Comments

Willem de Bruijn Dec. 3, 2024, 6:29 p.m. UTC | #1
Eric Dumazet wrote:
> UDP send path suffers from one indirect call to ip_generic_getfrag()
> 
> We can use INDIRECT_CALL_1() to avoid it.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>
Brian Vazquez Dec. 3, 2024, 6:49 p.m. UTC | #2
On Tue, Dec 3, 2024 at 12:36 PM Eric Dumazet <edumazet@google.com> wrote:
>
> UDP send path suffers from one indirect call to ip_generic_getfrag()
>
> We can use INDIRECT_CALL_1() to avoid it.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Brian Vazquez <brianvv@google.com>

> ---
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Brian Vazquez <brianvv@google.com>
> ---
>  net/ipv4/ip_output.c  | 13 +++++++++----
>  net/ipv6/ip6_output.c | 13 ++++++++-----
>  2 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 0065b1996c947078bea210c9abe5c80fa0e0ab4f..a59204a8d85053a9b8c9e86a404aa4bf2f0d2416 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -1169,7 +1169,10 @@ static int __ip_append_data(struct sock *sk,
>                         /* [!] NOTE: copy will be negative if pagedlen>0
>                          * because then the equation reduces to -fraggap.
>                          */
> -                       if (copy > 0 && getfrag(from, data + transhdrlen, offset, copy, fraggap, skb) < 0) {
> +                       if (copy > 0 &&
> +                           INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                           from, data + transhdrlen, offset,
> +                                           copy, fraggap, skb) < 0) {
>                                 err = -EFAULT;
>                                 kfree_skb(skb);
>                                 goto error;
> @@ -1213,8 +1216,9 @@ static int __ip_append_data(struct sock *sk,
>                         unsigned int off;
>
>                         off = skb->len;
> -                       if (getfrag(from, skb_put(skb, copy),
> -                                       offset, copy, off, skb) < 0) {
> +                       if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                           from, skb_put(skb, copy),
> +                                           offset, copy, off, skb) < 0) {
>                                 __skb_trim(skb, off);
>                                 err = -EFAULT;
>                                 goto error;
> @@ -1252,7 +1256,8 @@ static int __ip_append_data(struct sock *sk,
>                                 get_page(pfrag->page);
>                         }
>                         copy = min_t(int, copy, pfrag->size - pfrag->offset);
> -                       if (getfrag(from,
> +                       if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                   from,
>                                     page_address(pfrag->page) + pfrag->offset,
>                                     offset, copy, skb->len, skb) < 0)
>                                 goto error_efault;
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index f7b4608bb316ed2114a0e626aad530b62b767fc1..3d672dea9f56284e7a8ebabec037e04e7f3d19f4 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -1697,8 +1697,9 @@ static int __ip6_append_data(struct sock *sk,
>                                 pskb_trim_unique(skb_prev, maxfraglen);
>                         }
>                         if (copy > 0 &&
> -                           getfrag(from, data + transhdrlen, offset,
> -                                   copy, fraggap, skb) < 0) {
> +                           INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                          from, data + transhdrlen, offset,
> +                                          copy, fraggap, skb) < 0) {
>                                 err = -EFAULT;
>                                 kfree_skb(skb);
>                                 goto error;
> @@ -1742,8 +1743,9 @@ static int __ip6_append_data(struct sock *sk,
>                         unsigned int off;
>
>                         off = skb->len;
> -                       if (getfrag(from, skb_put(skb, copy),
> -                                               offset, copy, off, skb) < 0) {
> +                       if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                           from, skb_put(skb, copy),
> +                                           offset, copy, off, skb) < 0) {
>                                 __skb_trim(skb, off);
>                                 err = -EFAULT;
>                                 goto error;
> @@ -1781,7 +1783,8 @@ static int __ip6_append_data(struct sock *sk,
>                                 get_page(pfrag->page);
>                         }
>                         copy = min_t(int, copy, pfrag->size - pfrag->offset);
> -                       if (getfrag(from,
> +                       if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
> +                                   from,
>                                     page_address(pfrag->page) + pfrag->offset,
>                                     offset, copy, skb->len, skb) < 0)
>                                 goto error_efault;
> --
> 2.47.0.338.g60cca15819-goog
>
patchwork-bot+netdevbpf@kernel.org Dec. 5, 2024, 3:30 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  3 Dec 2024 17:36:17 +0000 you wrote:
> UDP send path suffers from one indirect call to ip_generic_getfrag()
> 
> We can use INDIRECT_CALL_1() to avoid it.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Brian Vazquez <brianvv@google.com>
> 
> [...]

Here is the summary with links:
  - [net-next] inet: add indirect call wrapper for getfrag() calls
    https://git.kernel.org/netdev/net-next/c/5204ccbfa223

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 0065b1996c947078bea210c9abe5c80fa0e0ab4f..a59204a8d85053a9b8c9e86a404aa4bf2f0d2416 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1169,7 +1169,10 @@  static int __ip_append_data(struct sock *sk,
 			/* [!] NOTE: copy will be negative if pagedlen>0
 			 * because then the equation reduces to -fraggap.
 			 */
-			if (copy > 0 && getfrag(from, data + transhdrlen, offset, copy, fraggap, skb) < 0) {
+			if (copy > 0 &&
+			    INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+					    from, data + transhdrlen, offset,
+					    copy, fraggap, skb) < 0) {
 				err = -EFAULT;
 				kfree_skb(skb);
 				goto error;
@@ -1213,8 +1216,9 @@  static int __ip_append_data(struct sock *sk,
 			unsigned int off;
 
 			off = skb->len;
-			if (getfrag(from, skb_put(skb, copy),
-					offset, copy, off, skb) < 0) {
+			if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+					    from, skb_put(skb, copy),
+					    offset, copy, off, skb) < 0) {
 				__skb_trim(skb, off);
 				err = -EFAULT;
 				goto error;
@@ -1252,7 +1256,8 @@  static int __ip_append_data(struct sock *sk,
 				get_page(pfrag->page);
 			}
 			copy = min_t(int, copy, pfrag->size - pfrag->offset);
-			if (getfrag(from,
+			if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+				    from,
 				    page_address(pfrag->page) + pfrag->offset,
 				    offset, copy, skb->len, skb) < 0)
 				goto error_efault;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f7b4608bb316ed2114a0e626aad530b62b767fc1..3d672dea9f56284e7a8ebabec037e04e7f3d19f4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1697,8 +1697,9 @@  static int __ip6_append_data(struct sock *sk,
 				pskb_trim_unique(skb_prev, maxfraglen);
 			}
 			if (copy > 0 &&
-			    getfrag(from, data + transhdrlen, offset,
-				    copy, fraggap, skb) < 0) {
+			    INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+					   from, data + transhdrlen, offset,
+					   copy, fraggap, skb) < 0) {
 				err = -EFAULT;
 				kfree_skb(skb);
 				goto error;
@@ -1742,8 +1743,9 @@  static int __ip6_append_data(struct sock *sk,
 			unsigned int off;
 
 			off = skb->len;
-			if (getfrag(from, skb_put(skb, copy),
-						offset, copy, off, skb) < 0) {
+			if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+					    from, skb_put(skb, copy),
+					    offset, copy, off, skb) < 0) {
 				__skb_trim(skb, off);
 				err = -EFAULT;
 				goto error;
@@ -1781,7 +1783,8 @@  static int __ip6_append_data(struct sock *sk,
 				get_page(pfrag->page);
 			}
 			copy = min_t(int, copy, pfrag->size - pfrag->offset);
-			if (getfrag(from,
+			if (INDIRECT_CALL_1(getfrag, ip_generic_getfrag,
+				    from,
 				    page_address(pfrag->page) + pfrag->offset,
 				    offset, copy, skb->len, skb) < 0)
 				goto error_efault;