From nobody Tue Sep 9 01:01:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCE3FC001DC for ; Mon, 31 Jul 2023 07:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbjGaHKw (ORCPT ); Mon, 31 Jul 2023 03:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjGaHKG (ORCPT ); Mon, 31 Jul 2023 03:10:06 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B7C6173D; Mon, 31 Jul 2023 00:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IDz9jUi6eWUOL/TuXdKKi3jOrKRfr5jdxu30nNZONa6Xu+s8Is+VBLzSn1CMiufsYwZ2BBQvAaR2x4GpmReqtfCN9DiL0qt9AhrUW1rdtYqqlXqgaVrf+OmX8kb/WocBvUxakoEBNQc+j2xDcm65H5mza6wRS38wPEayjOtDSTkjFIzCWrUoJBivW5gccrMyFfErOfEcfD8S7uvdi68oUprvXlWT63FQuY/km21IlC/aAAGj9CFtgxV1sPWtdpQW1fa2FViDXTlQYGSZ16/TcM8XCdcSfRs7SR80IuayUgdSxSScmaPKsv2ECRvFOTuMpfYohsW6gVDxvCfF0myhuw== 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=20aBci1OFdwFvsDpaLEFiJkR2sQ4epxhqzCuzTx2G8k=; b=ndTmgQuAiBZ0k0aXNiv+V9Hz+UbUj4juaF9RStyi4zunDn/pwtHlXRgjXeL97bBVxtYYKrUhT3VjoZZsOM1UP/okN/hFaI1+R5FkCsZshI0ujO0A87w4WhYIRdNgSjNjkY+Glt98LbnfXbVZpr/c5czvlaz5c5o3UlTJvxEmIO7KeUynbmX92ObOlykpPCRuidvZi9Mu5K2rmaL1LzgUCNEPM17XcDbRMFknEbyzd4SfhFby1r/luAPUl111jP7C4F2Cq6Ed6vX7rGGqlKf+XRRRNnT1F331y1lrqx3N2u+6BrhWn+nBrLBoUwBGZkC89U84aRr7qKxKqOlruFPrww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=20aBci1OFdwFvsDpaLEFiJkR2sQ4epxhqzCuzTx2G8k=; b=qg9MCB9/N2dVO908w8rmdhtjrHoyjwO4SJZyKQ7vKO4aziUj50EkpAXER8IbRaBlKIL4hpwd3cV83h8q1T4w0L4QSajwZQfsf8SLoaTJOX3O1rc41BIt2BTlz4rCkEmMkcjfmqnT+U/grUmwAdZnhbRRwvlp32bD5QxkE4dGz//qbc5cC02tGtC8UpLXHK8jQWioNQCx/EU3CB2Z2+0ELKUywcBrDXYdFQRDTaVpUBbgIehT7GXtP2p4yWsPPxukhtRkgYTN3vDRFC4acNGoIdeUruK6ATudVRTlnYGgyNjE3264ZTowC4YwBkPrv7u9gneoa/NmzdnXrWo8y5l6zA== Received: from MWH0EPF000554DF.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:4) by CY5PR12MB6227.namprd12.prod.outlook.com (2603:10b6:930:21::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 07:07:39 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::207) by MWH0EPF000554DF.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.5 via Frontend Transport; Mon, 31 Jul 2023 07:07:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42 via Frontend Transport; Mon, 31 Jul 2023 07:07:39 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 31 Jul 2023 00:07:25 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 31 Jul 2023 00:07:20 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V5 1/3] virtio_net: extract interrupt coalescing settings to a structure Date: Mon, 31 Jul 2023 10:06:54 +0300 Message-ID: <20230731070656.96411-2-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731070656.96411-1-gavinl@nvidia.com> References: <20230731070656.96411-1-gavinl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|CY5PR12MB6227:EE_ X-MS-Office365-Filtering-Correlation-Id: 10701c4f-20df-40b6-7965-08db9194d37b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kTnCczYQK49GaG+Bfh98KcvS0IrVWcktYuGGIpv7VKx+hCwETYlzp++RDj/Pj24Y/Zw0FRw6LETNpee0kQGy3ztMrbqwgUEZ8HBVJKh45RBgRDsM0VJVEUdaYZiUSH6rQdbwMkw/HjB78L9WPfsNV2N5gK4CXRL9Bz+ZBMTfw8iGUaL5oN6lv5lT9LqZbEoHjuL1QVq/G0dSrmyGn38ZAfsvNk21LNquImEls6IHyxr7YZC8L3sfiNYmIB71QZMsTvNSu/Yl6MZGveqE7DTiwiCRs1aDBMUVMvrnaST+5RXLXowoBXMsTNcoB1W0g1yJO67WG1sG9Xzh3nUNYye9qq6nIW/AZ/ttJ4wbgqpuFJAC2/H7YxwauculJbhW6Y9v6ZwspFpTidaCosd9pqr7K4iujQuw1dvgZmpPYCUXwj27uYq+hohhZY2ciy6oDfFDIO9CprPdt1l3WT7MxBNVO8leLwRyEvv3A1Fbhxx9W/pl/mAdMcFDuOeFAS2XRwOpPFAfMfyJw+V67BO5kuisckx8fY8sR0UUReGYzfqdIoNGWFlJmOiUd+grNVgvubia2SRqmQqIssg870ymbW5ASwI0+3EQMnh1saY4XH1SSzzPfoWF6vgOdPhTZpyGGa4owNaqdvnhacMTRQo8kzvHT5z6ICSuhIla/QwPnQIa/oDOCZH3Hj+0Vmz66lvSNZ9i2ZJ5nbbdGOPlGgNJ16F8PmPYTqoYj5//BProlAZ7pe72ldiM0F/RxC6qdtj3AG8OFGoeBKfG99ahnXs2lFKg6EywE2JnxvfL+AErqKzA2EvTx1QPhoHJtzxod/RgYyO+ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(40480700001)(5660300002)(7416002)(8676002)(8936002)(40460700003)(4326008)(316002)(6636002)(70206006)(70586007)(41300700001)(55016003)(2906002)(47076005)(2616005)(426003)(36756003)(16526019)(26005)(6286002)(1076003)(356005)(921005)(7636003)(186003)(336012)(82740400003)(36860700001)(83380400001)(7696005)(110136005)(6666004)(478600001)(54906003)(86362001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 07:07:39.1391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10701c4f-20df-40b6-7965-08db9194d37b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6227 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Extract interrupt coalescing settings to a structure so that it could be reused in other data structures. Signed-off-by: Gavin Li Reviewed-by: Dragos Tatulea Reviewed-by: Jiri Pirko Acked-by: Jason Wang Acked-by: Michael S. Tsirkin Reviewed-by: Heng Qi --- drivers/net/virtio_net.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0db14f6b87d3..dd5fec073a27 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -126,6 +126,11 @@ static const struct virtnet_stat_desc virtnet_rq_stats= _desc[] =3D { #define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc) #define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) =20 +struct virtnet_interrupt_coalesce { + u32 max_packets; + u32 max_usecs; +}; + /* Internal representation of a send virtqueue */ struct send_queue { /* Virtqueue associated with this send _queue */ @@ -281,10 +286,8 @@ struct virtnet_info { u32 speed; =20 /* Interrupt coalescing settings */ - u32 tx_usecs; - u32 rx_usecs; - u32 tx_max_packets; - u32 rx_max_packets; + struct virtnet_interrupt_coalesce intr_coal_tx; + struct virtnet_interrupt_coalesce intr_coal_rx; =20 unsigned long guest_offloads; unsigned long guest_offloads_capable; @@ -3056,8 +3059,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet= _info *vi, return -EINVAL; =20 /* Save parameters */ - vi->tx_usecs =3D ec->tx_coalesce_usecs; - vi->tx_max_packets =3D ec->tx_max_coalesced_frames; + vi->intr_coal_tx.max_usecs =3D ec->tx_coalesce_usecs; + vi->intr_coal_tx.max_packets =3D ec->tx_max_coalesced_frames; =20 vi->ctrl->coal_rx.rx_usecs =3D cpu_to_le32(ec->rx_coalesce_usecs); vi->ctrl->coal_rx.rx_max_packets =3D cpu_to_le32(ec->rx_max_coalesced_fra= mes); @@ -3069,8 +3072,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet= _info *vi, return -EINVAL; =20 /* Save parameters */ - vi->rx_usecs =3D ec->rx_coalesce_usecs; - vi->rx_max_packets =3D ec->rx_max_coalesced_frames; + vi->intr_coal_rx.max_usecs =3D ec->rx_coalesce_usecs; + vi->intr_coal_rx.max_packets =3D ec->rx_max_coalesced_frames; =20 return 0; } @@ -3132,10 +3135,10 @@ static int virtnet_get_coalesce(struct net_device *= dev, struct virtnet_info *vi =3D netdev_priv(dev); =20 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { - ec->rx_coalesce_usecs =3D vi->rx_usecs; - ec->tx_coalesce_usecs =3D vi->tx_usecs; - ec->tx_max_coalesced_frames =3D vi->tx_max_packets; - ec->rx_max_coalesced_frames =3D vi->rx_max_packets; + ec->rx_coalesce_usecs =3D vi->intr_coal_rx.max_usecs; + ec->tx_coalesce_usecs =3D vi->intr_coal_tx.max_usecs; + ec->tx_max_coalesced_frames =3D vi->intr_coal_tx.max_packets; + ec->rx_max_coalesced_frames =3D vi->intr_coal_rx.max_packets; } else { ec->rx_max_coalesced_frames =3D 1; =20 @@ -4119,10 +4122,10 @@ static int virtnet_probe(struct virtio_device *vdev) } =20 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { - vi->rx_usecs =3D 0; - vi->tx_usecs =3D 0; - vi->tx_max_packets =3D 0; - vi->rx_max_packets =3D 0; + vi->intr_coal_rx.max_usecs =3D 0; + vi->intr_coal_tx.max_usecs =3D 0; + vi->intr_coal_tx.max_packets =3D 0; + vi->intr_coal_rx.max_packets =3D 0; } =20 if (virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT)) --=20 2.39.1 From nobody Tue Sep 9 01:01:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07CDC001DC for ; Mon, 31 Jul 2023 07:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231325AbjGaHLD (ORCPT ); Mon, 31 Jul 2023 03:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbjGaHKK (ORCPT ); Mon, 31 Jul 2023 03:10:10 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 959A419A2; Mon, 31 Jul 2023 00:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CMMdk/Fwp49gEHjL8IkVbQHrTMoKXbZlboj9JaeWT5zSLfidIV9i9KKbszW9RywHnpawOnvDsgVBpsEp/peRoCSib7had9rOWeodQuBjap/JHFuw1FUp2/eHqYRZ5qtRUQ6DFO1BZV/jbeWrGCsl2BMtNCWeftWTt1MfiUt4hXyFYrYC4DnhLyXL9kyXZpmBSOAk1gzdYx/8h3NUFnV+xmo95XM5wPGWjpcgbPm6YqVrPArN42fHZriANp4fhL5ZOrWevwWW2O9Zzp8qbIwbbJvH8VwtBYd1VqQZRp+vfQSH8H4Vy4OfbHdrvLamhHR5llKhgeAZkJr8b0139cRITg== 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=DyHrllRuGSHidLiftuVT/bNiX+LVYPuVS1xWCIqvSFg=; b=VWrWVsr3PXOfMEdLEBTlYavcVuW0bn2dqQuTIZjUeOpUewfRyY3Ge23yu1ggapjP5ikY33blVP8eYZb9qyqneoHhZg2JtANUqznUSI0vhq26AzJB7FD3BR02GH1hGCtvKIadOdGPlqYclaDtJCDnVX/fqoqbnf49oQPzWsUjZgzJMfV75EAbdCUxvVXh2ZUzupsmqzoqvmmp6yiCXkUxZqJf+7xbV3qhs1JdB+Xeu5fV44goXMVhMwvwi2TLQlnCHx9pGg8bX4Sj/lfCdOzDPtTJazMXPZ/uqegCRIAWFPFfGRt6FGuXY6V7hI7pN2t9EgrF+lYGZJLpQFA0ip3yPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DyHrllRuGSHidLiftuVT/bNiX+LVYPuVS1xWCIqvSFg=; b=KFHij0Bza6j/pfXu1QENLD0E0gkcov+kZ6CXyu3FeGmweX6AFv4XoBiCTAqBrI04wps5w0ohkhAMNY0dtCMpN+GIpmxyNAHIH+q5TB+Rl4NLdxpA8Ge4j8G0YgAoeH/KWlc7bGiBWHgu5xhJZFv5LXAUlxoTx0E+EahlLIk+2IL2wZIwbhnPED1CM8yQX14zPnT7B0aVPw9mMKs7spJhguXaj8hdc4px5v0Rwl20DOFOZMYZMaxIGtYxB87WvY9yRELH9FHgvzbZeIkvmfDN2vs5cPoKRgUHWjpEloJbIw8F2yUPPjbxUzneAbd2t7WX3BHrzSEMPCcaYATVyqigHQ== Received: from MWH0EPF00056D16.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:1d) by IA0PR12MB7776.namprd12.prod.outlook.com (2603:10b6:208:430::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Mon, 31 Jul 2023 07:07:44 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::204) by MWH0EPF00056D16.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.3 via Frontend Transport; Mon, 31 Jul 2023 07:07:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42 via Frontend Transport; Mon, 31 Jul 2023 07:07:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 31 Jul 2023 00:07:30 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 31 Jul 2023 00:07:25 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V5 2/3] virtio_net: support per queue interrupt coalesce command Date: Mon, 31 Jul 2023 10:06:55 +0300 Message-ID: <20230731070656.96411-3-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731070656.96411-1-gavinl@nvidia.com> References: <20230731070656.96411-1-gavinl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|IA0PR12MB7776:EE_ X-MS-Office365-Filtering-Correlation-Id: 91fef090-bffa-4800-f67d-08db9194d6b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +06SnYd5Sy7X7QGWbCcy7IkCuPuRzGCW3NHLY4D/sHLgJonBx+2A52k17+s73Lep54uhRF1hu+WdTv/KCelkIsif+xc3gh5OAiaEt6pKkHRY8WZXaBg7BMfDzFKUwVVh8bt+mWkBSmOY1Ao6l0BxtmTXu+N6MU6NZ/ilA+Ric+TWQ2Ss8S9Cq0kt9fCOxOR6i6S9bChigsov7rlN0AHiamyCZGfST/Bvooabx72jIIHjRu6k3M9JDnrkAHrjwYfOnCKivSnA9PdBvTQpqPmOmItSzE5ErI4gZy1uUSKMWY5jVZaCzy3Lfm72bF0JVCHB4kgaMHRZQoY70hTcxXx8l6Ef9r8nTeSPkLNCnUA+wFRzaLrpiJM0kp7QEYh8gJh+O78w31fBu8YLNyZeYPyiaiLDRr6lwQnun4w67dEMFwFWABV/NbC1TLms3XtXZ/u197b0ALDpDq4hje8D+MimVGgBEdNYEnkRk0efmluKOXmJsTYCt2GyhnV9XOFZYOQsmTylpGtoPrUHUV3I1sIjUUH4rICBLgJ8rAuiSZdguel040DRVpH+BMHr43lqV5pbtOiTIfRI/BuwJyONX8FGZlJ2M+PvFmnN4zRw0nYRyCDcKXi09Is+/ltblmfNlVIFjE+F5gzOswaR6/YzqcRuo4jmIUJ6JT4hjo5ENJSjObLkDKJON24Xvt4M6oqEKlsThqeXXff48zbBT2gB74qoW+Xz0dd1YHEkn+jcFKQYsdP8/G/n49F/FVATJ4so6+JS2YtYHiHM8kA1XRH2/WQ01zxHBuFCtPsyrg61wyfhN2Pe4YsNx3IusbEq6kzpTdgC X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(376002)(396003)(136003)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(47076005)(36860700001)(7696005)(36756003)(16526019)(6286002)(55016003)(40460700003)(40480700001)(2616005)(1076003)(26005)(83380400001)(186003)(336012)(426003)(70586007)(70206006)(7416002)(7636003)(356005)(921005)(54906003)(110136005)(82740400003)(41300700001)(86362001)(316002)(4326008)(5660300002)(6636002)(8936002)(8676002)(2906002)(6666004)(478600001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 07:07:44.5294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91fef090-bffa-4800-f67d-08db9194d6b1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7776 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add interrupt_coalesce config in send_queue and receive_queue to cache user config. Send per virtqueue interrupt moderation config to underlying device in order to have more efficient interrupt moderation and cpu utilization of guest VM. Additionally, address all the VQs when updating the global configuration, as now the individual VQs configuration can diverge from the global configuration. Signed-off-by: Gavin Li Reviewed-by: Dragos Tatulea Reviewed-by: Jiri Pirko Acked-by: Michael S. Tsirkin Reviewed-by: Heng Qi Acked-by: Jason Wang --- drivers/net/virtio_net.c | 149 ++++++++++++++++++++++++++++++-- include/uapi/linux/virtio_net.h | 14 +++ 2 files changed, 155 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index dd5fec073a27..6640474f46bd 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -144,6 +144,8 @@ struct send_queue { =20 struct virtnet_sq_stats stats; =20 + struct virtnet_interrupt_coalesce intr_coal; + struct napi_struct napi; =20 /* Record whether sq is in reset state. */ @@ -161,6 +163,8 @@ struct receive_queue { =20 struct virtnet_rq_stats stats; =20 + struct virtnet_interrupt_coalesce intr_coal; + /* Chain pages by the private ptr. */ struct page *pages; =20 @@ -212,6 +216,7 @@ struct control_buf { struct virtio_net_ctrl_rss rss; struct virtio_net_ctrl_coal_tx coal_tx; struct virtio_net_ctrl_coal_rx coal_rx; + struct virtio_net_ctrl_coal_vq coal_vq; }; =20 struct virtnet_info { @@ -3078,6 +3083,55 @@ static int virtnet_send_notf_coal_cmds(struct virtne= t_info *vi, return 0; } =20 +static int virtnet_send_ctrl_coal_vq_cmd(struct virtnet_info *vi, + u16 vqn, u32 max_usecs, u32 max_packets) +{ + struct scatterlist sgs; + + vi->ctrl->coal_vq.vqn =3D cpu_to_le16(vqn); + vi->ctrl->coal_vq.coal.max_usecs =3D cpu_to_le32(max_usecs); + vi->ctrl->coal_vq.coal.max_packets =3D cpu_to_le32(max_packets); + sg_init_one(&sgs, &vi->ctrl->coal_vq, sizeof(vi->ctrl->coal_vq)); + + if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL, + VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET, + &sgs)) + return -EINVAL; + + return 0; +} + +static int virtnet_send_notf_coal_vq_cmds(struct virtnet_info *vi, + struct ethtool_coalesce *ec, + u16 queue) +{ + int err; + + if (ec->rx_coalesce_usecs || ec->rx_max_coalesced_frames) { + err =3D virtnet_send_ctrl_coal_vq_cmd(vi, rxq2vq(queue), + ec->rx_coalesce_usecs, + ec->rx_max_coalesced_frames); + if (err) + return err; + /* Save parameters */ + vi->rq[queue].intr_coal.max_usecs =3D ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets =3D ec->rx_max_coalesced_frames; + } + + if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err =3D virtnet_send_ctrl_coal_vq_cmd(vi, txq2vq(queue), + ec->tx_coalesce_usecs, + ec->tx_max_coalesced_frames); + if (err) + return err; + /* Save parameters */ + vi->sq[queue].intr_coal.max_usecs =3D ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets =3D ec->tx_max_coalesced_frames; + } + + return 0; +} + static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) { /* usecs coalescing is supported only if VIRTIO_NET_F_NOTF_COAL @@ -3093,22 +3147,42 @@ static int virtnet_coal_params_supported(struct eth= tool_coalesce *ec) return 0; } =20 +static int virtnet_should_update_vq_weight(int dev_flags, int weight, + int vq_weight, bool *should_update) +{ + if (weight ^ vq_weight) { + if (dev_flags & IFF_UP) + return -EBUSY; + *should_update =3D true; + } + + return 0; +} + static int virtnet_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { struct virtnet_info *vi =3D netdev_priv(dev); - int ret, i, napi_weight; + int ret, queue_number, napi_weight; bool update_napi =3D false; =20 /* Can't change NAPI weight if the link is up */ napi_weight =3D ec->tx_max_coalesced_frames ? NAPI_POLL_WEIGHT : 0; - if (napi_weight ^ vi->sq[0].napi.weight) { - if (dev->flags & IFF_UP) - return -EBUSY; - else - update_napi =3D true; + for (queue_number =3D 0; queue_number < vi->max_queue_pairs; queue_number= ++) { + ret =3D virtnet_should_update_vq_weight(dev->flags, napi_weight, + vi->sq[queue_number].napi.weight, + &update_napi); + if (ret) + return ret; + + if (update_napi) { + /* All queues that belong to [queue_number, vi->max_queue_pairs] will be + * updated for the sake of simplicity, which might not be necessary + */ + break; + } } =20 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) @@ -3120,8 +3194,8 @@ static int virtnet_set_coalesce(struct net_device *de= v, return ret; =20 if (update_napi) { - for (i =3D 0; i < vi->max_queue_pairs; i++) - vi->sq[i].napi.weight =3D napi_weight; + for (; queue_number < vi->max_queue_pairs; queue_number++) + vi->sq[queue_number].napi.weight =3D napi_weight; } =20 return ret; @@ -3149,6 +3223,63 @@ static int virtnet_get_coalesce(struct net_device *d= ev, return 0; } =20 +static int virtnet_set_per_queue_coalesce(struct net_device *dev, + u32 queue, + struct ethtool_coalesce *ec) +{ + struct virtnet_info *vi =3D netdev_priv(dev); + int ret, napi_weight; + bool update_napi =3D false; + + if (queue >=3D vi->max_queue_pairs) + return -EINVAL; + + /* Can't change NAPI weight if the link is up */ + napi_weight =3D ec->tx_max_coalesced_frames ? NAPI_POLL_WEIGHT : 0; + ret =3D virtnet_should_update_vq_weight(dev->flags, napi_weight, + vi->sq[queue].napi.weight, + &update_napi); + if (ret) + return ret; + + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) + ret =3D virtnet_send_notf_coal_vq_cmds(vi, ec, queue); + else + ret =3D virtnet_coal_params_supported(ec); + + if (ret) + return ret; + + if (update_napi) + vi->sq[queue].napi.weight =3D napi_weight; + + return 0; +} + +static int virtnet_get_per_queue_coalesce(struct net_device *dev, + u32 queue, + struct ethtool_coalesce *ec) +{ + struct virtnet_info *vi =3D netdev_priv(dev); + + if (queue >=3D vi->max_queue_pairs) + return -EINVAL; + + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) { + ec->rx_coalesce_usecs =3D vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs =3D vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames =3D vi->sq[queue].intr_coal.max_packets; + ec->rx_max_coalesced_frames =3D vi->rq[queue].intr_coal.max_packets; + } else { + ec->rx_max_coalesced_frames =3D 1; + + if (vi->sq[0].napi.weight) + ec->tx_max_coalesced_frames =3D 1; + } + + return 0; +} + static void virtnet_init_settings(struct net_device *dev) { struct virtnet_info *vi =3D netdev_priv(dev); @@ -3279,6 +3410,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = =3D { .set_link_ksettings =3D virtnet_set_link_ksettings, .set_coalesce =3D virtnet_set_coalesce, .get_coalesce =3D virtnet_get_coalesce, + .set_per_queue_coalesce =3D virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce =3D virtnet_get_per_queue_coalesce, .get_rxfh_key_size =3D virtnet_get_rxfh_key_size, .get_rxfh_indir_size =3D virtnet_get_rxfh_indir_size, .get_rxfh =3D virtnet_get_rxfh, diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_ne= t.h index 12c1c9699935..cc65ef0f3c3e 100644 --- a/include/uapi/linux/virtio_net.h +++ b/include/uapi/linux/virtio_net.h @@ -56,6 +56,7 @@ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ +#define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notifica= tion coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalesc= ing */ #define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */ #define VIRTIO_NET_F_GUEST_USO6 55 /* Guest can handle USOv6 in. */ @@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx { }; =20 #define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2 +#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3 + +struct virtio_net_ctrl_coal { + __le32 max_packets; + __le32 max_usecs; +}; + +struct virtio_net_ctrl_coal_vq { + __le16 vqn; + __le16 reserved; + struct virtio_net_ctrl_coal coal; +}; =20 #endif /* _UAPI_LINUX_VIRTIO_NET_H */ --=20 2.39.1 From nobody Tue Sep 9 01:01:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B0A5C001DF for ; Mon, 31 Jul 2023 07:11:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbjGaHLJ (ORCPT ); Mon, 31 Jul 2023 03:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231250AbjGaHKV (ORCPT ); Mon, 31 Jul 2023 03:10:21 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F0119AB; Mon, 31 Jul 2023 00:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bKl4uDJhhib/Cpefu1HCoQtiF8eLQXAfG2o411kN56oKI264Rj16z27MlFJ2D4X5Nvmvpu8Vxv9ZLeYKvlgbyGHor4EcDL7vfYI4vfijkBwZWTeNJCww4ZQHlE8FIRuADscb9sfvluCqGdJPYt5QZmDrP05qw1bFU4Lji6FdrtwzmPsp6gh9EJkZB0vPdBXlrVJiw69mW0hC3Ppey+IeamCmRlP3nN0RquX9XgWCni/4uD/mimf1J4NYTiXhTfBKIj2Jb5DlY+QwDvZ7BBYQgUAw1pbFwHESn6xIZpK4v2/O6UcY0dJW9QomZCAfCEMoPrYzJXjVuzREWSr5EwilVA== 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=Y4nbaO0W3Y3VapI+BGsT9dsdxzSLkkO9XhL+jT65+5Q=; b=P+1C7UESIqPYUkj1JwpLhHeZya4DsEOOPRPbGAEGsTUdABZnhQUGpKw/Ls9OZ8LX4QWT7731a84ZdOZtMzP8Ue+Nv/XyC6BIKn9FAW+d5TF/nfkiogfocQayU/MfBIo8/cCwrz2jZ5+2mWmupdAAqCp91c2tcVR2scjdx9iEGyWU4rzvV7eGM9+ckmI4eMsYR7/jsCP54001fl2riPEfcTVppCpozPtALnDbG1I8wfk/YZvIx/LTBvSV1Sn33Y1n1tESKB0eo4F/gjcqDga7azg2Wud+Q38O6eFfImQ5g3GMHRKzntmdAcAv/yFPWfk0vkx3SevjvWCC89Fdz782pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y4nbaO0W3Y3VapI+BGsT9dsdxzSLkkO9XhL+jT65+5Q=; b=LbOsW1gcbBRjU1/7HuPAgIwwsBULntA9GlaSse5HzM4/K+qXQ9vsRR0AOixgFOlVpkYZTXuakJs//jFbuiAHEi2S5w0+fXYQPm5SWUAKBzp5WF0HOLhmg9wu7WXFYz5z/YdDzLrISIqQJ8pvIbOpSEiLRTdd34YiJQD+zGOWsgJ0zhjpkbyiiOBRQtiGD9dPg9JZ0fawX7GaAiuKNY44Wf4EoIgg6lIgZAc1BzGZ+PepyVOOvXI5cByLlqmJ5L+wtFRnCl0GKlJC6ROdbWj+MXSbu/nbVuTW2cJMB8ahWXspnNiHjFOjh/E0jimZcKDYSkQQ6SFxRuabUkA0ArGQOA== Received: from MWH0EPF00056D14.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:1c) by IA1PR12MB8519.namprd12.prod.outlook.com (2603:10b6:208:44c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Mon, 31 Jul 2023 07:07:52 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::204) by MWH0EPF00056D14.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.3 via Frontend Transport; Mon, 31 Jul 2023 07:07:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42 via Frontend Transport; Mon, 31 Jul 2023 07:07:52 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 31 Jul 2023 00:07:36 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 31 Jul 2023 00:07:31 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V5 3/3] virtio_net: enable per queue interrupt coalesce feature Date: Mon, 31 Jul 2023 10:06:56 +0300 Message-ID: <20230731070656.96411-4-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230731070656.96411-1-gavinl@nvidia.com> References: <20230731070656.96411-1-gavinl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|IA1PR12MB8519:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b151960-a9af-4198-84f5-08db9194db44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V0g9PaWcMluEUk+x4KR3jmsD1ZKhvFgwIFuC9kVIEU+8wvmfk6Xf69innaUCy753xlqIoqMSYvphVnK/BeZMBLpeIQTMw2vu1g/uMzKwKIQLdsLFXRvKZqfUAPxZ29tQWkNZ9h60J5BbcYT7OWbF59XJW25auahzfUfM4CFCVkb0iYpBxIhREI3YE8PC4dYwIqmnAtZLYau/eTGsnMGdxnzSwB8itc70+rgbN+a++NkKbvODAQ/2nFhxWl8aaYjNFfoAbz2QFQEe35k6kYch2qXEYh+5QBKKFwZ3rlXGu6G5fNA0ugykapuPyKfUhpSZcbIvb42Rw+Vxg8GaN36vGPwJHKOr/+eV6VbzdhDbL8NhtD1ZD7UePmhNHz+cmRGANuJt4L0ce/Jk7cgGv1mhZoT27/3MTcC+bQLlci1W96oeJPwfcxbjmh/VNSJehmpdvW3IXi9EIaA6KaeDlOP2OGUyRslr787e9l+4dRMDb48m07zEVHxQD5GzRi7pP/tedlVNC/otOSF3n2SNjYcKcrzmj8q2oaoFEU2vYZUFd0iUBO9SUxOFEpq1vOr+PXnRvRjZtzMwuvtW9OATc5zsMZrO8D9X5YfMEL65sLVtGThjC6MZRDtPgVveNAqNHjiE5dwS3DH5Mc0H7+8ebX7WIge2HqDfp8SLhX88ddvdvOcZ+tkrbOvKQzK005N/K+VS7jiL/w3A9Pjbu3/QTm5BTYvYHcVW23Km45sYRD3t2xLS/wseZX3U/kqcxOC+9q5Acs6SAxgq4KIJB8XnFPEXjF1bTwEjfRkYxi3R4B1L8LY4S4cOn7csRj/kao75I0r/ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(376002)(346002)(39860400002)(82310400008)(451199021)(40470700004)(46966006)(36840700001)(356005)(7636003)(921005)(82740400003)(55016003)(40480700001)(86362001)(36756003)(40460700003)(478600001)(7696005)(6666004)(16526019)(2616005)(6286002)(336012)(186003)(1076003)(26005)(8676002)(8936002)(7416002)(5660300002)(70586007)(6636002)(4326008)(70206006)(2906002)(54906003)(110136005)(41300700001)(316002)(36860700001)(426003)(83380400001)(47076005)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 07:07:52.2164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b151960-a9af-4198-84f5-08db9194db44 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8519 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Enable per queue interrupt coalesce feature bit in driver and validate its dependency with control queue. Signed-off-by: Gavin Li Reviewed-by: Dragos Tatulea Reviewed-by: Jiri Pirko Acked-by: Michael S. Tsirkin Reviewed-by: Heng Qi Acked-by: Jason Wang --- drivers/net/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6640474f46bd..10eba113b5fa 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -4088,6 +4088,8 @@ static bool virtnet_validate_features(struct virtio_d= evice *vdev) VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_HASH_REPORT, "VIRTIO_NET_F_CTRL_VQ") || VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_NOTF_COAL, + "VIRTIO_NET_F_CTRL_VQ") || + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_VQ_NOTF_COAL, "VIRTIO_NET_F_CTRL_VQ"))) { return false; } @@ -4512,6 +4514,7 @@ static struct virtio_device_id id_table[] =3D { VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \ VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \ VIRTIO_NET_F_RSS, VIRTIO_NET_F_HASH_REPORT, VIRTIO_NET_F_NOTF_COAL, \ + VIRTIO_NET_F_VQ_NOTF_COAL, \ VIRTIO_NET_F_GUEST_HDRLEN =20 static unsigned int features[] =3D { --=20 2.39.1