Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4940325rdh; Wed, 29 Nov 2023 15:42:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdlzgM0rXq7jVkQ3mmCVmPZfFJWqOiHqbiI72TymozV5zTaQTGpsfilvw4WnLDUQ3qr8U5 X-Received: by 2002:a05:6870:75c9:b0:1f9:602e:7b0b with SMTP id de9-20020a05687075c900b001f9602e7b0bmr28294002oab.2.1701301323541; Wed, 29 Nov 2023 15:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701301323; cv=none; d=google.com; s=arc-20160816; b=G/9VjqSnUGVfUyEZZ6YyA4AnPRXQ9aB9kTMBUlpiwtbf/etxK+oOUjFnCVT7W4yh46 CcqiHlOF4eaeoiO9Ww2NDVit+tvLHdAwkmoWl0thlp9STxdoPpx8DvSnMUKQFNSLbKd2 zgPNm4jOAKlRwTX5FeO1wrL4WhHofKVl6nt3NRRJtpntD7luwEAzxQ1JshpUYNz+X7Kh bBpPLlimGGqB83gZz6xJeip6W/mPS3DrD5u12ypQLr3Y7+UhiRxP/iOyl+Fm1qNik7w3 OftTkMtpcIPY8vp75ebGFMB2ZYpaNJlTsXFYjVLQk3fsFEMM1rxsX+q9whZRsROfYHaZ uZQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vAafIotfNLeEwiBYbu95S1M0tQmMdEiW9EUaH/ugkoU=; fh=nLByOYfAsdFNb3lJ9vAbpasFvCFLTivdhZYpD5rHlqI=; b=Uwo5fMIXf5c5Jtba4bc9T7L/JN3PUJcPiACd1pPP2VmXKS5HfFuQK9XVt3VerUnsIG YqmO4aC3IV7nBN5ZUYPg7i8nTLfBdcy9I6qM6lMHiLqeRY9qDzOV6ZHhRbAlnRXn/01x vbX4UpalOGedUVSW4yLDKmX5hKzdsOjrfBr/OOMK9Q26NtMHpYSgJTS+SVEwnVkqWkg9 /oVewu00tiD3Dv1YWyvrQ/DrzGYvnKazfZLPz2BMpYELaAUkmoRRF2NlIPas5BOQeylZ 8kMdgPkOGwdn4OgSVQ0DtxkQ5SbC6+I19Mg80fiwh8a0R1/XKBpFEelJvBonRkaRn6gj p8/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="U/zRtwo+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id e37-20020a630f25000000b005b8ebca5313si14811273pgl.426.2023.11.29.15.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 15:42:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="U/zRtwo+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2321880A9AB5; Wed, 29 Nov 2023 15:41:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbjK2XlE (ORCPT + 99 others); Wed, 29 Nov 2023 18:41:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbjK2XlC (ORCPT ); Wed, 29 Nov 2023 18:41:02 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC61410C2 for ; Wed, 29 Nov 2023 15:41:07 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cc79f73e58so31645ad.1 for ; Wed, 29 Nov 2023 15:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701301267; x=1701906067; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vAafIotfNLeEwiBYbu95S1M0tQmMdEiW9EUaH/ugkoU=; b=U/zRtwo+aQZrG+nwhUiUjVwBkM8E6E7anILz6pLZnjg3APyoMCqXtnjs3EjorKRqEG mq+DG/zr2BC83zA+M1FiFfb7nDYv4Y+ae1HlVdYrDp6B+eadXhrrqreb5twL3l4w402f ez4U71mypQC0n4seK/fW9eNEicCBJPlz+iOJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701301267; x=1701906067; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vAafIotfNLeEwiBYbu95S1M0tQmMdEiW9EUaH/ugkoU=; b=ZtElmAqc/3AvS1gsPQ0VUh/U19n+gpb6v6WBLMaobTFncznx9AgBx+/fhZEBVxFPpk HRthcrRtDs94oYHZPtAo5XoUBOwE6+Ct/tTycp1wzFV6HWbFvCYSuzaIE/Zr5+CKUGzI LH66ytTUSoiuW9R92H2q4FoivvclmbLnD/CftfPyS2nD1UBivUD7mEk58JXCZp8lL/e+ Gw+SbBExhYRWcxx0Xrb4wg9e2HDe6eM2B8tZyvQ/yz4R4nOl3DdfCJ5T+DIUlOu2vmbR 4dPXH7nxOJktEP1j8CzTqdh87r+PJ3x4BbHljWlQhSFQ5965HqGZE9ZbTtIP+9eveDFe emyA== X-Gm-Message-State: AOJu0YzDKun0BX2preqmbw/9inGGOhMI+BHb+Mmb5Y03J7RFzlvkgYmN 3pgmCWNByN36HWRhwoXAy7aYO5/7tzTm1QOBEL/tj0uw/OHowiJ9DnfzpA== X-Received: by 2002:a17:903:5c5:b0:1cf:c366:9921 with SMTP id kf5-20020a17090305c500b001cfc3669921mr32999plb.9.1701301266715; Wed, 29 Nov 2023 15:41:06 -0800 (PST) MIME-Version: 1.0 References: <20231129155350.5843-1-hau@realtek.com> <4aeebf95-cf12-4462-80c7-dd1dafddb611@intel.com> In-Reply-To: <4aeebf95-cf12-4462-80c7-dd1dafddb611@intel.com> From: Grant Grundler Date: Wed, 29 Nov 2023 15:40:50 -0800 Message-ID: Subject: Re: [PATCH net v2] r8169: fix rtl8125b PAUSE frames blasting when suspended To: Jacob Keller Cc: ChunHao Lin , hkallweit1@gmail.com, nic_swsd@realtek.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, grundler@chromium.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 15:41:37 -0800 (PST) On Wed, Nov 29, 2023 at 3:05=E2=80=AFPM Jacob Keller wrote: > On 11/29/2023 7:53 AM, ChunHao Lin wrote: > > When FIFO reaches near full state, device will issue pause frame. > > If pause slot is enabled(set to 1), in this time, device will issue > > pause frame only once. But if pause slot is disabled(set to 0), device > > will keep sending pause frames until FIFO reaches near empty state. > > > > When pause slot is disabled, if there is no one to handle receive > > packets, device FIFO will reach near full state and keep sending > > pause frames. That will impact entire local area network. > > > > This issue can be reproduced in Chromebox (not Chromebook) in > > developer mode running a test image (and v5.10 kernel): > > 1) ping -f $CHROMEBOX (from workstation on same local network) > > 2) run "powerd_dbus_suspend" from command line on the $CHROMEBOX > > 3) ping $ROUTER (wait until ping fails from workstation) > > > > Takes about ~20-30 seconds after step 2 for the local network to > > stop working. > > > > Fix this issue by enabling pause slot to only send pause frame once > > when FIFO reaches near full state. > > > > Makes sense. Avoiding the spam is good. The naming is a bit confusing > but I guess that comes from realtek datasheet? I don't know. It doesn't matter to me what it's called since I don't have access to the data sheet anyway. :/ > > Fixes: f1bce4ad2f1c ("r8169: add support for RTL8125") > > Reported-by: Grant Grundler > > Tested-by: Grant Grundler > > Cc: stable@vger.kernel.org > > Signed-off-by: ChunHao Lin > > --- > > v2: > > - update comment and title. > > --- > > drivers/net/ethernet/realtek/r8169_main.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/et= hernet/realtek/r8169_main.c > > index 62cabeeb842a..bb787a52bc75 100644 > > --- a/drivers/net/ethernet/realtek/r8169_main.c > > +++ b/drivers/net/ethernet/realtek/r8169_main.c > > @@ -196,6 +196,7 @@ enum rtl_registers { > > /* No threshold before first PCI = xfer */ > > #define RX_FIFO_THRESH (7 << RXCFG_FIFO_SHIFT) > > #define RX_EARLY_OFF (1 << 11) > > +#define RX_PAUSE_SLOT_ON (1 << 11) /* 8125b = and later */ > > This confuses me though: RX_EARLY_OFF is (1 << 11) as well.. Is that > from a different set of devices? Yes, for a different HW version of the device. > We're writing to the same register > RxConfig here I think in both cases? Yes. But to different versions of the HW which use this bit differently. Ergo the comment about "8125b and later". > Can you clarify if these are supposed to be the same bit? Yes, they are the same bit - but different versions of HW use BIT(11) differently. > > > #define RXCFG_DMA_SHIFT 8 > > /* Unlimited maximum PCI burst. *= / > > #define RX_DMA_BURST (7 << RXCFG_DMA_SHIFT) > > @@ -2306,9 +2307,13 @@ static void rtl_init_rxcfg(struct rtl8169_privat= e *tp) > > case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: > > RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA= _BURST | RX_EARLY_OFF); > > break; > > - case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_63: > > + case RTL_GIGA_MAC_VER_61: > > RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); > > break; > > I assume there isn't a VER_62 between these? Correct. My clue is this code near the top of this file: 149 [RTL_GIGA_MAC_VER_61] =3D {"RTL8125A", FIRMWARE_812= 5A_3}, 150 /* reserve 62 for CFG_METHOD_4 in the vendor driver */ 151 [RTL_GIGA_MAC_VER_63] =3D {"RTL8125B", FIRMWARE_812= 5B_2}, > > > + case RTL_GIGA_MAC_VER_63: > > + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | > > + RX_PAUSE_SLOT_ON); > > We add RX_PAUSE_SLOT_ON now for RTL_GIGA_MAC_VER_63 in addition. Makes > sense. Exactly. thanks for reviewing! cheers, grant > > + break; > > default: > > RTL_W32(tp, RxConfig, RX128_INT_EN | RX_DMA_BURST); > > break;