RE: [PATCH bpf 10/11] bpf: sockmap, test shutdown() correctly exits epoll and recv()=0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Fastabend wrote:
> When session gracefully shutdowns epoll needs to wake up and any recv()
> readers should return 0 not the -EAGAIN they previously returned.
> 
> Note we use epoll instead of select to test the epoll wake on shutdown
> event as well.
> 
> Signed-off-by: John Fastabend <john.fastabend@xxxxxxxxx>
> ---
>  .../selftests/bpf/prog_tests/sockmap_basic.c  | 71 ++++++++++++++++++-
>  .../bpf/progs/test_sockmap_pass_prog.c        | 32 +++++++++
>  2 files changed, 100 insertions(+), 3 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/test_sockmap_pass_prog.c
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> index 0aa088900699..38a22c71b8dd 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> @@ -2,6 +2,7 @@
>  // Copyright (c) 2020 Cloudflare
>  #include <error.h>
>  #include <netinet/tcp.h>
> +#include <sys/epoll.h>
>  
>  #include "test_progs.h"
>  #include "test_skmsg_load_helpers.skel.h"
> @@ -9,8 +10,11 @@
>  #include "test_sockmap_invalid_update.skel.h"
>  #include "test_sockmap_skb_verdict_attach.skel.h"
>  #include "test_sockmap_progs_query.skel.h"
> +#include "test_sockmap_pass_prog.skel.h"
>  #include "bpf_iter_sockmap.skel.h"
>  
> +#include "sockmap_helpers.h"
> +
>  #define TCP_REPAIR		19	/* TCP sock is under repair right now */
>  
>  #define TCP_REPAIR_ON		1
> @@ -286,9 +290,6 @@ static void test_sockmap_skb_verdict_attach(enum bpf_attach_type first,
>  	err = bpf_prog_attach(verdict, map, second, 0);
>  	ASSERT_EQ(err, -EBUSY, "prog_attach_fail");
>  
> -	err = bpf_prog_detach2(verdict, map, first);
> -	if (!ASSERT_OK(err, "bpf_prog_detach2"))
> -		goto out;

Also shouldn't have cut these will add this back in v2.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux