All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf: Simplify the calculation of variables
@ 2021-02-05  6:27 Jiapeng Chong
  2021-02-09  5:20 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Jiapeng Chong @ 2021-02-05  6:27 UTC (permalink / raw)
  To: ast
  Cc: daniel, davem, kuba, hawk, john.fastabend, shuah, andrii, kafai,
	songliubraving, yhs, kpsingh, netdev, bpf, linux-kselftest,
	linux-kernel, Jiapeng Chong

Fix the following coccicheck warnings:

./tools/testing/selftests/bpf/xdpxceiver.c:954:28-30: WARNING !A || A &&
B is equivalent to !A || B.

./tools/testing/selftests/bpf/xdpxceiver.c:932:28-30: WARNING !A || A &&
B is equivalent to !A || B.

./tools/testing/selftests/bpf/xdpxceiver.c:909:28-30: WARNING !A || A &&
B is equivalent to !A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/testing/selftests/bpf/xdpxceiver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 1e722ee..98ad4a2 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -906,7 +906,7 @@ static void *worker_testapp_validate(void *arg)
 			ksft_print_msg("Destroying socket\n");
 	}
 
-	if (!opt_bidi || (opt_bidi && bidi_pass)) {
+	if (!opt_bidi || bidi_pass) {
 		xsk_socket__delete(((struct ifobject *)arg)->xsk->xsk);
 		(void)xsk_umem__delete(((struct ifobject *)arg)->umem->umem);
 	}
@@ -929,7 +929,7 @@ static void testapp_validate(void)
 	pthread_mutex_lock(&sync_mutex);
 
 	/*Spawn RX thread */
-	if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+	if (!opt_bidi || !bidi_pass) {
 		if (pthread_create(&t0, &attr, worker_testapp_validate, (void *)ifdict[1]))
 			exit_with_error(errno);
 	} else if (opt_bidi && bidi_pass) {
@@ -951,7 +951,7 @@ static void testapp_validate(void)
 	pthread_mutex_unlock(&sync_mutex);
 
 	/*Spawn TX thread */
-	if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+	if (!opt_bidi || !bidi_pass) {
 		if (pthread_create(&t1, &attr, worker_testapp_validate, (void *)ifdict[0]))
 			exit_with_error(errno);
 	} else if (opt_bidi && bidi_pass) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/bpf: Simplify the calculation of variables
  2021-02-05  6:27 [PATCH] selftests/bpf: Simplify the calculation of variables Jiapeng Chong
@ 2021-02-09  5:20 ` Andrii Nakryiko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2021-02-09  5:20 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, john fastabend,
	Shuah Khan, Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
	KP Singh, Networking, bpf, open list:KERNEL SELFTEST FRAMEWORK,
	open list

On Thu, Feb 4, 2021 at 10:27 PM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> Fix the following coccicheck warnings:
>
> ./tools/testing/selftests/bpf/xdpxceiver.c:954:28-30: WARNING !A || A &&
> B is equivalent to !A || B.
>
> ./tools/testing/selftests/bpf/xdpxceiver.c:932:28-30: WARNING !A || A &&
> B is equivalent to !A || B.
>
> ./tools/testing/selftests/bpf/xdpxceiver.c:909:28-30: WARNING !A || A &&
> B is equivalent to !A || B.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---

This doesn't apply cleanly onto bpf-next anymore. Please rebase and
re-submit. Make sure to include [PATCH bpf-next] prefix in your email
subject. Thanks!

>  tools/testing/selftests/bpf/xdpxceiver.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
> index 1e722ee..98ad4a2 100644
> --- a/tools/testing/selftests/bpf/xdpxceiver.c
> +++ b/tools/testing/selftests/bpf/xdpxceiver.c
> @@ -906,7 +906,7 @@ static void *worker_testapp_validate(void *arg)
>                         ksft_print_msg("Destroying socket\n");
>         }
>
> -       if (!opt_bidi || (opt_bidi && bidi_pass)) {
> +       if (!opt_bidi || bidi_pass) {
>                 xsk_socket__delete(((struct ifobject *)arg)->xsk->xsk);
>                 (void)xsk_umem__delete(((struct ifobject *)arg)->umem->umem);
>         }
> @@ -929,7 +929,7 @@ static void testapp_validate(void)
>         pthread_mutex_lock(&sync_mutex);
>
>         /*Spawn RX thread */
> -       if (!opt_bidi || (opt_bidi && !bidi_pass)) {
> +       if (!opt_bidi || !bidi_pass) {
>                 if (pthread_create(&t0, &attr, worker_testapp_validate, (void *)ifdict[1]))
>                         exit_with_error(errno);
>         } else if (opt_bidi && bidi_pass) {
> @@ -951,7 +951,7 @@ static void testapp_validate(void)
>         pthread_mutex_unlock(&sync_mutex);
>
>         /*Spawn TX thread */
> -       if (!opt_bidi || (opt_bidi && !bidi_pass)) {
> +       if (!opt_bidi || !bidi_pass) {
>                 if (pthread_create(&t1, &attr, worker_testapp_validate, (void *)ifdict[0]))
>                         exit_with_error(errno);
>         } else if (opt_bidi && bidi_pass) {
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/bpf: Simplify the calculation of variables
  2021-03-03  7:52 Jiapeng Chong
@ 2021-03-03 15:58 ` Yonghong Song
  0 siblings, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2021-03-03 15:58 UTC (permalink / raw)
  To: Jiapeng Chong, shuah
  Cc: ast, daniel, andrii, kafai, songliubraving, john.fastabend,
	kpsingh, linux-kselftest, netdev, bpf, linux-kernel



On 3/2/21 11:52 PM, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./tools/testing/selftests/bpf/test_sockmap.c:735:35-37: WARNING !A || A
> && B is equivalent to !A || B.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] selftests/bpf: Simplify the calculation of variables
@ 2021-03-03  7:52 Jiapeng Chong
  2021-03-03 15:58 ` Yonghong Song
  0 siblings, 1 reply; 5+ messages in thread
From: Jiapeng Chong @ 2021-03-03  7:52 UTC (permalink / raw)
  To: shuah
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, linux-kselftest, netdev, bpf, linux-kernel,
	Jiapeng Chong

Fix the following coccicheck warnings:

./tools/testing/selftests/bpf/test_sockmap.c:735:35-37: WARNING !A || A
&& B is equivalent to !A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/testing/selftests/bpf/test_sockmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 427ca00..eefd445 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -732,7 +732,7 @@ static int sendmsg_test(struct sockmap_options *opt)
 		 * socket is not a valid test. So in this case lets not
 		 * enable kTLS but still run the test.
 		 */
-		if (!txmsg_redir || (txmsg_redir && txmsg_ingress)) {
+		if (!txmsg_redir || txmsg_ingress) {
 			err = sockmap_init_ktls(opt->verbose, rx_fd);
 			if (err)
 				return err;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] selftests/bpf: Simplify the calculation of variables
@ 2021-02-09  8:39 Jiapeng Chong
  0 siblings, 0 replies; 5+ messages in thread
From: Jiapeng Chong @ 2021-02-09  8:39 UTC (permalink / raw)
  To: ast
  Cc: daniel, davem, kuba, hawk, john.fastabend, shuah, andrii, kafai,
	songliubraving, yhs, kpsingh, netdev, bpf, linux-kselftest,
	linux-kernel, Jiapeng Chong

Fix the following coccicheck warnings:

./tools/testing/selftests/bpf/xdpxceiver.c:954:28-30: WARNING !A || A &&
B is equivalent to !A || B.

./tools/testing/selftests/bpf/xdpxceiver.c:932:28-30: WARNING !A || A &&
B is equivalent to !A || B.

./tools/testing/selftests/bpf/xdpxceiver.c:909:28-30: WARNING !A || A &&
B is equivalent to !A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/testing/selftests/bpf/xdpxceiver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 99ea6cf..f4a96d5 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -897,7 +897,7 @@ static void *worker_testapp_validate(void *arg)
 			ksft_print_msg("Destroying socket\n");
 	}
 
-	if (!opt_bidi || (opt_bidi && bidi_pass)) {
+	if (!opt_bidi || bidi_pass) {
 		xsk_socket__delete(ifobject->xsk->xsk);
 		(void)xsk_umem__delete(ifobject->umem->umem);
 	}
@@ -922,7 +922,7 @@ static void testapp_validate(void)
 	pthread_mutex_lock(&sync_mutex);
 
 	/*Spawn RX thread */
-	if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+	if (!opt_bidi || !bidi_pass) {
 		if (pthread_create(&t0, &attr, worker_testapp_validate, ifdict[1]))
 			exit_with_error(errno);
 	} else if (opt_bidi && bidi_pass) {
@@ -942,7 +942,7 @@ static void testapp_validate(void)
 	pthread_mutex_unlock(&sync_mutex);
 
 	/*Spawn TX thread */
-	if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+	if (!opt_bidi || !bidi_pass) {
 		if (pthread_create(&t1, &attr, worker_testapp_validate, ifdict[0]))
 			exit_with_error(errno);
 	} else if (opt_bidi && bidi_pass) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-03 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  6:27 [PATCH] selftests/bpf: Simplify the calculation of variables Jiapeng Chong
2021-02-09  5:20 ` Andrii Nakryiko
2021-02-09  8:39 Jiapeng Chong
2021-03-03  7:52 Jiapeng Chong
2021-03-03 15:58 ` Yonghong Song

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.