Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (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 30D9213D538 for ; Thu, 23 May 2024 09:58:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716458309; cv=none; b=nX9ejd2j3bSpXgW0oFXDxFANJHFMM/pyPxS20Js5MnklGJJ8rgoybSCAF1QD4zSFYI0XG25rqsJ4mFpwQevY7Hv9yoMiit9H2Bm+3KFJAuOxVyzDl1A7iPxoLRErMe+82vJkUDpHyeK6vwglTWxsKLWwDwXbb2TRd65mSMKfLK0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716458309; c=relaxed/simple; bh=BciSeVu9Zm/YhnEmnzfnytCXgogLbaFbhJ9LCiXgChg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=aflDNob+IvIO9O7cfPnFF9+dgfuGnVDnn1sGVx9cB/jIbTBNsqNlHDO+UqGDeOUUJBu4FeBhgT/tGhvM8fhVkFpAadJc4mEx61NN5o62ukgypjRobuGdPwRFwPx7wISvKadCn8dKPcm5dcvI4bkrnaF9wE6fl9VTbhzWB6pBMVg= 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=HeHuVk4Y; arc=none smtp.client-ip=115.124.30.98 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="HeHuVk4Y" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716458304; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=4H6pulniQIOR1H7Sd0jSK3gGjEwDYhyQLzqVhDtr2mw=; b=HeHuVk4Y/DBI/Buzz5p3mtqU0chP3Z5QEm3xXXSM/Zu4ZG8mG8G5OWLa6sgjB5047iWdm9ajWq+WLGiWkWfDvIuoZgR7rHBqjo8A70y+S4saTfSKJQw2FeYyNyOpUeCItDoy8wZ4bpd3QiYFMGd69hkgAO2HkK/H4DxgaAA4J7c= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067112;MF=hengqi@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0W72U7hj_1716458302; Received: from localhost(mailfrom:hengqi@linux.alibaba.com fp:SMTPD_---0W72U7hj_1716458302) by smtp.aliyun-inc.com; Thu, 23 May 2024 17:58:23 +0800 From: Heng Qi To: virtio-comment@lists.linux.dev Cc: Jason Wang , Parav Pandit , "Michael S . Tsirkin" , Xuan Zhuo Subject: [PATCH v4] virtio-net: clarify coalescing parameters settings Date: Thu, 23 May 2024 17:58:22 +0800 Message-Id: <20240523095822.116289-1-hengqi@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f Precedence: bulk X-Mailing-List: virtio-comment@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The device can set any initial coalescing parameters (0 or non-zero) for the receive/send queue before the setting command is executed, not just 0, enhancing device performance even without DIM enabled. So we need to clarify descriptions that don't fit the behavior. Suggested-by: Jason Wang Signed-off-by: Heng Qi --- v3->v4: - Doesn't force the device to remember more stuff. @Parav v2->v3: - Clarify description to be more generic. @Parav v1->v2: - Update description. @Jason device-types/net/description.tex | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/device-types/net/description.tex b/device-types/net/description.tex index 61cce1f..2764e04 100644 --- a/device-types/net/description.tex +++ b/device-types/net/description.tex @@ -1803,6 +1803,14 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi for an enabled transmit/receive virtqueue whose index is \field{vq_index}. \end{enumerate} +If the VIRTIO_NET_F_NOTF_COAL or VIRTIO_NET_F_VQ_NOTF_COAL feature is negotiated, +the device may apply any coalescing parameters to each transmit/receive virtqueue +before the driver successfully performs one of the VIRTIO_NET_CTRL_NOTF_COAL set commands. + +The driver can query the current coalescing parameters of any enabled transmit/receive +virtqueue using the VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET command, before or after any +VIRTIO_NET_CTRL_NOTF_COAL set command is done. + The device may generate notifications more or less frequently than specified by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class. If coalescing parameters are being set, the device applies the last coalescing parameters set for a @@ -1885,17 +1893,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi VIRTIO_NET_ERR if the designated virtqueue is not an enabled transmit or receive virtqueue. Upon disabling and re-enabling a transmit virtqueue, the device MUST set the coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, to 0. +to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, the device MAY initialize them to any values. Upon disabling and re-enabling a receive virtqueue, the device MUST set the coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, to 0. +to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, the device MAY initialize them to any values. The behavior of the device in response to set commands of the VIRTIO_NET_CTRL_NOTF_COAL class is best-effort: the device MAY generate notifications more or less frequently than specified. A device SHOULD NOT send used buffer notifications to the driver if the notifications are suppressed, even if the notification conditions are met. -Upon reset, a device MUST initialize all coalescing parameters to 0. +Upon reset, a device MAY set any coalescing parameters for all transmit and receive virtqueues. \paragraph{Device Statistics}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Device Statistics} -- 2.32.0.3.g01195cf9f