public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH] tap: Send frames after the first one in tap_send_frames_pasta()
Date: Mon, 13 Feb 2023 02:12:11 +0100	[thread overview]
Message-ID: <20230213011211.1198729-1-sbrivio@redhat.com> (raw)

...instead of repeatedly sending out the first one in iov.

Fixes: e21ee41ac35a ("tcp: Combine two parts of pasta tap send path together")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
I just applied this, to unblock a series by David which was pending
for way too long. The commit reference in Fixes: refers to a commit
from said series which I'm pushing out together with this patch.

Posting anyway for reviews.

 tap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tap.c b/tap.c
index af9bc15..716d887 100644
--- a/tap.c
+++ b/tap.c
@@ -316,12 +316,13 @@ static void tap_send_frames_pasta(struct ctx *c,
 {
 	size_t i;
 
-	for (i = 0; i < n; i++) {
+	for (i = 0; i < n; i++, iov++) {
 		if (write(c->fd_tap, (char *)iov->iov_base, iov->iov_len) < 0) {
 			debug("tap write: %s", strerror(errno));
 			if (errno != EAGAIN && errno != EWOULDBLOCK)
 				tap_handler(c, c->fd_tap, EPOLLERR, NULL);
 			i--;
+			iov--;
 		}
 	}
 }
-- 
@@ -316,12 +316,13 @@ static void tap_send_frames_pasta(struct ctx *c,
 {
 	size_t i;
 
-	for (i = 0; i < n; i++) {
+	for (i = 0; i < n; i++, iov++) {
 		if (write(c->fd_tap, (char *)iov->iov_base, iov->iov_len) < 0) {
 			debug("tap write: %s", strerror(errno));
 			if (errno != EAGAIN && errno != EWOULDBLOCK)
 				tap_handler(c, c->fd_tap, EPOLLERR, NULL);
 			i--;
+			iov--;
 		}
 	}
 }
-- 
2.35.1


             reply	other threads:[~2023-02-13  1:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13  1:12 Stefano Brivio [this message]
2023-02-13  2:24 ` [PATCH] tap: Send frames after the first one in tap_send_frames_pasta() David Gibson
2023-02-13 10:46   ` Stefano Brivio
2023-02-13 23:39     ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230213011211.1198729-1-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).