From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 290825A0272 for ; Tue, 6 Feb 2024 03:29:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707186581; bh=lYwsY6FpdvkmvZV0eybdraznwofEJlEj4Py9YaJ8mvQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YRhDhGjRYiWoC0AWnO5vKs/mU/Kvm1SDC9drQXXbtNPnGIMBHU67vCWdk+Vvbg2SI pOxafG0eZ4CncsPEc+RSMakUm46qKmu30jnhc0Zzo9hpfW+50er4Hxxk5knr+0/Aj2 dZK1ja+rPL5Bj1pGze+6veH1M0ofK6NEthedqvQdEN19yImTZuCwCobxAMnVD+CmdQ 7wWkymPciHpJep5r+SUJS7iaPqi4Ixr+FehbRuhyRZ4HFeljZRnvfYk6+iUsQiFAbo 08qAGet6Y8aZ5o3omxEp+zlgpXsMDie7tfhY1yFO58Rw1mtKToSQOG2d+si3TLEshi QFZpFvT1xDzGg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TTRz91WfKz4wxx; Tue, 6 Feb 2024 13:29:41 +1100 (AEDT) Date: Tue, 6 Feb 2024 13:29:37 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 17/24] vhost-user: compare mode MODE_PASTA and not MODE_PASST Message-ID: References: <20240202141151.3762941-1-lvivier@redhat.com> <20240202141151.3762941-18-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4IpoXOqSA4oTLDMl" Content-Disposition: inline In-Reply-To: <20240202141151.3762941-18-lvivier@redhat.com> Message-ID-Hash: XPJDB742AKPY5V7PZRT4HDY5D23CV7Y5 X-Message-ID-Hash: XPJDB742AKPY5V7PZRT4HDY5D23CV7Y5 X-MailFrom: dgibson@gandalf.ozlabs.org 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.8 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: --4IpoXOqSA4oTLDMl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 02, 2024 at 03:11:44PM +0100, Laurent Vivier wrote: > As we are going to introduce the MODE_VU that will act like > the mode MODE_PASST, compare to MODE_PASTA rather than to add > a comparison to MODE_VU when we check for MODE_PASST. I have vague plans to make this more sensible with many of the mode checks replaced with checks on the pif type, but this looks fine for now. =20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > conf.c | 12 ++++++------ > isolation.c | 10 +++++----- > passt.c | 2 +- > tap.c | 12 ++++++------ > tcp_buf.c | 2 +- > udp.c | 2 +- > 6 files changed, 20 insertions(+), 20 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index 93bfda331349..b6a2a1f0fdc3 100644 > --- a/conf.c > +++ b/conf.c > @@ -147,7 +147,7 @@ static void conf_ports(const struct ctx *c, char optn= ame, const char *optarg, > if (fwd->mode) > goto mode_conflict; > =20 > - if (c->mode !=3D MODE_PASST) > + if (c->mode =3D=3D MODE_PASTA) > die("'all' port forwarding is only allowed for passt"); > =20 > fwd->mode =3D FWD_ALL; > @@ -1240,7 +1240,7 @@ void conf(struct ctx *c, int argc, char **argv) > c->no_dhcp_dns =3D 0; > break; > case 6: > - if (c->mode !=3D MODE_PASST) > + if (c->mode =3D=3D MODE_PASTA) > die("--no-dhcp-dns is for passt mode only"); > =20 > c->no_dhcp_dns =3D 1; > @@ -1252,7 +1252,7 @@ void conf(struct ctx *c, int argc, char **argv) > c->no_dhcp_dns_search =3D 0; > break; > case 8: > - if (c->mode !=3D MODE_PASST) > + if (c->mode =3D=3D MODE_PASTA) > die("--no-dhcp-search is for passt mode only"); > =20 > c->no_dhcp_dns_search =3D 1; > @@ -1307,7 +1307,7 @@ void conf(struct ctx *c, int argc, char **argv) > break; > case 14: > fprintf(stdout, > - c->mode =3D=3D MODE_PASST ? "passt " : "pasta "); > + c->mode =3D=3D MODE_PASTA ? "pasta " : "passt "); > fprintf(stdout, VERSION_BLOB); > exit(EXIT_SUCCESS); > case 15: > @@ -1610,7 +1610,7 @@ void conf(struct ctx *c, int argc, char **argv) > v6_only =3D true; > break; > case '1': > - if (c->mode !=3D MODE_PASST) > + if (c->mode =3D=3D MODE_PASTA) > die("--one-off is for passt mode only"); > =20 > if (c->one_off) > @@ -1657,7 +1657,7 @@ void conf(struct ctx *c, int argc, char **argv) > conf_ugid(runas, &uid, &gid); > =20 > if (logfile) { > - logfile_init(c->mode =3D=3D MODE_PASST ? "passt" : "pasta", > + logfile_init(c->mode =3D=3D MODE_PASTA ? "pasta" : "passt", > logfile, logsize); > } > =20 > diff --git a/isolation.c b/isolation.c > index f394e93b8526..ca2c68b52ec7 100644 > --- a/isolation.c > +++ b/isolation.c > @@ -312,7 +312,7 @@ int isolate_prefork(const struct ctx *c) > * PID namespace. For passt, use CLONE_NEWPID anyway, in case somebody > * ever gets around seccomp profiles -- there's no harm in passing it. > */ > - if (!c->foreground || c->mode =3D=3D MODE_PASST) > + if (!c->foreground || c->mode !=3D MODE_PASTA) > flags |=3D CLONE_NEWPID; > =20 > if (unshare(flags)) { > @@ -379,12 +379,12 @@ void isolate_postfork(const struct ctx *c) > =20 > prctl(PR_SET_DUMPABLE, 0); > =20 > - if (c->mode =3D=3D MODE_PASST) { > - prog.len =3D (unsigned short)ARRAY_SIZE(filter_passt); > - prog.filter =3D filter_passt; > - } else { > + if (c->mode =3D=3D MODE_PASTA) { > prog.len =3D (unsigned short)ARRAY_SIZE(filter_pasta); > prog.filter =3D filter_pasta; > + } else { > + prog.len =3D (unsigned short)ARRAY_SIZE(filter_passt); > + prog.filter =3D filter_passt; > } > =20 > if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) || > diff --git a/passt.c b/passt.c > index c70caf464e61..5056a49dec95 100644 > --- a/passt.c > +++ b/passt.c > @@ -360,7 +360,7 @@ loop: > uint32_t eventmask =3D events[i].events; > =20 > trace("%s: epoll event on %s %i (events: 0x%08x)", > - c.mode =3D=3D MODE_PASST ? "passt" : "pasta", > + c.mode =3D=3D MODE_PASTA ? "pasta" : "passt", > EPOLL_TYPE_STR(ref.type), ref.fd, eventmask); > =20 > switch (ref.type) { > diff --git a/tap.c b/tap.c > index 5b1b61550c13..ebe52247ad87 100644 > --- a/tap.c > +++ b/tap.c > @@ -428,10 +428,10 @@ size_t tap_send_frames(const struct ctx *c, const s= truct iovec *iov, size_t n) > if (!n) > return 0; > =20 > - if (c->mode =3D=3D MODE_PASST) > - m =3D tap_send_frames_passt(c, iov, n); > - else > + if (c->mode =3D=3D MODE_PASTA) > m =3D tap_send_frames_pasta(c, iov, n); > + else > + m =3D tap_send_frames_passt(c, iov, n); > =20 > if (m < n) > debug("tap: failed to send %zu frames of %zu", n - m, n); > @@ -1299,10 +1299,10 @@ void tap_sock_init(struct ctx *c) > return; > } > =20 > - if (c->mode =3D=3D MODE_PASST) { > + if (c->mode =3D=3D MODE_PASTA) { > + tap_sock_tun_init(c); > + } else { > if (c->fd_tap_listen =3D=3D -1) > tap_sock_unix_init(c); > - } else { > - tap_sock_tun_init(c); > } > } > diff --git a/tcp_buf.c b/tcp_buf.c > index 4c1f00c1d1b2..dff6802c5734 100644 > --- a/tcp_buf.c > +++ b/tcp_buf.c > @@ -34,7 +34,7 @@ > =20 > #define TCP_FRAMES_MEM 128 > #define TCP_FRAMES \ > - (c->mode =3D=3D MODE_PASST ? TCP_FRAMES_MEM : 1) > + (c->mode =3D=3D MODE_PASTA ? 1 : TCP_FRAMES_MEM) > =20 > struct tcp4_l2_head { /* For MSS4 macro: keep in sync with tcp4_l2_buf_t= */ > #ifdef __AVX2__ > diff --git a/udp.c b/udp.c > index 9c56168c6340..a189c2e0b5a2 100644 > --- a/udp.c > +++ b/udp.c > @@ -755,7 +755,7 @@ void udp_buf_sock_handler(const struct ctx *c, union = epoll_ref ref, uint32_t eve > * whether we'll use tap or splice, always go one at a time > * for pasta mode. > */ > - ssize_t n =3D (c->mode =3D=3D MODE_PASST ? UDP_MAX_FRAMES : 1); > + ssize_t n =3D (c->mode =3D=3D MODE_PASTA ? 1 : UDP_MAX_FRAMES); > in_port_t dstport =3D ref.udp.port; > bool v6 =3D ref.udp.v6; > struct mmsghdr *mmh_recv; --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --4IpoXOqSA4oTLDMl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXBmZEACgkQzQJF27ox 2GdUrQ//TbIU6F1YFPKvq0j3nz56F98dRlBJDwtqghzWQaE0X0MUQXR3S40wnxob AmsvBfLCyX09dC4nDRyIKARGrzaU3KFNZA0ehIhNmKbjUPtJf5j4rUZSMbASiQMW m1ETr8ALlhkz2GJiG/ez6vaSHkE89wKB8sG/MAdrLUQTiE0mMJ/9gcp+AZThq6Um iVn1bryiSushUa5DH/kKliaDqU+wMAmNKa+w0JQqyhflWTvLyONAnRKg6zzoatQ/ 6CHs9t5JMvULv+zZZ4Ady7zgcwteWUCgRtWg+LCpa7dXjjXKq9xydVs1B1RlNNt7 thsRL8HFS2xhaOAXfb+dQU87Xy8Bsm5FBb+TXft4OrnpX/5BWXuZ7MoM5Sdd+qE9 C0rkfxvZT85FudvPLMp3vHF/mA3BdibQk6HFAATnMmj3XPQh22IMKV/RanPO3V90 PPiqAMI83OkgF5O5cw1pxW8Br5K+8hDjkpSyKWAC5BmIG/dcTDQ7AoVC5k4XH/8Y fILVm39reJ1N0e0GNqaZzWu6t7XX11U3J+CvmwuHpc9TXILUwTn0ZrJr2o6ly5MX DPWrTtZTpAaOWlqe7OLKRGIKYgnMIyy4AsAwfE28O9h9YMnyTnBCSc/IbF8sBygC LcFQAdmCuObSz/z6qq+h4N1SGrZ73Tgqzvy9d9hBiwd4AJnChGg= =dsVH -----END PGP SIGNATURE----- --4IpoXOqSA4oTLDMl--