From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=KjfiWW6z; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 2663B5A0272 for ; Tue, 21 Jan 2025 13:07:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1737461216; bh=Fv1aWLAMDATXlYfSTXvbEzOULT0qYk3+5OfuKIfkfZ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KjfiWW6z9Iv0vEX1C06svPk/B9zqU8ix+aC4KD5U9vi+INq5ayz00E+nKWgJRkJlS y9ynbOaR/ROabuFLR8Ap4tccaCLX7hjuSf/FmXbj3OmDrayJ4waXSoY27zIz68ehrx zBWYR+902+012U4FE6mx+78nhZZKwm1fBV7/gHmTjZOMTTPNRQFLXr5DA46zfcYjbO 9cdS0LOWMYQ35wKOUZlo08K0STp3L6iU2mZ00HAqFfPsvMcwusR6OvL5lBYyulJuYq V5+4YQ10rniQv2xI7tfmwNqnR5K1AD3YtZbaPEg0ULEwpjbtxqZJdq0Ima1edXJun7 MyKdr+8ZxLjyw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YcmCh5hcCz4x7G; Tue, 21 Jan 2025 23:06:56 +1100 (AEDT) Date: Tue, 21 Jan 2025 14:20:28 +1030 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH] vhost_user: remove ASSERT() on iovec number Message-ID: References: <20250120131522.1053992-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5KYlM067wsk42NvQ" Content-Disposition: inline In-Reply-To: <20250120131522.1053992-1-lvivier@redhat.com> Message-ID-Hash: 6QONQPZSE7TVDPOCVOEG2LESVJKDUAPJ X-Message-ID-Hash: 6QONQPZSE7TVDPOCVOEG2LESVJKDUAPJ 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: --5KYlM067wsk42NvQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 20, 2025 at 02:15:22PM +0100, Laurent Vivier wrote: > Replace ASSERT() on the number of iovec in the element and on > the first entry length by a debug() message. >=20 > Signed-off-by: Laurent Vivier Removing the ASSERT() makes sense, but is it safe to carry on to the tap_add_packet() if the packet is not in the layout we expect? Should we be bailing out of the function (effectively dropping the packet) instead? > --- > vu_common.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/vu_common.c b/vu_common.c > index 431fba6be0c0..d34ae6dc1df3 100644 > --- a/vu_common.c > +++ b/vu_common.c > @@ -195,8 +195,12 @@ static void vu_handle_tx(struct vu_dev *vdev, int in= dex, > hdrlen); > } else { > /* vnet header can be in a separate iovec */ > - ASSERT(elem[count].out_num =3D=3D 2); > - ASSERT(elem[count].out_sg[0].iov_len =3D=3D (size_t)hdrlen); > + if (elem[count].out_num !=3D 2) > + debug("virtio-net tranmit queue contains more than one buffer ([%d]:= %u)", > + count, elem[count].out_num); > + if (elem[count].out_sg[0].iov_len !=3D (size_t)hdrlen) > + debug("virtio-net transmit queue entry not aligned on hdrlen ([%d]: = %d !=3D %zu)", > + count, hdrlen, elem[count].out_sg[0].iov_len); > tap_add_packet(vdev->context, > elem[count].out_sg[1].iov_len, > (char *)elem[count].out_sg[1].iov_base); --=20 David Gibson (he or they) | 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 --5KYlM067wsk42NvQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmePGXMACgkQzQJF27ox 2Gfsog//YOY7OIytiO9McT/HcVe5fjL0KdbbSaDfOT0aVHEfneWpwG7ZNAOdYWJh CqOReqVdgnIqzCb3JHfXSrXXt04gegIDV5dR5gMw5/ZYRJ7dtTF0wMra1SBJOA0U MJxCkKRo/pFU3v1LiNjfhvgKE4xY/7thGLI7En1x0yhThmD7kjIQF+8UOFWJfxKz 3/uw4JjnRT+5iBq2rAvJwn3tdmE38ZzbBU4KjisGhjY+CCmBoEPmY074DB/QtQJq Q7t9Nrz4cRkxQMng9VPK73LIMj9UCht/Wv+DFO45ue7OYEn9pvRHecHfdIBLR1Ik r6TymoNrmCvXUzzu3qSTGK9frveCf+Ab4JIlOnANiG+jG6fM7kFpR/h6q3PNUJt2 Jy5OmyaT0AKvB1Wczz4kCe8oQngrtDCS0fBYxBkVd2LgR/0ycMxQPx7WkctBHqjS f4kql5KFaJS7k5SREcORFvoRgqAtAT9CfA7VGmCUcAzX/EqI1r0iye7aqHmau5i7 oJGNVWXeseYmG5dRDYpsHd2yBx0hM+8fHs4hdMGEqHUeEYQmP4nHADNPvvns82Ej WN3gaZwLB88p0LTOy7RfpX/Y853q6cHJzIbpHCpSCivWx9iAbPY2JV6KIXYvxy8U lADjnFbcurYLAhasd3bBxgnf6v+WpZfhd5nloKtznGbHyd2Uq8A= =byO7 -----END PGP SIGNATURE----- --5KYlM067wsk42NvQ--