From patchwork Thu Apr 11 14:12:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heng Qi X-Patchwork-Id: 13626059 X-Patchwork-Delegate: kuba@kernel.org Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (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 CE5F714D458 for ; Thu, 11 Apr 2024 14:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844762; cv=none; b=N19qlisRylwPqPuRFx8HaApSHtJGOd27g/26j+AoT0fk4tK2UCIRsDvJ4AZ6e6GA10y4K1BJ1wSHA1mvOYm6/Wya0atoXuJJ81WjhkIHqY3OJuJ583vi5MW+/vIDstb8Vkf4pXLoxzQJgXWFF4ji1f82tvtp0ysplZWMlBbvdLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844762; c=relaxed/simple; bh=nz8DqrttVEPQzsLDeU9OYfDsKmUFc/2fqu7BsanWWtA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=INwsH+AxHQ9Kaiyx75rwYlns+M3GwZHD2zY/lIjjtiz7BcHvbPNqisq698kFp+p+3qxmDsGRRQsH2x/yPBALhuB1jNgUwZcprOdG9ZaYWxy8t2fItfRpccC5/9BgeA5mF4shuOHOP5aZRKBewTNrNy1SLBdmq3YPfJd8f1UgT2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=fG84EBtT; arc=none smtp.client-ip=115.124.30.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="fG84EBtT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712844757; h=From:To:Subject:Date:Message-Id; bh=oA2VDhgIwe7yk3svHcObVm6iAO1hkQzjSBQ0q4LEUuU=; b=fG84EBtTnT/kuTXKaVD+boVU4rgxwsMQvxeERQdpYxVL4MDEVgz08p4fMO617LeADCZoyWkG/es4qMSKYX5XbwMJIrhEFgKkki1TNqImk3NHOvK3YuOIAKCu5A56IiYJfBEs0fD1CEoCsq7wzJqjW8n/2k2degiUKXS2d19VXCc= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=hengqi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0W4LVnf._1712844756; Received: from localhost(mailfrom:hengqi@linux.alibaba.com fp:SMTPD_---0W4LVnf._1712844756) by smtp.aliyun-inc.com; Thu, 11 Apr 2024 22:12:36 +0800 From: Heng Qi To: netdev@vger.kernel.org, virtualization@lists.linux.dev Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jason Wang , "Michael S. Tsirkin" , Ratheesh Kannoth , Alexander Lobakin , Xuan Zhuo Subject: [PATCH net-next v6 4/4] virtio-net: support dim profile fine-tuning Date: Thu, 11 Apr 2024 22:12:31 +0800 Message-Id: <1712844751-53514-5-git-send-email-hengqi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1712844751-53514-1-git-send-email-hengqi@linux.alibaba.com> References: <1712844751-53514-1-git-send-email-hengqi@linux.alibaba.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-Patchwork-Delegate: kuba@kernel.org Virtio-net has different types of back-end device implementations. In order to effectively optimize the dim library's gains for different device implementations, let's use the new interface params to fine-tune the profile list. Signed-off-by: Heng Qi --- drivers/net/virtio_net.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a64656e..813d9ed 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3584,7 +3584,7 @@ static void virtnet_rx_dim_work(struct work_struct *work) if (!rq->dim_enabled) continue; - update_moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix); + update_moder = dev->rx_eqe_profile[dim->profile_ix]; if (update_moder.usec != rq->intr_coal.max_usecs || update_moder.pkts != rq->intr_coal.max_packets) { err = virtnet_send_rx_ctrl_coal_vq_cmd(vi, qnum, @@ -3868,7 +3868,8 @@ static int virtnet_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info) static const struct ethtool_ops virtnet_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_MAX_FRAMES | - ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE_RX, + ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE_RX | + ETHTOOL_COALESCE_RX_EQE_PROFILE, .get_drvinfo = virtnet_get_drvinfo, .get_link = ethtool_op_get_link, .get_ringparam = virtnet_get_ringparam, @@ -4424,6 +4425,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi) static void virtnet_dim_init(struct virtnet_info *vi) { + struct net_device *dev = vi->dev; int i; if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) @@ -4433,6 +4435,8 @@ static void virtnet_dim_init(struct virtnet_info *vi) INIT_WORK(&vi->rq[i].dim.work, virtnet_rx_dim_work); vi->rq[i].dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE; } + + dev->priv_flags |= IFF_PROFILE_USEC | IFF_PROFILE_PKTS; } static int virtnet_alloc_queues(struct virtnet_info *vi)