summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-01-09 15:54:31 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-01-09 15:54:31 +0000
commitaa96ab7c9df59c615ca82b49c9062819e0a1c287 (patch)
treebf05b6e1bb617f15cd5320822c21aee4f65e5f6b /net
parentd6271b657286de80260413684a1f2a63f44ea17b (diff)
parent6f997b8964188c155240380efdf3b1d7ec41c882 (diff)
downloadqemu-aa96ab7c9df59c615ca82b49c9062819e0a1c287.tar.gz
Merge tag 'pull-request-2023-01-09' of https://gitlab.com/thuth/qemu into staging
* s390x header clean-ups from Philippe * Rework and improvements of the EINTR handling by Nikita * Deprecate the -no-hpet command line option * Disable the qtests in the 32-bit Windows CI job again * Some other misc fixes here and there # gpg: Signature made Mon 09 Jan 2023 14:21:19 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2023-01-09' of https://gitlab.com/thuth/qemu: .gitlab-ci.d/windows: Do not run the qtests in the msys2-32bit job error handling: Use RETRY_ON_EINTR() macro where applicable Refactoring: refactor TFR() macro to RETRY_ON_EINTR() docs/interop: Change the vnc-ledstate-Pseudo-encoding doc into .rst i386: Deprecate the -no-hpet QEMU command line option tests/qtest/bios-tables-test: Replace -no-hpet with hpet=off machine parameter tests/readconfig: spice doesn't support unix socket on windows yet target/s390x: Restrict sysemu/reset.h to system emulation target/s390x/tcg/excp_helper: Restrict system headers to sysemu target/s390x/tcg/misc_helper: Remove unused "memory.h" include hw/s390x/pv: Restrict Protected Virtualization to sysemu exec/memory: Expose memory_region_access_valid() MAINTAINERS: Add MIPS-related docs and configs to the MIPS architecture section tests/vm: Update get_default_jobs() to work on non-x86_64 non-KVM hosts qemu-iotests/stream-under-throttle: do not shutdown QEMU Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net')
-rw-r--r--net/l2tpv3.c17
-rw-r--r--net/socket.c16
-rw-r--r--net/tap-bsd.c6
-rw-r--r--net/tap-linux.c2
-rw-r--r--net/tap-solaris.c8
-rw-r--r--net/tap.c10
6 files changed, 23 insertions, 36 deletions
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 5852e42738..53b2d32573 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -240,9 +240,7 @@ static ssize_t net_l2tpv3_receive_dgram_iov(NetClientState *nc,
message.msg_control = NULL;
message.msg_controllen = 0;
message.msg_flags = 0;
- do {
- ret = sendmsg(s->fd, &message, 0);
- } while ((ret == -1) && (errno == EINTR));
+ ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
if (ret > 0) {
ret -= s->offset;
} else if (ret == 0) {
@@ -285,9 +283,7 @@ static ssize_t net_l2tpv3_receive_dgram(NetClientState *nc,
message.msg_control = NULL;
message.msg_controllen = 0;
message.msg_flags = 0;
- do {
- ret = sendmsg(s->fd, &message, 0);
- } while ((ret == -1) && (errno == EINTR));
+ ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
if (ret > 0) {
ret -= s->offset;
} else if (ret == 0) {
@@ -434,12 +430,9 @@ static void net_l2tpv3_send(void *opaque)
msgvec = s->msgvec + s->queue_head;
if (target_count > 0) {
- do {
- count = recvmmsg(
- s->fd,
- msgvec,
- target_count, MSG_DONTWAIT, NULL);
- } while ((count == -1) && (errno == EINTR));
+ count = RETRY_ON_EINTR(
+ recvmmsg(s->fd, msgvec, target_count, MSG_DONTWAIT, NULL)
+ );
if (count < 0) {
/* Recv error - we still need to flush packets here,
* (re)set queue head to current position
diff --git a/net/socket.c b/net/socket.c
index b67437a1f0..2fc5696755 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -117,15 +117,13 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
ssize_t ret;
- do {
- if (s->dgram_dst.sin_family != AF_UNIX) {
- ret = sendto(s->fd, buf, size, 0,
- (struct sockaddr *)&s->dgram_dst,
- sizeof(s->dgram_dst));
- } else {
- ret = send(s->fd, buf, size, 0);
- }
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(
+ s->dgram_dst.sin_family != AF_UNIX ?
+ sendto(s->fd, buf, size, 0,
+ (struct sockaddr *)&s->dgram_dst,
+ sizeof(s->dgram_dst)) :
+ send(s->fd, buf, size, 0)
+ );
if (ret == -1 && errno == EAGAIN) {
net_socket_write_poll(s, true);
diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index 005ce05c6e..4c98fdd337 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -56,7 +56,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
} else {
snprintf(dname, sizeof dname, "/dev/tap%d", i);
}
- TFR(fd = open(dname, O_RDWR));
+ fd = RETRY_ON_EINTR(open(dname, O_RDWR));
if (fd >= 0) {
break;
}
@@ -111,7 +111,7 @@ static int tap_open_clone(char *ifname, int ifname_size, Error **errp)
int fd, s, ret;
struct ifreq ifr;
- TFR(fd = open(PATH_NET_TAP, O_RDWR));
+ fd = RETRY_ON_EINTR(open(PATH_NET_TAP, O_RDWR));
if (fd < 0) {
error_setg_errno(errp, errno, "could not open %s", PATH_NET_TAP);
return -1;
@@ -159,7 +159,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
if (ifname[0] != '\0') {
char dname[100];
snprintf(dname, sizeof dname, "/dev/%s", ifname);
- TFR(fd = open(dname, O_RDWR));
+ fd = RETRY_ON_EINTR(open(dname, O_RDWR));
if (fd < 0 && errno != ENOENT) {
error_setg_errno(errp, errno, "could not open %s", dname);
return -1;
diff --git a/net/tap-linux.c b/net/tap-linux.c
index 304ff45071..f54f308d35 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -45,7 +45,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
int len = sizeof(struct virtio_net_hdr);
unsigned int features;
- TFR(fd = open(PATH_NET_TUN, O_RDWR));
+ fd = RETRY_ON_EINTR(open(PATH_NET_TUN, O_RDWR));
if (fd < 0) {
error_setg_errno(errp, errno, "could not open %s", PATH_NET_TUN);
return -1;
diff --git a/net/tap-solaris.c b/net/tap-solaris.c
index a44f8805c2..38e15028bf 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -84,13 +84,13 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if( ip_fd )
close(ip_fd);
- TFR(ip_fd = open("/dev/udp", O_RDWR, 0));
+ ip_fd = RETRY_ON_EINTR(open("/dev/udp", O_RDWR, 0));
if (ip_fd < 0) {
error_setg(errp, "Can't open /dev/ip (actually /dev/udp)");
return -1;
}
- TFR(tap_fd = open("/dev/tap", O_RDWR, 0));
+ tap_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (tap_fd < 0) {
error_setg(errp, "Can't open /dev/tap");
return -1;
@@ -104,7 +104,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if ((ppa = ioctl (tap_fd, I_STR, &strioc_ppa)) < 0)
error_report("Can't assign new interface");
- TFR(if_fd = open("/dev/tap", O_RDWR, 0));
+ if_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (if_fd < 0) {
error_setg(errp, "Can't open /dev/tap (2)");
return -1;
@@ -137,7 +137,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if (ioctl (ip_fd, I_PUSH, "arp") < 0)
error_report("Can't push ARP module (3)");
/* Open arp_fd */
- TFR(arp_fd = open ("/dev/tap", O_RDWR, 0));
+ arp_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (arp_fd < 0)
error_report("Can't open %s", "/dev/tap");
diff --git a/net/tap.c b/net/tap.c
index e28ceb078f..7d7bc1dc5f 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -102,9 +102,7 @@ static ssize_t tap_write_packet(TAPState *s, const struct iovec *iov, int iovcnt
{
ssize_t len;
- do {
- len = writev(s->fd, iov, iovcnt);
- } while (len == -1 && errno == EINTR);
+ len = RETRY_ON_EINTR(writev(s->fd, iov, iovcnt));
if (len == -1 && errno == EAGAIN) {
tap_write_poll(s, true);
@@ -577,9 +575,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
close(sv[1]);
- do {
- fd = recv_fd(sv[0]);
- } while (fd == -1 && errno == EINTR);
+ fd = RETRY_ON_EINTR(recv_fd(sv[0]));
saved_errno = errno;
close(sv[0]);
@@ -650,7 +646,7 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr,
vnet_hdr_required = 0;
}
- TFR(fd = tap_open(ifname, ifname_sz, vnet_hdr, vnet_hdr_required,
+ fd = RETRY_ON_EINTR(tap_open(ifname, ifname_sz, vnet_hdr, vnet_hdr_required,
mq_required, errp));
if (fd < 0) {
return -1;