Skip to contentSkip to conversation

selftests: net: tcp_mmap: fix SO_RCVLOWAT setting

PATCH Applied Eric Dumazet 3 participants 4 messages May 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: net: tcp_mmap: fix SO_RCVLOWAT setting

Since chunk_size is no longer an integer, we can not use it directly as an argument of setsockopt().

This patch should fix tcp_mmap for Big Endian kernels.

Fixes 597b01edafac ("selftests: net: avoid ptl lock contention in tcp_mmap")
Cc Soheil Hassas Yeganeh <[email protected]>
Cc Arjun Roy <[email protected]>
---
 tools/testing/selftests/net/tcp_mmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/net/tcp_mmap.c +3 -1
index 62171fd638c817dabe2d988f3cfae74522112584..4555f88252bafd31d6c225590316f03b08d3b132 100644
@@ -282,12 +282,14 @@ static void setup_sockaddr(int domain, const char *str_addr,
 static void do_accept(int fdlisten)
 {
 	pthread_attr_t attr;
+	int rcvlowat;
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
+	rcvlowat = chunk_size;
 	if (setsockopt(fdlisten, SOL_SOCKET, SO_RCVLOWAT,
-		       &chunk_size, sizeof(chunk_size)) == -1) {
+		       &rcvlowat, sizeof(rcvlowat)) == -1) {
 		perror("setsockopt SO_RCVLOWAT");
 	}
 
Signature · 1 line
2.26.2.526.g744177e7f7-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Eric Dumazet

Since chunk_size is no longer an integer, we can not use it directly as an argument of setsockopt().

This patch should fix tcp_mmap for Big Endian kernels.

Fixes 597b01edafac ("selftests: net: avoid ptl lock contention in tcp_mmap")
Cc Soheil Hassas Yeganeh <[email protected]>
Cc Arjun Roy <[email protected]>
Quoted 27 lines
---
 tools/testing/selftests/net/tcp_mmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/net/tcp_mmap.c +3 -2
index 62171fd638c817dabe2d988f3cfae74522112584..4555f88252bafd31d6c225590316f03b08d3b132 100644
@@ -282,12 +282,14 @@ static void setup_sockaddr(int domain, const char *str_addr,
 static void do_accept(int fdlisten)
 {
        pthread_attr_t attr;
+       int rcvlowat;
 
        pthread_attr_init(&attr);
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
+       rcvlowat = chunk_size;
        if (setsockopt(fdlisten, SOL_SOCKET, SO_RCVLOWAT,
-                      &chunk_size, sizeof(chunk_size)) == -1) {
+                      &rcvlowat, sizeof(rcvlowat)) == -1) {
                perror("setsockopt SO_RCVLOWAT");
        }
 
--

2.26.2.526.g744177e7f7-goog

maintainer Applied
#2 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Wed, 6 May 2020 09:21:15 -0700

Quoted 7 lines

Since chunk_size is no longer an integer, we can not use it directly as an argument of setsockopt().

This patch should fix tcp_mmap for Big Endian kernels.

Fixes 597b01edafac ("selftests: net: avoid ptl lock contention in tcp_mmap")

Applied, thanks Eric.

maintainer
#3 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Wed, 6 May 2020 09:21:15 -0700

Quoted 7 lines

Since chunk_size is no longer an integer, we can not use it directly as an argument of setsockopt().

This patch should fix tcp_mmap for Big Endian kernels.

Fixes 597b01edafac ("selftests: net: avoid ptl lock contention in tcp_mmap")

Applied and queued up for -stable.