From patchwork Tue Jul 25 13:07:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Li X-Patchwork-Id: 13326422 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 16F301F177; Tue, 25 Jul 2023 13:07:50 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBC4E77; Tue, 25 Jul 2023 06:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TTDeOkcvt4ESxuL9XAXNrTg7rKwjxU3Azf6gPqpYaXPTbs9sGxRoknUMpy85zpr2NPQ98PkGeQuN/QJFPEch0+G/90ybM/JsCBUc5R0DbV8siRrv6phHzDOex5W0wXPzHyTAYmg4PnCoi3uqWJvpqSVMtXTaqLuZRh20qXJ3k3khc7Ci1aE99GdVZcbMOScWymGOSALVa7H4HRpunNyKsmEutDvPILsSyS82VgN03GheRWNYKbWMTEL/syz5Ss53tpx0pxMZBOituOi3zwfewKRiD+H1jI49gK+rQTaUTqOSI2NWILX2fItLqJyYcWtJgOeRaRWcf54XvyrEBTwo7w== 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=MhX7LnNIYmKEG77Pd9vfycia48R/sWetMJbz/qvbpmoLT+qXwHpi/hmTBHVaYGTQIzG2kVUg2hZck8XIaVwVdb3f0kW2KYapb7yGl4y3TW3hcbXDPA2GFuGMCrFbwiykQ2TARz4uQapXqAsNidYyUQAWWgina2ZMqKBWhHnYxusL1bDR5fZDF9+/b2ep4Q9FEtOOE4nyI7Hid+ZNREJXU7cC3Wc+y8ANEpUTfOeHMgQA/1XIrRvffmL3mspvkBEaiMr7ScV7N0wPPYE876tW9fLqd3AM7htHJRC4qem2g52u4u2aR7IBSTz10kRKx0uiNWs94xd0iJEltuGG+WddbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=CLMjxkZHhoKDJOS6QtMk6ZRqBppl6xM76hmNaRKYIDVgh9DKGCVLri7ELPpykFuYvmO+dy2E9d81BDOWh8zt5AbXQtNEW1whkYhTIgPHmcPhN1C/azO406VqpJM1/Sm2O1LVPSePC093+uFkEP5u/1dUVSkVJ5evHzQBtfqs3oQwoFe3GZp7gTk0SbAbdRqEjCeMwGR4/mngyfE2gIeBerHptGbba1EBGqOrQAKuJAOvZneaXQXoAj7HXPcTG9Mf92Vpsn1nUil+Yl0o6fNZEsAQGO+y4o4/VFzJhKUSdRmCwpCT7Xn8Prf+zy+xXDQ2mr1XV7fCMQqCxqntPYteHA== Received: from BN0PR02CA0013.namprd02.prod.outlook.com (2603:10b6:408:e4::18) by SN7PR12MB7788.namprd12.prod.outlook.com (2603:10b6:806:345::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 13:07:47 +0000 Received: from BN8NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::1a) by BN0PR02CA0013.outlook.office365.com (2603:10b6:408:e4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33 via Frontend Transport; Tue, 25 Jul 2023 13:07:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT078.mail.protection.outlook.com (10.13.176.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Tue, 25 Jul 2023 13:07:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 25 Jul 2023 06:07:36 -0700 Received: from nvidia.com (10.126.230.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; Tue, 25 Jul 2023 06:07:30 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V4 1/3] virtio_net: extract interrupt coalescing settings to a structure Date: Tue, 25 Jul 2023 16:07:07 +0300 Message-ID: <20230725130709.58207-2-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725130709.58207-1-gavinl@nvidia.com> References: <20230725130709.58207-1-gavinl@nvidia.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.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: BN8NAM11FT078:EE_|SN7PR12MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e55f75f-75d3-47ad-6289-08db8d102481 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xi7uvXUlyJA+QlDXDNv89taXMiIy2DQrScj7yxQXJaSGLSSb/yD3vqADDzd1FHU2ZP29tti9y8JJbLCXt97GxriKY5wdqQTezq/Fkw69ybFzYvlI9ryWSrU0k7KqR5c5hT3vD2DlNup7HYwcX9NxpWxI4L92T0M0zurV/SYeEQI3R8qnmBX7n6cfMJQCjx5tGRkfXcT4yF7FJgnPEJKnAHC+xSMzyRrW2PlqvqpuYaE7OMTJGDvabaoBZXVzSRu1CzGnWK01R/XZx6bGnE/7oLtkthY2ZH6P/LnirgE+B9l5f7gftb6lIY1yW+eEeFeEx6bhNgUqipM/5NV7ei+YbDntYM62urSyQbLrdgEzC6aHgS0jXEEdVzIalKCE/DYKBnoObXuNu4lbuX+oH31uPBrelq9ti+UZtKrbB+iETLH3q+RIBbR3njo6C/V3M8HIrdx1n2VH/1sPajfGNA4/qT+m6HbctXjAXGiH5iIjI2ZxcwOePhdMbEcelOW4ZKkSe3x1JP5RtP/BLv97G46C0XSUo9l0Eg1z2bwqg+auW1Mf7FF5nPoNU2VtpZjgMqN6FXc3Sm94DDU0x/9VPgvJi9wLX3sidnwJIc40uZlMVOWdkFt8EhN0w6WMev7ybTYJeTAp9lbIGch4Ts1ol9Lh2s9jKiTVS2xl9TTO4MQGR1X0eqRwESs4n0ZFdizGiyriWeEt8CUnZer2nG3brQjgkfsjzPYDOcWV4hgW10j15fT2eslGG1KdIwFK+fYmSUKSsT/FtsBVO6FI4dAuzCD23HhpO0kFDgnyyaK3vB5zxLeAoBMUzUpiRMHQTMNVeQGc X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(82310400008)(36840700001)(40470700004)(46966006)(82740400003)(921005)(86362001)(110136005)(478600001)(5660300002)(41300700001)(8936002)(8676002)(40460700003)(7416002)(54906003)(6636002)(316002)(4326008)(40480700001)(6666004)(70206006)(70586007)(7696005)(16526019)(336012)(186003)(47076005)(6286002)(1076003)(7636003)(356005)(26005)(426003)(2906002)(36756003)(55016003)(83380400001)(2616005)(36860700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:07:47.2634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e55f75f-75d3-47ad-6289-08db8d102481 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7788 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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[] = { #define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc) #define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) +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; /* 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; 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; /* Save parameters */ - vi->tx_usecs = ec->tx_coalesce_usecs; - vi->tx_max_packets = ec->tx_max_coalesced_frames; + vi->intr_coal_tx.max_usecs = ec->tx_coalesce_usecs; + vi->intr_coal_tx.max_packets = ec->tx_max_coalesced_frames; vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs); vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames); @@ -3069,8 +3072,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, return -EINVAL; /* Save parameters */ - vi->rx_usecs = ec->rx_coalesce_usecs; - vi->rx_max_packets = ec->rx_max_coalesced_frames; + vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; + vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames; return 0; } @@ -3132,10 +3135,10 @@ static int virtnet_get_coalesce(struct net_device *dev, struct virtnet_info *vi = netdev_priv(dev); if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { - ec->rx_coalesce_usecs = vi->rx_usecs; - ec->tx_coalesce_usecs = vi->tx_usecs; - ec->tx_max_coalesced_frames = vi->tx_max_packets; - ec->rx_max_coalesced_frames = vi->rx_max_packets; + ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; + ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; + ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; + ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; } else { ec->rx_max_coalesced_frames = 1; @@ -4119,10 +4122,10 @@ static int virtnet_probe(struct virtio_device *vdev) } if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { - vi->rx_usecs = 0; - vi->tx_usecs = 0; - vi->tx_max_packets = 0; - vi->rx_max_packets = 0; + vi->intr_coal_rx.max_usecs = 0; + vi->intr_coal_tx.max_usecs = 0; + vi->intr_coal_tx.max_packets = 0; + vi->intr_coal_rx.max_packets = 0; } if (virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT)) From patchwork Tue Jul 25 13:07:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Li X-Patchwork-Id: 13326423 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C455F1F177; Tue, 25 Jul 2023 13:07:59 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52B511BCC; Tue, 25 Jul 2023 06:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4s4kJTUXuZ5W9QktJWld7jXQSMRLBkqSxdEvW6Ub9IvM7hBuWph+lAQ7okcg/mzbzOgMhRyFD2LwfQC72/LhUIx1/ZlVOgOWTr7u3WRbn/Usu414gCLx6SwnaFUIylQN1vZaXvMp4vZWI7uOAm6R2sq2XCNxstLoYkLMiVxGr12Dx7YEo2dAZT0lNZRxxTBwlzuhgaUx1P676Srw7mK/JVPkjaiDxV6D+dRCTq+DZb6b8UUDA92sEqeFzzR+wW3PVxuLJ9SaFzD43gomXDpfGVZcthytxlvNJCVy4mw94wiLyduDgNSD5Q+DrzWb5iX2xpDqtRruoNvm2EnB6Gd/g== 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=t9TXQ/feYFEyNyoGICnA+T0LCAynvvLGhxglyeBkYjE=; b=V+4qu1tZm2CjAy8zM2tnGCFBmZwB54Ff/dRxQWlWIsIOLNlYPTWMwOVbSKM+FC7K4kk/0q344suK3Bv4XcH++diudOTUk1VyUksrt/ST8+LhDlzbpv5yMjgjWZzHkcQqZg/Eh6qH//+0ug7Ko40SE4dfR4mRdwPWbpzr8iuOy4fOd8mrM2VbO3T+pMID1KPzmWDQDqTsdkHfgpKETvuI6XWSqhZ7e49fOflydCn5oJQgXUOFdgGTTtjTI0mkIv/q7EkgvgTT13ND3p6mve2UA9f8+vxuANydMcrYrRveNn+zRip6hJJMUV+hB4OTZgS+W/bVBBWjJZcaNVz8KgD9kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=t9TXQ/feYFEyNyoGICnA+T0LCAynvvLGhxglyeBkYjE=; b=SIPRFhFCJgqPa2Cw70cH/fbOwH6XwbcovZJMPbCGoIqWaW9sItj7R1WXuKmAhtNd3FfvfqgpHIW9b7AXHmCshxL22k7M5u0d1O5OQmPELp4cQXptGhNNjVWmEh3rZaq5sRSQI2nydIzczswUaRarPGxiF1+J3x5dX6w0Ye3CsYD/+3iEjOhpeTyjdbfMQvEAeXZtou9Un7bqo7fSKKMebTfkz/BIDf7Uy61JTBJz3PT0+FQX/xQoFkTCgCVSEADdNO4AFoj0JDjUNr6+4WLCt3LQWIjjywH9C5QZZT0JaKny2XJSBFYT+nLDgBfC5fLANgvQCJCEFUesR2RitcvlHg== Received: from BN9PR03CA0431.namprd03.prod.outlook.com (2603:10b6:408:113::16) by IA1PR12MB8357.namprd12.prod.outlook.com (2603:10b6:208:3ff::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Tue, 25 Jul 2023 13:07:53 +0000 Received: from BN8NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::c8) by BN9PR03CA0431.outlook.office365.com (2603:10b6:408:113::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.34 via Frontend Transport; Tue, 25 Jul 2023 13:07:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT105.mail.protection.outlook.com (10.13.176.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.25 via Frontend Transport; Tue, 25 Jul 2023 13:07:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 25 Jul 2023 06:07:42 -0700 Received: from nvidia.com (10.126.230.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; Tue, 25 Jul 2023 06:07:36 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V4 2/3] virtio_net: support per queue interrupt coalesce command Date: Tue, 25 Jul 2023 16:07:08 +0300 Message-ID: <20230725130709.58207-3-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725130709.58207-1-gavinl@nvidia.com> References: <20230725130709.58207-1-gavinl@nvidia.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.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: BN8NAM11FT105:EE_|IA1PR12MB8357:EE_ X-MS-Office365-Filtering-Correlation-Id: ee0a7fd2-49d8-4ccb-d044-08db8d102846 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1msQQKcp8v/VtgChQkcaX5XJ8QfYcqqWRGxtIE27TZDyYH5vq1RUNaMIuvBoUcYnmHvqHVvADzbD+RjPH1KhizRL6akIMFIujT+RKVjXZRrYSYKjFBOfKoJ9rvAZY+UCy2BTrbTgfYW+AKKPVLkwQxq8xSvuOIpAvvUD7MZvwF9hgpT56sRV0cP6ZLSHgfqeVWy4fZ8a0QtaW/wdfvxOhKkIAtOsM37ZbdTlJS3+l0BNswoAXLbNvJhhWs1V4bxHvzUQ3C8rrz/jSE5Jd0N2EFUdE++VH41C6+HOZHd8N447ihA+K8UHyTPlWFxiHOe7agYtkDuiReQnDVrLPVuvMHHuzrGUS2MBA/f0CjYqRBc/UyjXg4r4Wj1tnXj7IsEFUxuJQ/GDJpz63bfIlfoKzWE8uUogn4YHkZ9OWiOmK/g+hnGHg3c4ZG7Zw4nJxvcpwdXiFpqF3YadsPvPCxvKOr2UgGTWd6Q3by00JGwaZafg9zWKwXwddG5QWy9dk9UkA9mnO5lVgg63Tjhp/dV0fK3XshP5vf/qxhTU0adAAYYnZioQnSRuPFNQidWlsElqtPZR0Q1b8UVDQ/k07jOgDju/1zFa3/GdYyUQKXwSwFuyAywTYYfbONwz1NI5xv5fvRmqO++jtJWNzQwwg0Bph9lD83i/KF4Wh+E78nowjVli9o+42s3DqRzKd6VJV8nBCDIfBJdvNN0FicDq47SR8cDDzoOwvs1CtT+cI+4WqCKGGmQg4J78+EIeZ3JaQ0LH4HhQzNggcYJUI0JqHdcImDMwEoGx4fw6W6JShmGI9IAy74WfPedHJ5qtmL/ArxfW X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(136003)(376002)(346002)(451199021)(82310400008)(36840700001)(40470700004)(46966006)(36756003)(478600001)(316002)(86362001)(4326008)(6666004)(7696005)(110136005)(70586007)(70206006)(6636002)(82740400003)(336012)(186003)(5660300002)(6286002)(41300700001)(16526019)(26005)(1076003)(8676002)(54906003)(7416002)(8936002)(2616005)(426003)(47076005)(40460700003)(2906002)(36860700001)(40480700001)(7636003)(356005)(921005)(55016003)(83380400001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:07:53.5748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee0a7fd2-49d8-4ccb-d044-08db8d102846 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8357 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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: Michael S. Tsirkin 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..c185930d7c9d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -144,6 +144,8 @@ struct send_queue { struct virtnet_sq_stats stats; + struct virtnet_interrupt_coalesce intr_coal; + struct napi_struct napi; /* Record whether sq is in reset state. */ @@ -161,6 +163,8 @@ struct receive_queue { struct virtnet_rq_stats stats; + struct virtnet_interrupt_coalesce intr_coal; + /* Chain pages by the private ptr. */ struct page *pages; @@ -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; }; struct virtnet_info { @@ -3078,6 +3083,55 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, return 0; } +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 = cpu_to_le16(vqn); + vi->ctrl->coal_vq.coal.max_usecs = cpu_to_le32(max_usecs); + vi->ctrl->coal_vq.coal.max_packets = 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 = 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 = ec->rx_coalesce_usecs; + vi->rq[queue].intr_coal.max_packets = ec->rx_max_coalesced_frames; + } + + if (ec->tx_coalesce_usecs || ec->tx_max_coalesced_frames) { + err = 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 = ec->tx_coalesce_usecs; + vi->sq[queue].intr_coal.max_packets = 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 ethtool_coalesce *ec) return 0; } +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 = 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 = netdev_priv(dev); - int ret, i, napi_weight; + int ret, queue_number, napi_weight; bool update_napi = false; /* Can't change NAPI weight if the link is up */ napi_weight = 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 = true; + for (queue_number = 0; queue_number < vi->max_queue_pairs; queue_number++) { + ret = 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, queue_count] will be + * updated for the sake of simplicity, which might not be necessary + */ + break; + } } if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) @@ -3120,8 +3194,8 @@ static int virtnet_set_coalesce(struct net_device *dev, return ret; if (update_napi) { - for (i = 0; i < vi->max_queue_pairs; i++) - vi->sq[i].napi.weight = napi_weight; + for (; queue_number < vi->max_queue_pairs; queue_number++) + vi->sq[queue_number].napi.weight = napi_weight; } return ret; @@ -3149,6 +3223,63 @@ static int virtnet_get_coalesce(struct net_device *dev, return 0; } +static int virtnet_set_per_queue_coalesce(struct net_device *dev, + u32 queue, + struct ethtool_coalesce *ec) +{ + struct virtnet_info *vi = netdev_priv(dev); + int ret, napi_weight; + bool update_napi = false; + + if (queue >= vi->max_queue_pairs) + return -EINVAL; + + /* Can't change NAPI weight if the link is up */ + napi_weight = ec->tx_max_coalesced_frames ? NAPI_POLL_WEIGHT : 0; + ret = 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 = virtnet_send_notf_coal_vq_cmds(vi, ec, queue); + else + ret = virtnet_coal_params_supported(ec); + + if (ret) + return ret; + + if (update_napi) + vi->sq[queue].napi.weight = 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 = netdev_priv(dev); + + if (queue >= vi->max_queue_pairs) + return -EINVAL; + + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) { + ec->rx_coalesce_usecs = vi->rq[queue].intr_coal.max_usecs; + ec->tx_coalesce_usecs = vi->sq[queue].intr_coal.max_usecs; + ec->tx_max_coalesced_frames = vi->sq[queue].intr_coal.max_packets; + ec->rx_max_coalesced_frames = vi->rq[queue].intr_coal.max_packets; + } else { + ec->rx_max_coalesced_frames = 1; + + if (vi->sq[0].napi.weight) + ec->tx_max_coalesced_frames = 1; + } + + return 0; +} + static void virtnet_init_settings(struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); @@ -3279,6 +3410,8 @@ static const struct ethtool_ops virtnet_ethtool_ops = { .set_link_ksettings = virtnet_set_link_ksettings, .set_coalesce = virtnet_set_coalesce, .get_coalesce = virtnet_get_coalesce, + .set_per_queue_coalesce = virtnet_set_per_queue_coalesce, + .get_per_queue_coalesce = virtnet_get_per_queue_coalesce, .get_rxfh_key_size = virtnet_get_rxfh_key_size, .get_rxfh_indir_size = virtnet_get_rxfh_indir_size, .get_rxfh = virtnet_get_rxfh, diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.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 notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */ #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 { }; #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; +}; #endif /* _UAPI_LINUX_VIRTIO_NET_H */ From patchwork Tue Jul 25 13:07:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Li X-Patchwork-Id: 13326424 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 D11FB1F92F; Tue, 25 Jul 2023 13:08:04 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F932E74; Tue, 25 Jul 2023 06:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9eEoet4N28PcM68iNQwwb/cnpoHdbOsd5QBf1H9ZHBtiwCBDGDOo0ralQfAN29MT2VLNr6Qlqy5OrIvsHILtzvH+2S1zGMIGKMLxloHYTmHLViXV8TyPvENXr7cDMWb5cp48/vSvDitO8gQkJ5jVQLe7Mcsj178LeZ4f78+9TrN2YgGaDvcICcEQaLmwJvhnKFBiBbEhnjx65wU7FZ0avaE9Qvdri3QlB1fTZcHuMgVyXfF8BIZftF1aQWcuYfazvJcZAkhavIftShWh4EZjbgxrFgZSX4Deq4uPi4eylhCDOLKL1pAQnTMnxTnt+mH59mzh8SV225rBcTkevhvMA== 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=F68uh+5E2MK8vPgXqUr6OxqxX0KW/cOiWvwQdxldrZc=; b=AssYdqOJ2NqmTP+Ux/L1nf7hA3Ca0KuxTttMGm13HG2StMifPd5ItpkVydABQ1AAt1rBduQbLi3ABcJHibz2PIVaTjNDlkxUf/auK5O1y5k8MkZ853bYGniVdmfjBGHR8R8mmL3yiw42Fnj09NTjFzE8MQsZYN+3EwPTNX55XxdEfXNeUD53UDl9IrC69Hs9GPpL76cF3sTUIbxmovMyJvVBs5h/08kWCRz3HFEecjSZ/rji5+4aYbJy58MRZwRCPJRePVh7e9RAQI34bUqFsHd9M86IayuEJPAfL87Yvgu2IEsbhDozlCmIC7UhVpn8hOxmQnMpKMqMDyqUhmfL7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=F68uh+5E2MK8vPgXqUr6OxqxX0KW/cOiWvwQdxldrZc=; b=Uv6u3fH/k2EIilteUsfPQj71+LvB+QoTk4rsA34lEB9w2BVpFw8iol265r5lsY+E1ObdDC03CRQ41mDsaCFzM00Z6kdCAlNh1Wy/x3gzt0yeaM5a1P/3uMF5Ds+lXOBLNsORdm5TWZ+NSPep7fnSyKQcN8MtaerPVrJJ5Ukwcwna626CWg8OlYkmkekcYgBHxCxDTJUrPDe0FfYouS8UOPk3Fuyomdi3xEl+AwWOlWPGhkP/4DFKBxvGhhQ0KOQFbj6XzIGtyDBkvI7kjYqc8F4JAA5K8ShKrLPTqbn6N9NExfTtR66yRuQWTZJ1LmmfHZv5QRKZMLdH/y/74pqv0Q== Received: from BN9PR03CA0430.namprd03.prod.outlook.com (2603:10b6:408:113::15) by SA0PR12MB4429.namprd12.prod.outlook.com (2603:10b6:806:73::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 13:08:01 +0000 Received: from BN8NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::c5) by BN9PR03CA0430.outlook.office365.com (2603:10b6:408:113::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33 via Frontend Transport; Tue, 25 Jul 2023 13:08:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT105.mail.protection.outlook.com (10.13.176.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.25 via Frontend Transport; Tue, 25 Jul 2023 13:08:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 25 Jul 2023 06:07:47 -0700 Received: from nvidia.com (10.126.230.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; Tue, 25 Jul 2023 06:07:42 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , , Heng Qi Subject: [PATCH net-next V4 3/3] virtio_net: enable per queue interrupt coalesce feature Date: Tue, 25 Jul 2023 16:07:09 +0300 Message-ID: <20230725130709.58207-4-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725130709.58207-1-gavinl@nvidia.com> References: <20230725130709.58207-1-gavinl@nvidia.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.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: BN8NAM11FT105:EE_|SA0PR12MB4429:EE_ X-MS-Office365-Filtering-Correlation-Id: 508d9403-924c-448b-5084-08db8d102c69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9lCwzF49CW9pLeC/pr1DCWGtcI1eW2OqflHpNr703BOKDyKFOXlTi/fiD9ly+B7zoPSuXCPpsXZCKfr52T4ENntsLecpEUIiyxAty2/J3u5SO0nh6ruCEhe/Xb30ZDaoAFZWGOx0QZNB1Ju9hBIBGKIrVv15tsQGpugTCZOiKFU+k6ut1KlaRncjWIKLmMM1gH2Rr/Mf09F957MwcPE1bdOcQkS3w/pX0Rsjy4cxSC0gZkEtlrusOPN/cm1W//4kg54/IVvXLIAsZz3sVwIi5IyS4BZn0JCdJiwsj1KpABmzLND4a7Fa7/oltQVu4NspYXpIqjj3qUA6wnnCZm0aS7WpgLJFeyJWLaatkmW4AUA4y8PgMDiT7tB4h09ssx34jSmTReOug91hcdYcqsWng4zJ5u9ZzGgeLM9PmBpZ4TAxY78arbbbEID2Un8gRKj4ZlijqPaNBECcrRHaQSNQLYM57xKIh7xvoNhpNCcr/PEsY8Hf/1+zjB+x9agoO7jGawH+6snq+pyJUYZS728vMFhvyEr0HjotvP4fAF4Fyy+FkXXmz3CX0JAhUrluvLaqCkHVQbKx2/X2og4js3cqJeq2XV5bGasUV6Y2dVM5KRzbDAy2SeUjGqkzmdz59kzsSfMIHtQ1zDPO/tYtA9JClwGcB9tLyPwOi3Kv5GJSMQzwHi7hT9Xtfu1Gr0Pd47uDeV3dECchJ3+0exEGx26xtyp6enXJZ5vNLZtWfyFrQuNjT2JBrrq3gCIQM8Js1VpRf6Ag0cPi18qlKKYLtVGYuqy/9FpuKa7to7NTxBHyzRrBcCxNEuhOT//dvakEBDgE X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39860400002)(396003)(376002)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(7696005)(6666004)(82740400003)(356005)(478600001)(83380400001)(47076005)(1076003)(26005)(7636003)(70586007)(70206006)(110136005)(4326008)(54906003)(6636002)(6286002)(2616005)(16526019)(336012)(186003)(36860700001)(426003)(921005)(7416002)(5660300002)(8676002)(8936002)(40460700003)(2906002)(41300700001)(316002)(40480700001)(55016003)(86362001)(36756003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 13:08:00.5118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 508d9403-924c-448b-5084-08db8d102c69 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4429 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 c185930d7c9d..57cb75f98618 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -4088,6 +4088,8 @@ static bool virtnet_validate_features(struct virtio_device *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[] = { 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 static unsigned int features[] = {