Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2662233rwo; Sun, 23 Jul 2023 21:53:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlHuT5SB0sO4uZKECnPjiPjtz0H4REJ3Ln/h2Fo5t8nVXqyFwHyY/JvXcHHiY18VQQ3eDgl0 X-Received: by 2002:a05:6402:b10:b0:51e:164c:b67e with SMTP id bm16-20020a0564020b1000b0051e164cb67emr8825926edb.0.1690174437498; Sun, 23 Jul 2023 21:53:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690174437; cv=pass; d=google.com; s=arc-20160816; b=cHCKgBzbudNdOWO7L63O4IHvPuiGPGL2rqyuK/D7r1IrEVj53Vjpg4OsmvTDUELZi8 vB23HGaILZrGWMr3IZbQjjxcNEiMXuDN9rhCW7e41QRJu7Ff0qDb/dvJoZ9DfSUa/+KB iPwNKkxRBod7YWpWNPDbRsU5eVfZB+SWixh5JXIATsOzGNlpbfjq0LUgY7SMHWZgMGCw A0ylSn4G85MCV2EZRwA7K90qZHHIks8OR9yJzRog8ZCR6DjCZdn+5HhI5PbO3HfiNAJB g13xk2ftxAuYfo/1CZYM4nzahmSQqaYbd5hxC+ofVZTJj0paKug4IUv2WPg/IlMITd/E WTTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5HnE17WXvUiKdousTex6K1czsq9mCbCP2v/hVcbXrVo=; fh=F8O/Gs4v2qQ97gqEWyAHu3Vj5n0YrABcGaPs21cgWlk=; b=m7yiD8WkOc7XipyUNzfA7vNpmJX/rfGIWnsfg7nwqGTSzdsSARfnviWN5tjFqYfPPq 7Xj/P5DZF6z6EHgXfuBEhkai5+MXnAX3Dq2BuEkzWPtNteS3wBfvMGZc8E5hd6QRQ4jk iUG37Q/NWQf0NMna2M6zVEgrE3BUPoposG0KMIio+4QGcJaXJw5XvXrqyOz2+Xwblvx7 rQ65YM/nCED2gzRMpOoBwLuoJ0ZG/5a/tjnMj6SUd43VhoZAV1nskaYmAEOBAcOJZVCp 31YYS1TsJmyEXQ9HZqpVHkZR8UNOooCb07ww8i1J0u/YcYRTA00D8kums0lQ71aoic63 +xoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=hAB31cwh; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c16-20020aa7c990000000b0051dd43b81b0si5976232edt.25.2023.07.23.21.53.33; Sun, 23 Jul 2023 21:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=hAB31cwh; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbjGXDlq (ORCPT + 99 others); Sun, 23 Jul 2023 23:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbjGXDlk (ORCPT ); Sun, 23 Jul 2023 23:41:40 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2054.outbound.protection.outlook.com [40.107.94.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 813ACE43; Sun, 23 Jul 2023 20:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWSuNhsW02m7Z2b7MFCQ6nJkFSww7fuUnyo5o0XPjP1NHUCZV3sJ7lJkgh3jiccn2WOGuE+o3OUvgrrrq8qBZSkMyOqvWiAj5dF5RH56QpMY1T6bLIzWWqC9omyLji3+X3q3lU38sxjOpHa3mFUI6OxLRpVCgiZ+tzrgNWLyr2S/cyQHLY0udWPopIUh6jmWFqDqfZw5XdxkUdC4Qq+qqIZkoiTguJS5H1ps0puMtKZ9eMRMZdf+JP0SojDyDv9ZIeuP0/YcC8NBRpGOwJ6x85dsR0YxA8ntG+tlG4utDE0cJ+R0/z2/0XiBGUL52Yz8+B6jgeVdOM3gSrRrAj03Ag== 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=5HnE17WXvUiKdousTex6K1czsq9mCbCP2v/hVcbXrVo=; b=OPM2kJkA0uNluw4p2A/S/WoJ4xWj4tNCbrH1lPTq0Q7Tg/aegOVq22yuxL1jn4E9IlEPHdHkVELt8vkmbKPMBa3bdNTWsqcOmdMkW7KTlX+UcW2NMIEZvgg8kCYMB3VJj2jzT8Pb5Y01GjuGEecvxFCyAQgJfn2TjN9Ze1nlH5mXymaqgRkTHXhKD3RXBghyBUVNljJw8yOVN4+qPAkOGpCClPsunwcGXOtBRCDEYnG9W9a/ptFkfhOkerOoAO4uWe2zkBCkn9xSLobNjQfnvOj6d8Bs8AIkZZPdmvBETRABLXfMWqINhhK43lDC28Djl3aOkaPyVEXgTnS7Rc71/w== 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=5HnE17WXvUiKdousTex6K1czsq9mCbCP2v/hVcbXrVo=; b=hAB31cwhpHqCDLWO3ExUNQR3s5nDGKuQI/ymaaGlGx5+5C1aT7ENlBBn0MS+skj0rnfEWwDR8pxwb72Gl500gqciLcTNoe/zD0B8zpudo0jKHk3jFa7vV0MIYbb/PB8HFu5sVQ38CvDtiux0uWaUoIjG7QeQT0leFYqiH2Mb0tucuTBMO/tBDlDjXMyDPpab/nyxMUcOv93aNlxcqQtdf14NtQ1X8WaAP6JJQnLh62WjYzwYB7V9dVCoB//dHSSSEqZz53KSC07q5T6lwH03X6CcAnoTHxwiCc5N0RY1GdMnZ9GUqZ19nwljuKzR+PuoWSVwPCYOAWqCJMYmopOFPQ== Received: from BN9PR03CA0123.namprd03.prod.outlook.com (2603:10b6:408:fe::8) by SJ1PR12MB6050.namprd12.prod.outlook.com (2603:10b6:a03:48b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 03:41:37 +0000 Received: from BN8NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fe:cafe::ba) by BN9PR03CA0123.outlook.office365.com (2603:10b6:408:fe::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28 via Frontend Transport; Mon, 24 Jul 2023 03:41:37 +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 BN8NAM11FT099.mail.protection.outlook.com (10.13.177.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.24 via Frontend Transport; Mon, 24 Jul 2023 03:41:36 +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; Sun, 23 Jul 2023 20:41: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; Sun, 23 Jul 2023 20:41:21 -0700 From: Gavin Li To: , , , , , , , , , , , , CC: , , , , Subject: [PATCH net-next V3 2/4] virtio_net: extract get/set interrupt coalesce to a function Date: Mon, 24 Jul 2023 06:40:46 +0300 Message-ID: <20230724034048.51482-3-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230724034048.51482-1-gavinl@nvidia.com> References: <20230724034048.51482-1-gavinl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: BN8NAM11FT099:EE_|SJ1PR12MB6050:EE_ X-MS-Office365-Filtering-Correlation-Id: 93be3d80-f69e-4fbe-619c-08db8bf7e221 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F9DgAj4ndXfrcCZd3gR7AwsZnc6wtj8hd0mXQT4oEIrCvRXcNGD1pNkejQaNaiN6C75IVh3F6n25BT/RdACYnpFXiS/WcVQei1PGDIh7BU+lXGFbev+jI8BEJjEAYv2HlIXHDLY1ZafzeE6/JwtKhWS9g1oc/q/aSYydz5Q9GSZ9/jUkAtAEz7im4x2ISi+IN0kEqaEWHSHnELE1Ht6iILYoTzZpAc++uW16tpP1OMYB06DnLWafV96gUB3d6ewa7tBbqcM8iZedYfrBV98i4ngQ8W+uuxLLZ225Im3fpmwWteCUkgFA0yxBFnj2txDyAtHNPNbvqqbpzy3exAu5MDh2OZTQ8/C/TfU/ogqpivAc4v+pCJUVKr9jE6vTa/NGuiTuC/21FDviqYa0W1HsHnSGyT4m2adGaHqm0A1foIZENI4uywfHQNaqKoy6tr+b+bcpvYHMpnBb5mXmehDmNGP3yKY0I6aYtcbDXBeCTn4YTaCoZe4R7j+zeJoudfM2XPLmBxCDBD2ZoeCajh7Fbfl9SjyMaTj7JJdFkvrC8ZIhBc1QqyzFD4Er1SBFkitkc8+wsw8TYsT2MrpkGN9/ZMSSedxeB1l/19n/4Xi+Hq48nNnlPfxVzZY7FPScnRqT8BkpqHZ7+pTvwPz3PVkg8+SXHEXX5C1wdc+zQ8QSr9GEgjorx9YhjCVSx7Pl8Ni/rmYwAkc721TsrC3rDbHgZEedXuRDNPJAYDEAB9pcacRUBEO9TIrxrpEd1eIaXxyRL219WatY5CsabB5uASkPCE8rcNN4T3bqgMrAxmO8+8YV72v9gj+NXu2ePiLf1Ys8 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)(396003)(346002)(376002)(136003)(39860400002)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(40460700003)(86362001)(82740400003)(356005)(921005)(7636003)(40480700001)(55016003)(2906002)(6666004)(7696005)(2616005)(426003)(47076005)(16526019)(1076003)(336012)(186003)(6286002)(26005)(36756003)(5660300002)(41300700001)(70586007)(70206006)(316002)(6636002)(4326008)(478600001)(7416002)(8676002)(8936002)(54906003)(110136005)(83380400001)(36860700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2023 03:41:36.8047 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93be3d80-f69e-4fbe-619c-08db8bf7e221 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: BN8NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6050 X-Spam-Status: No, score=-2.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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extract get/set interrupt coalesce to a function to be reused by global and per queue config. Signed-off-by: Gavin Li Reviewed-by: Dragos Tatulea Reviewed-by: Jiri Pirko Acked-by: Jason Wang Acked-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index dd5fec073a27..802ed21453f5 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3093,10 +3093,8 @@ static int virtnet_coal_params_supported(struct ethtool_coalesce *ec) 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) +static int virtnet_set_coalesce_one(struct net_device *dev, + struct ethtool_coalesce *ec) { struct virtnet_info *vi = netdev_priv(dev); int ret, i, napi_weight; @@ -3127,10 +3125,16 @@ static int virtnet_set_coalesce(struct net_device *dev, return ret; } -static int virtnet_get_coalesce(struct net_device *dev, +static int virtnet_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) +{ + return virtnet_set_coalesce_one(dev, ec); +} + +static int virtnet_get_coalesce_one(struct net_device *dev, + struct ethtool_coalesce *ec) { struct virtnet_info *vi = netdev_priv(dev); @@ -3149,6 +3153,14 @@ static int virtnet_get_coalesce(struct net_device *dev, return 0; } +static int virtnet_get_coalesce(struct net_device *dev, + struct ethtool_coalesce *ec, + struct kernel_ethtool_coalesce *kernel_coal, + struct netlink_ext_ack *extack) +{ + return virtnet_get_coalesce_one(dev, ec); +} + static void virtnet_init_settings(struct net_device *dev) { struct virtnet_info *vi = netdev_priv(dev); -- 2.39.1