* [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64
@ 2022-02-24 15:34 Martin Doucha
2022-02-25 10:56 ` Petr Vorel
2022-02-25 11:21 ` Cyril Hrubis
0 siblings, 2 replies; 4+ messages in thread
From: Martin Doucha @ 2022-02-24 15:34 UTC (permalink / raw)
To: ltp
struct tpacket_req3.tp_block_size value must be a multiple of page size.
Replace constants with values calculated from actual page size to fix
setsockopt() tests on PPC64 which has 64KB pages instead of 4KB.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
testcases/kernel/syscalls/setsockopt/setsockopt06.c | 6 ++++--
testcases/kernel/syscalls/setsockopt/setsockopt07.c | 6 ++++--
testcases/kernel/syscalls/setsockopt/setsockopt09.c | 4 +++-
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt06.c b/testcases/kernel/syscalls/setsockopt/setsockopt06.c
index 12a80dee4..644e61f3f 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt06.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt06.c
@@ -28,6 +28,7 @@
#include "lapi/if_ether.h"
static int sock = -1;
+static unsigned int pagesize;
static struct tst_fzsync_pair fzsync_pair;
static void setup(void)
@@ -35,6 +36,7 @@ static void setup(void)
int real_uid = getuid();
int real_gid = getgid();
+ pagesize = SAFE_SYSCONF(_SC_PAGESIZE);
SAFE_TRY_FILE_PRINTF("/proc/sys/user/max_user_namespaces", "%d", 10);
SAFE_UNSHARE(CLONE_NEWUSER);
@@ -52,9 +54,9 @@ static void *thread_run(void *arg)
{
int ret;
struct tpacket_req3 req = {
- .tp_block_size = 4096,
+ .tp_block_size = pagesize,
.tp_block_nr = 1,
- .tp_frame_size = 4096,
+ .tp_frame_size = pagesize,
.tp_frame_nr = 1,
.tp_retire_blk_tov = 100
};
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt07.c b/testcases/kernel/syscalls/setsockopt/setsockopt07.c
index d2c568e3e..d22f9918b 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt07.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt07.c
@@ -31,6 +31,7 @@
#include "lapi/if_ether.h"
static int sock = -1;
+static unsigned int pagesize;
static struct tst_fzsync_pair fzsync_pair;
static void setup(void)
@@ -38,6 +39,7 @@ static void setup(void)
int real_uid = getuid();
int real_gid = getgid();
+ pagesize = SAFE_SYSCONF(_SC_PAGESIZE);
SAFE_TRY_FILE_PRINTF("/proc/sys/user/max_user_namespaces", "%d", 10);
SAFE_UNSHARE(CLONE_NEWUSER);
@@ -73,9 +75,9 @@ static void run(void)
unsigned int val, version = TPACKET_V3;
socklen_t vsize = sizeof(val);
struct tpacket_req3 req = {
- .tp_block_size = 4096,
+ .tp_block_size = pagesize,
.tp_block_nr = 1,
- .tp_frame_size = 4096,
+ .tp_frame_size = pagesize,
.tp_frame_nr = 1,
.tp_retire_blk_tov = 100
};
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt09.c b/testcases/kernel/syscalls/setsockopt/setsockopt09.c
index baaefda15..2fc66ebbc 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt09.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt09.c
@@ -31,12 +31,14 @@
#include "lapi/if_packet.h"
static int sock = -1;
+static unsigned int pagesize;
static void setup(void)
{
int real_uid = getuid();
int real_gid = getgid();
+ pagesize = SAFE_SYSCONF(_SC_PAGESIZE);
SAFE_TRY_FILE_PRINTF("/proc/sys/user/max_user_namespaces", "%d", 10);
SAFE_UNSHARE(CLONE_NEWUSER);
@@ -50,7 +52,7 @@ static void run(void)
{
unsigned int version = TPACKET_V3;
struct tpacket_req3 req = {
- .tp_block_size = 16384,
+ .tp_block_size = 4 * pagesize,
.tp_block_nr = 256,
.tp_frame_size = TPACKET_ALIGNMENT << 7,
.tp_retire_blk_tov = 64,
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64
2022-02-24 15:34 [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64 Martin Doucha
@ 2022-02-25 10:56 ` Petr Vorel
2022-02-25 11:21 ` Cyril Hrubis
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-02-25 10:56 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi Martin,
> struct tpacket_req3.tp_block_size value must be a multiple of page size.
> Replace constants with values calculated from actual page size to fix
> setsockopt() tests on PPC64 which has 64KB pages instead of 4KB.
Thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Before merging this I'll just fix breaking CI (missing libmm-dev in Debian testing).
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64
2022-02-24 15:34 [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64 Martin Doucha
2022-02-25 10:56 ` Petr Vorel
@ 2022-02-25 11:21 ` Cyril Hrubis
2022-02-25 11:41 ` Petr Vorel
1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2022-02-25 11:21 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
Looks good to me as well.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64
2022-02-25 11:21 ` Cyril Hrubis
@ 2022-02-25 11:41 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-02-25 11:41 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi Martin, Cyril,
> Hi!
> Looks good to me as well.
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Merged. I'm sorry I overlooked your ack.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-25 11:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-24 15:34 [LTP] [PATCH] Fix setsockopt(PACKET_RX_RING) usage on PPC64 Martin Doucha
2022-02-25 10:56 ` Petr Vorel
2022-02-25 11:21 ` Cyril Hrubis
2022-02-25 11:41 ` Petr Vorel
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.