Re: [PATCH] selftests/bpf: Simplify the calculation of variables

2021-03-03 Thread Yonghong Song




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 
Signed-off-by: Jiapeng Chong 


Acked-by: Yonghong Song 


[PATCH] selftests/bpf: Simplify the calculation of variables

2021-03-03 Thread 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 
Signed-off-by: Jiapeng Chong 
---
 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



[PATCH] selftests/bpf: Simplify the calculation of variables

2021-02-09 Thread 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 
Signed-off-by: Jiapeng Chong 
---
 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(_mutex);
 
/*Spawn RX thread */
-   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+   if (!opt_bidi || !bidi_pass) {
if (pthread_create(, , 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(_mutex);
 
/*Spawn TX thread */
-   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+   if (!opt_bidi || !bidi_pass) {
if (pthread_create(, , worker_testapp_validate, 
ifdict[0]))
exit_with_error(errno);
} else if (opt_bidi && bidi_pass) {
-- 
1.8.3.1



Re: [PATCH] selftests/bpf: Simplify the calculation of variables

2021-02-08 Thread Andrii Nakryiko
On Thu, Feb 4, 2021 at 10:27 PM Jiapeng Chong
 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 
> Signed-off-by: Jiapeng Chong 
> ---

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(_mutex);
>
> /*Spawn RX thread */
> -   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
> +   if (!opt_bidi || !bidi_pass) {
> if (pthread_create(, , 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(_mutex);
>
> /*Spawn TX thread */
> -   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
> +   if (!opt_bidi || !bidi_pass) {
> if (pthread_create(, , worker_testapp_validate, (void 
> *)ifdict[0]))
> exit_with_error(errno);
> } else if (opt_bidi && bidi_pass) {
> --
> 1.8.3.1
>


[PATCH] selftests/bpf: Simplify the calculation of variables

2021-02-04 Thread 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 
Signed-off-by: Jiapeng Chong 
---
 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(_mutex);
 
/*Spawn RX thread */
-   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+   if (!opt_bidi || !bidi_pass) {
if (pthread_create(, , 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(_mutex);
 
/*Spawn TX thread */
-   if (!opt_bidi || (opt_bidi && !bidi_pass)) {
+   if (!opt_bidi || !bidi_pass) {
if (pthread_create(, , worker_testapp_validate, (void 
*)ifdict[0]))
exit_with_error(errno);
} else if (opt_bidi && bidi_pass) {
-- 
1.8.3.1