From patchwork Tue Apr 2 15:05:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luigi Leonardi X-Patchwork-Id: 13614274 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2072.outbound.protection.outlook.com [40.92.89.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43C6D86128; Tue, 2 Apr 2024 15:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.89.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712070352; cv=fail; b=rPo3MsjJPCaUfF3AAoWv9uaRQyJIDH7U0l4nY/sVQYB7HSqLIQ6wJzspIIUIfYdvRNyCKMPaOgp0LWLzT1+TADDIHOd2j7Ytx72CbZSUruZts8bo94SeprFhwcRRkDBkLmK/s88o6AUDDYFX0atGjWc3wgWxRpfrPTBD7VpnlmU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712070352; c=relaxed/simple; bh=L0LoCHzT3QB8vBXGF54LP9kt8+BHuqLRRuvJe8mI7/U=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=bThOixWLMTpcg3MQhcyEYqzrDaHH+jM4gijd4saIB7FsaSl4baxz2TC81hiQAkN+Jy2W91W53JJfmM7zgOqVWwcrFfI1FcbnNuzc44aeN1fpOzB83zv7WeuHUiFei8VwkK3jyJGgJQdRwh/T7FYcaXFeLJops4MBEZDAH0s/de4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=JGbvYBzf; arc=fail smtp.client-ip=40.92.89.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="JGbvYBzf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNTn/YcZtlI1l3KRfcq62UiWzCQRsdsAL3Fkw2/gofZF6OoioAImats6LyR6WNlAhLPMTgAGZS51O0M+ggnQTO3XBxp5LY03Bd+dsqbEnUi/pXGxOMHzevNOsQsti5v3LLwcZWKnAmXZ2fGbcnWjZ5yiRemqdE1b7jMEcvwwNBx7GQ+WgNghheySUsK9VT54tvTJlRlRhIVl3s6fOPhS82ucmoOlVq0Ef6P74VfkMkie0gPMHRG3YKsKzSWNZSINc31PL/w399VFgKX/m5vdyJq3HUHINzkmA5cy4pgTNmxyfL1aIp2YU2zwh5LasNBNSw+eOABAX2pTOVTaShtsFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=29YO+qJ9ddHmzvs+1fRHfsbpENep51HowdbSPGnTJhA=; b=JglkVAF5v8hEDubdUMukvRjDz3Cprdluws+WqjrsQRjpvQkW00BvtGBRZN+cJc6pzZ+t932sLv+IT9ofx3C0tu2qYaYt3hqyqXYKvlGzmejxX0/U5Vq+dgIKiy04FRcOI1G4QrpKe/hfdpSsdp/cwjhU3KN22fmEykox9IW7nay+FEUq0ywN6VzlkID202fivSGMJDkhOvn82jWUZy5l3hqxHOwh/XEnsMg+u7avVHGTUY5YbrvhbzAfEvEdXXvmSm302APsHCcUdItaJsX18O53BqQwhb+FVG/2gCbI+9IFB3IlJwmTs443JZfikdqr1RSLmsOXuJye1YKDbICuMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=29YO+qJ9ddHmzvs+1fRHfsbpENep51HowdbSPGnTJhA=; b=JGbvYBzfW2cdzdkCBuOzSGIv8AwY6CO/aWR+3E8nPOf6YWAMnp4w0PQ+YJT9m1gD1TTE8Ma7g9ojTYM6qWe16wtRmJBrr/gA0sLIYndO2Vdx/fVnBYptJvK4deqb76HdUaZHPjZsOXEftWGPYUtoTjkT1FRZzTUCk6z8BnxcpDksvvWt9h7x8S0Xml/86GGkemMn5HFnK4iTX2MI3inFeXjynpR5SdiJYnNC1r8gdq3W8FiFEl921v56jsoZe9BnBjQst1F2Fx6XvHyvYTTuECb+gtCEJu9+vVKdsjSVQfd1IOeXoH6uaavhawrD6ogfpBuz5uz3aFZ/5xMlKItQLg== Received: from AS2P194MB2170.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:642::8) by AS8P194MB1141.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:2a1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 15:05:47 +0000 Received: from AS2P194MB2170.EURP194.PROD.OUTLOOK.COM ([fe80::56f0:1717:f1a8:ea4e]) by AS2P194MB2170.EURP194.PROD.OUTLOOK.COM ([fe80::56f0:1717:f1a8:ea4e%2]) with mapi id 15.20.7409.042; Tue, 2 Apr 2024 15:05:47 +0000 From: Luigi Leonardi To: sgarzare@redhat.com, kvm@vger.kernel.org, jasowang@redhat.com, virtualization@lists.linux.dev, mst@redhat.com, kuba@kernel.org, xuanzhuo@linux.alibaba.com, netdev@vger.kernel.org, stefanha@redhat.com, pabeni@redhat.com, davem@davemloft.net, edumazet@google.com Cc: Luigi Leonardi Subject: [PATCH net-next 0/3] ioctl support for AF_VSOCK and virtio-based transports Date: Tue, 2 Apr 2024 17:05:36 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [aR2t77mvVXJ9r42eukDkK97vLdzdjr6J] X-ClientProxiedBy: MI2P293CA0011.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:45::11) To AS2P194MB2170.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:642::8) X-Microsoft-Original-Message-ID: <20240402150539.390269-1-luigi.leonardi@outlook.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS2P194MB2170:EE_|AS8P194MB1141:EE_ X-MS-Office365-Filtering-Correlation-Id: a76fabb5-24f0-4323-f759-08dc53266007 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7c7BJiLyDbsAZDm4yhHdiyFIt6xgDFs1WC2pd9cmNO/o63X24U19Yaj3An1rhuD2nIKgjPlWtcNiL++B+XnLXL0ZW3L4DvZVxFHFO+76mPckzYFZ7xl0/pdeIwJju9ZorKKaFIlHD+V4P2NMz2q3L9DbY4OvNYkF23/KqYZgr23FYCspD0E/j/69/eaHznND9acW7xvx2R1sWenjAYfSbrGc++qEUZt0ArZvXFU3bOJdvOSN06oJnxrEHuSXr+43GnVZ6A/bX0ss4hsSkTuBBklytZ3W8qC3DX4Ey8GQH8esIB58qKqZE2shGdW1dRwLPTNwT4LPR0Gks6f9/j2E/EBgL1DKf/cZX4lV9nQ329CMI7Z7ZneHrrv9u/hMKviSKqAiiluBBGZAyYQ1BDJAFR7Pm3ur0SITLCrwp5PMDvdYV7iOuD2cMS7JsX57rzHvLydlOiFZa6zCjxpL42XphttCAMhveYJUPNQKLg6Rh7/zzjYSA0Q+yuON35TCmrKuE/NYy5ZD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yKD60db3H/u5AyZf1zAeHCvjdXmtxAfeVSFjp73HWCVdOGuMhjz0?= =?utf-8?q?XHM3HsAXQRaPpD5GQDmWbFBGkisnItzgDbBNQFbDKGZQZtsiNCQ+Yzxv4PSMFnsET?= =?utf-8?q?mN8UfP4i3ye3jq9L9BUX58tWsk8Gr8oWlqrBSBrqryB6iGRXEzRDVZqExulgIJTJj?= =?utf-8?q?pC0ReInZDGhyC26XC7z69yxaqPDOIKDT36aZmaI+fd9Xrof4B1UviELBozIOd68tL?= =?utf-8?q?9Yly391dUTvZNZllQusMR5h0Lb3jKFb+EyaLGpJ1V6xomrUxcFc0u/q6+glXxRJBH?= =?utf-8?q?xDaH6pW9drQWcDEi5IxANRmfob1bpuiJcrzKeI5OZy1ZY1RgkD0h8ezcIpp42zpdH?= =?utf-8?q?QKFwrZe3EJNqD+zPoA20dab3VoQWk3DDjDS3HJ5HVbdzDnIYB4iz1JvwM8POKKywR?= =?utf-8?q?DPjHbRXNDWIB/4TFQUttuCY+wfQdJm2nWMl/8P1H5+kTDc20+7xabaiWRGkw/obNA?= =?utf-8?q?XuSSr/228pIPCu6Ac?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a76fabb5-24f0-4323-f759-08dc53266007 X-MS-Exchange-CrossTenant-AuthSource: AS2P194MB2170.EURP194.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 15:05:46.8838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P194MB1141 This patch series introduce the support for ioctl(s) in AF_VSOCK. The only ioctl currently available is SIOCOUTQ, which returns the number of unsent or unacked packets. It is available for SOCK_STREAM, SOCK_SEQPACKET and SOCK_DGRAM. As this information is transport-dependent, a new optional callback is introduced: stream_bytes_unsent. The first patch add ioctl support in AF_VSOCK, while the second patch introduce support for SOCK_STREAM and SOCK_SEQPACKET in all virtio-based transports: virtio_transport (G2H), vhost-vsock (H2G) and vsock-loopback. The latest patch introduce two tests for this new feature. More details can be found in each patch changelog. Luigi Leonardi (3): vsock: add support for SIOCOUTQ ioctl for all vsock socket types. vsock/virtio: add SIOCOUTQ support for all virtio based transports test/vsock: add ioctl unsent bytes test drivers/vhost/vsock.c | 3 +- include/linux/virtio_vsock.h | 7 +++ include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 42 ++++++++++++- net/vmw_vsock/virtio_transport.c | 3 +- net/vmw_vsock/virtio_transport_common.c | 30 +++++++++ net/vmw_vsock/vsock_loopback.c | 6 ++ tools/testing/vsock/util.c | 6 +- tools/testing/vsock/util.h | 3 + tools/testing/vsock/vsock_test.c | 83 +++++++++++++++++++++++++ 10 files changed, 176 insertions(+), 8 deletions(-)