Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp140116rdb; Thu, 5 Oct 2023 21:03:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnONaw4O42Y38GHL6Tti3/P8RmJb8xUf2DqRH6FQNda9tkMUwW/3Bb1pWPUnQ4421MFCFR X-Received: by 2002:a05:6a20:dd9e:b0:169:7d6f:9f22 with SMTP id kw30-20020a056a20dd9e00b001697d6f9f22mr4301799pzb.54.1696565028619; Thu, 05 Oct 2023 21:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696565028; cv=none; d=google.com; s=arc-20160816; b=A8SuHIlJgXXjxOsErFAPfO4VE06JQddWlvAbXrW5T7+hL5UYKxYlz7u7bZII2Qi3Qk Is/kw0tvVCFTCHkQYy5EICgiT3IBVhy1+QuiiPUe5UkXfu9EQ1t31jmGVczLR8L/pYKB nDu88pLHtkIZ7qpGXGYPksNKWp1DVBmVY1Pi9+BsUHvletUKuwVaKFckzHH8+X6o+/Ps l6FKU68mj0Iwlhjfref/dU5rNWeMq/OxCny1Q3BaMyjnVs9dwc+RrXf3Jj8rpPrlYZHV KyG5iC/hU/hYFnk07+CHuJ1Gpi3qj7p2Fcf3oeEg7MqrYoMKhOikz1yxnP+GL63aodl2 mI0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=QeOfo/nVjc7F5jpMTyRCgTHRsJPVrfbqBsWx/bBV6KY=; fh=4cc/wXX0dEBUMUtAktj5f1bMSi+Qt/JipdS8O2hUCaY=; b=TJkvncM7loZ2Wrww9V8ff42HjGb6tdU4VhnyPWSzEZEH0v86kRQzsKzCtJ2QtIq7n2 g/K/VYq/xwoxdJrKT4MfdtoCSO6gxci7j6jPZFyfkD8nbihf9COr4f6IVmc4LnKHtQUF 31qbvQvzDoNwrqmk+rIHdDpxfkZD0r+NcNVGxwnRGCYSOfvbgGCZQCQaKnn2xBbNFx4z oVtTGhHEqbtrS1LUk4WsZnqK2QPgBpUIYFDLG1VBPA9H7agxJH95RBl0d5I9DIhJOJ7v n7uqbqfVoGZ5rLNoOwrIkucxsy2Hj+yRPfbdtyc6h+qaEk3N0nzznYFyFr9OpuSG7NwZ 6WXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e11-20020a65688b000000b00584b9d0ff81si2790879pgt.635.2023.10.05.21.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 21:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9FD07838B3D4; Thu, 5 Oct 2023 21:03:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjJFEDf convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Oct 2023 00:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjJFEDe (ORCPT ); Fri, 6 Oct 2023 00:03:34 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C664FDB; Thu, 5 Oct 2023 21:03:30 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 39642neN61336496, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.92/5.92) with ESMTPS id 39642neN61336496 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Oct 2023 12:02:51 +0800 Received: from RTEXMBS02.realtek.com.tw (172.21.6.95) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 6 Oct 2023 12:02:49 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS02.realtek.com.tw (172.21.6.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 6 Oct 2023 12:02:49 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7]) by RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7%5]) with mapi id 15.01.2375.007; Fri, 6 Oct 2023 12:02:49 +0800 From: Justin Lai To: Andrew Lunn CC: "kuba@kernel.org" , "davem@davemloft.net" , "edumazet@google.com" , "pabeni@redhat.com" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Ping-Ke Shih , Larry Chiu Subject: RE: [PATCH net-next v9 08/13] net:ethernet:realtek:rtase: Implement net_device_ops Thread-Topic: [PATCH net-next v9 08/13] net:ethernet:realtek:rtase: Implement net_device_ops Thread-Index: AQHZ8fl5hDe6qB9qzkmKif0/hXC9sLAvvsaAgAxiTMA= Date: Fri, 6 Oct 2023 04:02:48 +0000 Message-ID: <99dfcd7363dc412f877730fab4a9f7dd@realtek.com> References: <20230928104920.113511-1-justinlai0215@realtek.com> <20230928104920.113511-9-justinlai0215@realtek.com> In-Reply-To: Accept-Language: zh-TW, en-US Content-Language: zh-TW x-originating-ip: [172.21.210.185] x-kse-serverinfo: RTEXMBS02.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 21:03:47 -0700 (PDT) > > +static int rtase_change_mtu(struct net_device *dev, int new_mtu) { > > + struct rtase_private *tp = netdev_priv(dev); > > + int ret; > > + > > + dev->mtu = new_mtu; > > + > > + if (!netif_running(dev)) > > + goto out; > > + > > + rtase_down(dev); > > + > > + rtase_set_rxbufsize(tp, dev); > > + > > + ret = rtase_init_ring(dev); > > + > > + if (ret) > > + return ret; > > If this fails, what state is the interface in? > > What you often see is that the new ring is first allocated. If that is successful, > you free the old rung. If the allocation fails, it does not matter, you still have > the old ring, and you keep using it. > If it fails, the driver will not work properly. We will make modifications based on your suggestions. > > + > > + netif_stop_queue(dev); > > + netif_carrier_off(dev); > > + rtase_hw_config(dev); > > + > > + /* always link, so start to transmit & receive */ > > + rtase_hw_start(dev); > > + netif_carrier_on(dev); > > + netif_wake_queue(dev); > > I don't think you need to down/up the carrier when changing the MTU. Thank you for your suggestion, we will confirm this part again. > > > +static void rtase_sw_reset(struct net_device *dev) { > > + struct rtase_private *tp = netdev_priv(dev); > > + int ret; > > + > > + netif_stop_queue(dev); > > + netif_carrier_off(dev); > > + rtase_hw_reset(dev); > > + > > + /* let's wait a bit while any (async) irq lands on */ > > + rtase_wait_for_quiescence(dev); > > + rtase_tx_clear(tp); > > + rtase_rx_clear(tp); > > + > > + ret = rtase_init_ring(dev); > > + if (ret) > > + netdev_alert(dev, "unable to init ring\n"); > > + > > + rtase_hw_config(dev); > > + /* always link, so start to transmit & receive */ > > + rtase_hw_start(dev); > > + > > + netif_carrier_on(dev); > > + netif_wake_queue(dev); > > +} > > + > > +static void rtase_tx_timeout(struct net_device *dev, unsigned int > > +txqueue) { > > + rtase_sw_reset(dev); > > Do you actually see this happening? The timeout is set pretty high, i think 5 > seconds. If it does happen, it probably means you have a hardware/firmware > bug. So you want to be noisy here, so you get to know about these problems, > rather than silently work around them. I would like to ask if we can dump some information that will help us understand the cause of the problem before doing the reset? And should we use netdev_warn to print this information? > > > +static int rtase_setup_tc(struct net_device *dev, enum tc_setup_type type, > > + void *type_data) { > > + struct rtase_private *tp = netdev_priv(dev); > > + int ret = 0; > > + > > + switch (type) { > > + case TC_SETUP_QDISC_MQPRIO: > > + break; > > + case TC_SETUP_BLOCK: > > + break; > > This looks odd. You silently return 0, doing nothing? Thank you for your reminder, we will remove it. > > > + case TC_SETUP_QDISC_CBS: > > + ret = rtase_setup_tc_cbs(tp, type_data); > > + break; > > + default: > > + return -EOPNOTSUPP; > > + } > > + > > + return ret; > > +} > > + > > +static netdev_features_t rtase_fix_features(struct net_device *dev, > > + netdev_features_t > features) > > +{ > > + netdev_features_t features_fix = features; > > + > > + if (dev->mtu > MSS_MAX) > > + features_fix &= ~NETIF_F_ALL_TSO; > > + > > + if (dev->mtu > ETH_DATA_LEN) { > > + features_fix &= ~NETIF_F_ALL_TSO; > > + features_fix &= ~NETIF_F_CSUM_MASK; > > + } > > So the hardware does not support TSO and checksumming for jumbo frames? This hardware supports checksumming for jumbo frames, but does not support TSO. We will modify this part, thank you. > > Andrew