From nobody Mon Oct 6 17:04:35 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 6ADB41E7C2D for ; Fri, 18 Jul 2025 06:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752819545; cv=none; b=SFJebAhRBvUGdCdyoAQCDPfchT4TxuXkvrOKEblkdx8lF8wSB/WWMuonCu6LzPhY3iqLXLE94rYPGX/WOH/koUeytZMLcSsBrtUaeM+x9KvF81qBZIZy6zKhSpWUuL3UpfjMwQnkc2iRNTq/6s0R7feDAHw+VOyB1HFwFl84R14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752819545; c=relaxed/simple; bh=AoH2pIUWrD5MbUepOmIQK6BEXrzdiV0jm/OvN5qurII=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=iFJYC2wv84BRIbyfnXAPtkHGWcrO9xGqMCQQSbrI9O9dajKrQl6HZHoR6yg8dW+3xH7BKQHkToIdSG9nE1xuiwozpY58ZgfE08D2Ty+nwhfh/HkObVgXbX21qFE36/lWNftwRRsoifDXkmlAyJU2QvKy4N7x0yu6OlqRqym8M4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=O/CZ2cuV; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O/CZ2cuV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752819542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2I8jDNCG0L+52nyGGUbEIAwL2BkN8wDU3xL1GQ5jtVg=; b=O/CZ2cuV3gdH46RkU1Vi9CNXaFeUcE7T1D05Ox+6UedSDeO6TRPCnDmBouCblQJ087ZmqL unslEAYJ93tJkce3GJ1ByaAZoud6C1kxfPnz45Jic1lIWthDLMskFOxiDpFNFvJsCnSO2H 6yFXCFM163iB0IGX+OG2gqm43ZMCq70= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-o_vCKiBCOTOiBsc--Rz8LA-1; Fri, 18 Jul 2025 02:18:57 -0400 X-MC-Unique: o_vCKiBCOTOiBsc--Rz8LA-1 X-Mimecast-MFC-AGG-ID: o_vCKiBCOTOiBsc--Rz8LA_1752819534 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FD49195FD2B; Fri, 18 Jul 2025 06:18:53 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.34]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 637F318002AF; Fri, 18 Jul 2025 06:18:42 +0000 (UTC) From: Cindy Lu To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Michael Kelley , Shradha Gupta , Kees Cook , Jason Wang , Stanislav Fomichev , Kuniyuki Iwashima , Alexander Lobakin , Guillaume Nault , Joe Damato , Ahmed Zaki , linux-hyperv@vger.kernel.org (open list:Hyper-V/Azure CORE AND DRIVERS), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list), lulu@redhat.com Subject: [PATCH RESEND] netvsc: transfer lower device max tso size Date: Fri, 18 Jul 2025 14:17:55 +0800 Message-ID: <20250718061812.238412-1-lulu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: Jason Wang When netvsc is accelerated by the lower device, we can advertise the lower device max tso size in order to get better performance. One example is that when 802.3ad encap is enabled by netvsc, it has a lower max tso size than 64K. This will lead to software segmentation of forwarding GSO packet (e.g the one from VM/tap). This patch help to recover the performance. Signed-off-by: Jason Wang Tested-by: Cindy Lu --- drivers/net/hyperv/netvsc_drv.c | 2 +- include/linux/netdevice.h | 4 ++++ net/core/dev.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_dr= v.c index c41a025c66f0..7af4aa4f4abe 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2440,7 +2440,7 @@ static int netvsc_vf_changed(struct net_device *vf_ne= tdev, unsigned long event) * switched over to the VF */ if (vf_is_up) - netif_set_tso_max_size(ndev, vf_netdev->tso_max_size); + netif_stacked_transfer_tso_max_size(vf_netdev, ndev); else netif_set_tso_max_size(ndev, netvsc_dev->netvsc_gso_max_size); } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index adb14db25798..c695a3ffecd8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5275,6 +5275,9 @@ void netdev_change_features(struct net_device *dev); void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev); =20 +void netif_stacked_transfer_tso_max_size(const struct net_device *rootdev, + struct net_device *dev); + netdev_features_t passthru_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features); @@ -5326,6 +5329,7 @@ static inline bool netif_needs_gso(struct sk_buff *sk= b, } =20 void netif_set_tso_max_size(struct net_device *dev, unsigned int size); + void netif_set_tso_max_segs(struct net_device *dev, unsigned int segs); void netif_inherit_tso_max(struct net_device *to, const struct net_device *from); diff --git a/net/core/dev.c b/net/core/dev.c index be97c440ecd5..3bec4284adff 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3306,6 +3306,24 @@ void netif_set_tso_max_size(struct net_device *dev, = unsigned int size) } EXPORT_SYMBOL(netif_set_tso_max_size); =20 +/** + * netif_stacked_transfer_tso_max_size - transfer tso max size + * @rootdev: the root or lower level device to transfer tso max size from + * @dev: the device to transfer operstate to + * + * Transfer tso max size from root to device. This is normally + * called when a stacking relationship exists between the root + * device and the device(a leaf device). + */ +void netif_stacked_transfer_tso_max_size(const struct net_device *rootdev, + struct net_device *dev) +{ + dev->tso_max_size =3D rootdev->tso_max_size; + netif_set_gso_max_size(dev, READ_ONCE(rootdev->gso_max_size)); + netif_set_gso_ipv4_max_size(dev, READ_ONCE(rootdev->gso_ipv4_max_size)); +} +EXPORT_SYMBOL(netif_stacked_transfer_tso_max_size); + /** * netif_set_tso_max_segs() - set the max number of segs supported for TSO * @dev: netdev to update --=20 2.45.0