From patchwork Wed Apr 17 15:55:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heng Qi X-Patchwork-Id: 13633547 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) (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 71F5C13C668; Wed, 17 Apr 2024 15:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369354; cv=none; b=ChpcE9kC9URlJEKmB4oBOecG/zS1gxH2TqNs2PXm03sbJ5PFC0KJoyTg9rVagXoVgwiFa7o9xLDwxeqvZWxtc9YoegCJOefezDBlFKIG9ZL2icOMTCHEw/vooJt87gwYEYsR38J41ozOxkFUpRNiE0HiweF1sI2zrlfGgTYv+dU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369354; c=relaxed/simple; bh=fSCMXHosG6yJnwOV7j470ZFoxc6C5kuNWCnp6oBe+04=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GhsQ0qFlZI3AYeHHOy/AQAV6OQNpU6SLdOLlV+gynwXaesuAmTzPeHo9O6d7Q0kvXrGr90/qSlqvgtJerg1YEQmKRpk5sRmFaxjiFjJbeYVfiW2OaVJFkoR5cofMKWMaj00MGrmRl7S57/yYqI8IyFkEO72IdEaD4RAbuqiqOyg= 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=nv/bCglu; arc=none smtp.client-ip=115.124.30.99 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="nv/bCglu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1713369349; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=0OqOCKMP3XScfl7kU3H6IIL/prgfPXSMkgdAX2mmh5A=; b=nv/bCgluF6eiskr2S26DMnv9eXU5cQy8zl4YQIyqnuZ9bIwdbgiucrbUEVH/Y5IrQpsqy+zqzYlKrlvuS6q32B4HFCscOKuQieLVXkaln5kApEPbjfYb1UPjn8JJhTGWTLbaIviFz5QSWrgZJnIGHoYNwS12VtYR1mcAzaTssOs= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R621e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=hengqi@linux.alibaba.com;NM=1;PH=DS;RN=23;SR=0;TI=SMTPD_---0W4m.sh7_1713369346; Received: from localhost(mailfrom:hengqi@linux.alibaba.com fp:SMTPD_---0W4m.sh7_1713369346) by smtp.aliyun-inc.com; Wed, 17 Apr 2024 23:55:47 +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" , Brett Creeley , Ratheesh Kannoth , Alexander Lobakin , Xuan Zhuo , Tal Gilboa , Jonathan Corbet , linux-doc@vger.kernel.org, Maxime Chevallier , Jiri Pirko , Paul Greenwalt , Ahmed Zaki , Vladimir Oltean , Kory Maincent , Andrew Lunn , "justinstitt@google.com" Subject: [PATCH net-next v9 0/4] ethtool: provide the dim profile fine-tuning channel Date: Wed, 17 Apr 2024 23:55:42 +0800 Message-Id: <20240417155546.25691-1-hengqi@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The NetDIM library provides excellent acceleration for many modern network cards. However, the default profiles of DIM limits its maximum capabilities for different NICs, so providing a way which the NIC can be custom configured is necessary. Currently, interaction with the driver is still based on the commonly used "ethtool -C". Since the profile now exists in netdevice, adding a function similar to net_dim_get_rx_moderation_dev() with netdevice as argument is nice, but this would be better along with cleaning up the rest of the drivers, which we can get to very soon after this set. Please review, thank you very much! Changelog ===== v8->v9: - Fix the compilation error of conflicting names of rx_profile in dim.h and ice driver: in dim.h, rx_profile is replaced with dim_rx_profile. So does tx_profile. v7->v8: - Use kmemdup() instead of kzalloc()/memcpy() in dev_dim_profile_init(). v6->v7: - A new wrapper struct pointer is used in struct net_device. - Add IS_ENABLED(CONFIG_DIMLIB) to avoid compiler warnings. - Profile fields changed from u16 to u32. v5->v6: - Place the profile in netdevice to bypass the driver. The interaction code of ethtool <-> kernel has not changed at all, only the interaction part of kernel <-> driver has changed. v4->v5: - Update some snippets from Kuba, Thanks. v3->v4: - Some tiny updates and patch 1 only add a new comment. v2->v3: - Break up the attributes to avoid the use of raw c structs. - Use per-device profile instead of global profile in the driver. v1->v2: - Use ethtool tool instead of net-sysfs Heng Qi (4): linux/dim: move useful macros to .h file ethtool: provide customized dim profile management virtio-net: refactor dim initialization/destruction virtio-net: support dim profile fine-tuning Documentation/netlink/specs/ethtool.yaml | 33 +++ Documentation/networking/ethtool-netlink.rst | 8 + drivers/net/virtio_net.c | 46 +++-- include/linux/dim.h | 13 ++ include/linux/ethtool.h | 11 +- include/linux/netdevice.h | 24 +++ include/uapi/linux/ethtool_netlink.h | 24 +++ lib/dim/net_dim.c | 18 +- net/core/dev.c | 79 ++++++++ net/ethtool/coalesce.c | 201 ++++++++++++++++++- 10 files changed, 430 insertions(+), 27 deletions(-)