diff mbox series

xdp: fix xsk_generic_xmit errno

Message ID 1591852266-24017-1-git-send-email-lirongqing@baidu.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series xdp: fix xsk_generic_xmit errno | expand

Commit Message

Li RongQing June 11, 2020, 5:11 a.m. UTC
propagate sock_alloc_send_skb error code, not set it
to EAGAIN unconditionally, when fail to allocate skb,
which maybe causes that user space unnecessary loops

Fixes: 35fcde7f8deb "(xsk: support for Tx)"
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/xdp/xsk.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Björn Töpel June 11, 2020, 8:18 a.m. UTC | #1
On Thu, 11 Jun 2020 at 07:11, Li RongQing <lirongqing@baidu.com> wrote:
>
> propagate sock_alloc_send_skb error code, not set it
> to EAGAIN unconditionally, when fail to allocate skb,
> which maybe causes that user space unnecessary loops
>
> Fixes: 35fcde7f8deb "(xsk: support for Tx)"
> Signed-off-by: Li RongQing <lirongqing@baidu.com>


Thanks!
Acked-by: Björn Töpel <bjorn.topel@intel.com>

Alexei/Daniel: This should go into "bpf".


Björn

> ---
>  net/xdp/xsk.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index b6c0f08bd80d..1ba3ea262c15 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -353,7 +353,6 @@ static int xsk_generic_xmit(struct sock *sk)
>                 len = desc.len;
>                 skb = sock_alloc_send_skb(sk, len, 1, &err);
>                 if (unlikely(!skb)) {
> -                       err = -EAGAIN;
>                         goto out;
>                 }
>
> --
> 2.16.2
>
Daniel Borkmann June 11, 2020, 2:24 p.m. UTC | #2
On 6/11/20 10:18 AM, Björn Töpel wrote:
> On Thu, 11 Jun 2020 at 07:11, Li RongQing <lirongqing@baidu.com> wrote:
>>
>> propagate sock_alloc_send_skb error code, not set it
>> to EAGAIN unconditionally, when fail to allocate skb,
>> which maybe causes that user space unnecessary loops
>>
>> Fixes: 35fcde7f8deb "(xsk: support for Tx)"
>> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> 
> Thanks!
> Acked-by: Björn Töpel <bjorn.topel@intel.com>
> 
> Alexei/Daniel: This should go into "bpf".

Yep, applied, thanks!
David Miller June 11, 2020, 7:44 p.m. UTC | #3
From: Li RongQing <lirongqing@baidu.com>
Date: Thu, 11 Jun 2020 13:11:06 +0800

> @@ -353,7 +353,6 @@ static int xsk_generic_xmit(struct sock *sk)
>  		len = desc.len;
>  		skb = sock_alloc_send_skb(sk, len, 1, &err);
>  		if (unlikely(!skb)) {
> -			err = -EAGAIN;
>  			goto out;
>  		}

Since the result is a single-statement basic block you must remove the
curly braces.
diff mbox series

Patch

diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index b6c0f08bd80d..1ba3ea262c15 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -353,7 +353,6 @@  static int xsk_generic_xmit(struct sock *sk)
 		len = desc.len;
 		skb = sock_alloc_send_skb(sk, len, 1, &err);
 		if (unlikely(!skb)) {
-			err = -EAGAIN;
 			goto out;
 		}