From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 5386E5A005E for ; Wed, 15 Feb 2023 13:17:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676463458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mfqeyoQqiYhtuZtrMHOiL0dZSEWRO2wqUU6mny587Tg=; b=cqfORchApKjNYHW6ldgssQW12IpapPsIIjydSjWkOw7Ljt9EWhZFcRDmEHC7ivZr5zkTUs FvfbVV9/80gHBQ6ye/6tbOEj1o6triKLR6xam8zjNAVWON8rRO1REtdhkDBdGy4drC5rEm Iu1LvKr1T+VpjGhw0zMbYicDDejDACY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-79-Zs3I8gHnMzejKttcLbmA9w-1; Wed, 15 Feb 2023 07:17:36 -0500 X-MC-Unique: Zs3I8gHnMzejKttcLbmA9w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA2401C06ECB; Wed, 15 Feb 2023 12:17:35 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD01AC15BA0; Wed, 15 Feb 2023 12:17:35 +0000 (UTC) Date: Wed, 15 Feb 2023 13:17:33 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 3/4] tcp: Remove 'recvmsg' goto from tcp_data_from_sock Message-ID: <20230215131733.418a03e9@elisabeth> In-Reply-To: <20230127051110.2513363-4-david@gibson.dropbear.id.au> References: <20230127051110.2513363-1-david@gibson.dropbear.id.au> <20230127051110.2513363-4-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 37AYUMTXEEC4CJNQTXQHZKAI7TJ5JWFT X-Message-ID-Hash: 37AYUMTXEEC4CJNQTXQHZKAI7TJ5JWFT X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Nit: On Fri, 27 Jan 2023 16:11:09 +1100 David Gibson wrote: > This goto can be handled just as simply and more clearly with a do while. > > Signed-off-by: David Gibson > --- > tcp.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/tcp.c b/tcp.c > index f0085e3..f7228d1 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -2158,13 +2158,12 @@ static int tcp_data_from_sock(struct ctx *c, struct tcp_tap_conn *conn) > iov_sock[fill_bufs].iov_len = iov_rem; > > /* Receive into buffers, don't dequeue until acknowledged by guest. */ > -recvmsg: > - len = recvmsg(s, &mh_sock, MSG_PEEK); > - if (len < 0) { > - if (errno == EINTR) > - goto recvmsg; > + do { > + len = recvmsg(s, &mh_sock, MSG_PEEK); > + } while (len < 0 && errno == EINTR); For consistency, we shouldn't use curly brackets if there's a single line in the loop body (only other occurrence: pasta_wait_for_ns()). I don't have a strong preference here and I can also fix it up on merge, by the way. -- Stefano