Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1717844rwr; Fri, 5 May 2023 20:16:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ccjaAG5XJzeMcPF2fP5fEOnM2Hqc2/PQKu96YXhOsFp1y1JrDqYvPqftTwilfW81sa+oz X-Received: by 2002:a17:902:9885:b0:1a6:6fe3:df91 with SMTP id s5-20020a170902988500b001a66fe3df91mr3455383plp.50.1683343004095; Fri, 05 May 2023 20:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683343004; cv=none; d=google.com; s=arc-20160816; b=HlO+UO82X66dL4lgIJIk9N2OpgA+Zzs+Ug03PsGWC5ksnnyYIc+pf+QZmwN1YnlP3z AFvrhdKpT205wUzxULQ5zBJdSlSRbsFmabBLsctbb0splAatVb4iT9sUee+ShbyCO85J lOoQWpMwdpNn5Kcm6flKh3fS1spEAiQj5rsaGEhantkiw74/J1epnnOHiPWYZg0ACdu8 jT1SCX3A39ae5xHJDMaT/JwGtPdPdUshWnEDGC09XZXtLqUA0cgWao9vP0wxvoP5/Js2 1qBNiSCkGRU6451hSaGGCBv7LEawX28FF0SM9m60FGHCoQ+HdhntRG5CZY8w6Dnxsyz0 2EmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from:date:subject :message-id; bh=c2jMubKR4iXUj83FV3lYKHusW/MY/Wok7gvCmr/D/gQ=; b=hyedOhospNgGfT3wjh5R7O+dUUnLmcJWqM5+pyvPXZzWF2at1A8RMLvwP1kZ8Fbv8v NrcmhRoQ+QdGeHOlGmOnkzLkS1cNj6D0LBCuFaisDObphdhsMp9/ev1vd+IX8N/Nt8bp Fzo3XsZBohNU106eT3r974N1izFYvKS5Xs0kHBXO71PBb6TYlB0mHLjeELPpGEctZZNK 1C+bYZ4zWUZnkTuwTkv9uqPIO4rvI5Jrd/TFdwViS6d8NIO2/hCp0BDVKbi3F7EM1XHd a/27yTav68XSVP6Kgzfc+56g9mB3K6HFcOrp0QHQq1TPTPAMRphvbijAH2JVf3qDXvGD LxSQ== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170903230100b001ab29399c72si3332579plh.502.2023.05.05.20.16.22; Fri, 05 May 2023 20:16:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231949AbjEFCyU (ORCPT + 99 others); Fri, 5 May 2023 22:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjEFCyT (ORCPT ); Fri, 5 May 2023 22:54:19 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7547AAB; Fri, 5 May 2023 19:54:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VhrbjLx_1683341652; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0VhrbjLx_1683341652) by smtp.aliyun-inc.com; Sat, 06 May 2023 10:54:13 +0800 Message-ID: <1683341417.0965195-4-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH] virtio_net: set default mtu to 1500 when 'Device maximum MTU' bigger than 1500 Date: Sat, 6 May 2023 10:50:17 +0800 From: Xuan Zhuo To: Hao Chen Cc: huangml@yusur.tech, zy@yusur.tech, "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , virtualization@lists.linux-foundation.org (open list:VIRTIO CORE AND NET DRIVERS), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) References: <20230506021529.396812-1-chenh@yusur.tech> In-Reply-To: <20230506021529.396812-1-chenh@yusur.tech> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 On Sat, 6 May 2023 10:15:29 +0800, Hao Chen wrote: > When VIRTIO_NET_F_MTU(3) Device maximum MTU reporting is supported. > If offered by the device, device advises driver about the value of its > maximum MTU. If negotiated, the driver uses mtu as the maximum > MTU value. But there the driver also uses it as default mtu, > some devices may have a maximum MTU greater than 1500, this may > cause some large packages to be discarded, You mean tx packet? If yes, I do not think this is the problem of driver. Maybe you should give more details about the discard. > so I changed the MTU to a more > general 1500 when 'Device maximum MTU' bigger than 1500. > > Signed-off-by: Hao Chen > --- > drivers/net/virtio_net.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 8d8038538fc4..e71c7d1b5f29 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -4040,7 +4040,10 @@ static int virtnet_probe(struct virtio_device *vdev) > goto free; > } > > - dev->mtu = mtu; > + if (mtu > 1500) s/1500/ETH_DATA_LEN/ Thanks. > + dev->mtu = 1500; > + else > + dev->mtu = mtu; > dev->max_mtu = mtu; > } > > -- > 2.27.0 >