Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3166954ybb; Mon, 13 Apr 2020 02:06:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJr5q0EMbfBIfCU2FR8oNDBaDRkXJn1YAktzzs17dXFKH9X/YFOVWsMmFtsxIDkziB4esf8 X-Received: by 2002:a50:af85:: with SMTP id h5mr15511907edd.300.1586768775080; Mon, 13 Apr 2020 02:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586768775; cv=none; d=google.com; s=arc-20160816; b=VngQw5zL57UjEjfzYmdC7/NervhFXmildigedznAKKZc/ThRJEVfeM6InMGFuLMUX8 +Rba2sKZ8g0Wkp1WMCQBI/PHsy6fUzQRY0uYtQwzSQBodq+JdUBQWT/ShlxrEVZZhoLE FpJarf/FbxtSF7M30PKLpVTbgxDlxCEe0RoYi2xXE24mMutWAd6ZC5F6g6grl1zzBB54 jTBUSE00srCGIj2m207w0ITqEFWy8fQUVcLd2NIui4RFu9TGCbdS40Qr+8RVs+is1jAm exYTrsejNsmB+LCPaI0XtX7xtDoRFSDOLL3IcxMppkoTvEIuu1HUQdze3qCAJFyXMTBN ECtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=itKlPWSDIUfhI/V0PdIrWdvWF2mjKklAzi7kXAkEZiI=; b=ZCXxSNkind6ZKuVXRoAe8XRYpQj84MJt593vErPPxfjwZ51ueMs5EkDAu3MX5u8cdD PE0stHt5PIRtrS1roFMCPx8/gIRk3mJnsi6Y0G/oUlzIt2bqHl0feXpgRn/yIXEPW1Y/ 7E8on2jRcW34cSGziqjG1KVxRtrXDt7IDmEamQKj5VVO8PkrkNArH/2NsUSKK49EslFp FU1YHD5owv4I9NVYtqpLCM/PK69FijNLxkVDp1ZQxUTc/OuxL2uqkxBRsUxC3DeRNLfH IzWh+2CAipCJG4NCc56AFJDSkjcz3eau9vIl+gC8Kji58+NGBAlLzbf6DN7yfuHkySNo LB4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lW3fo4YI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si1708111edt.64.2020.04.13.02.05.51; Mon, 13 Apr 2020 02:06:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lW3fo4YI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728816AbgDMGvA (ORCPT + 99 others); Mon, 13 Apr 2020 02:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:54382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727546AbgDMGvA (ORCPT ); Mon, 13 Apr 2020 02:51:00 -0400 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07086C008651; Sun, 12 Apr 2020 23:51:00 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71F3120774; Mon, 13 Apr 2020 06:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586760659; bh=itKlPWSDIUfhI/V0PdIrWdvWF2mjKklAzi7kXAkEZiI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lW3fo4YIURoALAvNoGs50jvKKZweTovFobX14fD0uBwlVuO4RyTv0pyyCDG7MpSE5 dnwQO0jwz1kaTBAwdAL3oEbM/3LoOGVflmF3Otd1Du4AeCZasNdsRzrTFIsifP197H FXYfFraBDh2np0cyUdjy2ZyLMzx3XOI1ZexOvtYk= Received: by mail-wm1-f48.google.com with SMTP id y24so8995533wma.4; Sun, 12 Apr 2020 23:50:59 -0700 (PDT) X-Gm-Message-State: AGi0Puatkcsnh6f8zXG8czwHmN17w2u+HBB18tIfEbEotj92iww2p/Mf YmDQqiwtJn6VEyn+qLMrtkepIuqC1PYAFJnTwrI= X-Received: by 2002:a05:600c:2214:: with SMTP id z20mr18682592wml.189.1586760657834; Sun, 12 Apr 2020 23:50:57 -0700 (PDT) MIME-Version: 1.0 References: <20200412034931.9558-1-f.fainelli@gmail.com> <20200412112756.687ff227@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: From: Chen-Yu Tsai Date: Mon, 13 Apr 2020 14:50:47 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net] net: stmmac: Guard against txfifosz=0 To: Jose Abreu , Florian Fainelli Cc: Jakub Kicinski , Alexandre Torgue , "netdev@vger.kernel.org" , open list , "mripard@kernel.org" , "moderated list:ARM/STM32 ARCHITECTURE" , Maxime Coquelin , Giuseppe Cavallaro , "olteanv@gmail.com" , "David S. Miller" , "moderated list:ARM/STM32 ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 2:42 PM Jose Abreu wrote: > > From: Florian Fainelli > Date: Apr/12/2020, 19:31:55 (UTC+00:00) > > > > > > > On 4/12/2020 11:27 AM, Jakub Kicinski wrote: > > > On Sat, 11 Apr 2020 20:49:31 -0700 Florian Fainelli wrote: > > >> After commit bfcb813203e619a8960a819bf533ad2a108d8105 ("net: dsa: > > >> configure the MTU for switch ports") my Lamobo R1 platform which uses > > >> an allwinner,sun7i-a20-gmac compatible Ethernet MAC started to fail > > >> by rejecting a MTU of 1536. The reason for that is that the DMA > > >> capabilities are not readable on this version of the IP, and there is > > >> also no 'tx-fifo-depth' property being provided in Device Tree. The > > >> property is documented as optional, and is not provided. > > >> > > >> The minimum MTU that the network device accepts is ETH_ZLEN - ETH_HLEN, > > >> so rejecting the new MTU based on the txfifosz value unchecked seems a > > >> bit too heavy handed here. > > > > > > OTOH is it safe to assume MTUs up to 16k are valid if device tree lacks > > > the optional property? Is this change purely to preserve backward > > > (bug-ward?) compatibility, even if it's not entirely correct to allow > > > high MTU values? (I think that'd be worth stating in the commit message > > > more explicitly.) Is there no "reasonable default" we could select for > > > txfifosz if property is missing? > > > > Those are good questions, and I do not know how to answer them as I am > > not familiar with the stmmac HW design, but I am hoping Jose can respond > > on this patch. It does sound like providing a default TX FIFO size would > > solve that MTU problem, too, but without a 'tx-fifo-depth' property > > specified in Device Tree, and with the "dma_cap" being empty for this > > chip, I have no idea what to set it to. > > Unfortunately, allwinner uses GMAC which does not have any mean to detect > TX FIFO Size. Default value in HW is 2k but this can not be the case in > these platforms if HW team decided to change it. I looked at all the publicly available datasheets and Allwinner uses 4K TX FIFO and 16K RX FIFO in all SoCs. Not sure if this would help. ChenYu > Anyway, your patch looks sane to me. But if you start seeing TX Queue > Timeout for higher MTU values then you'll need to add tx-fifo-depth > property. > > --- > Thanks, > Jose Miguel Abreu > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel