Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp14543lqh; Mon, 6 May 2024 09:47:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgfmIJefOnQJxwPkaTlUOn4yHo5pPMKftarq94do/fameUACsjfvkrNpUiGu/twZDvjcC53pvAR1lFUOOaphnF3kZecV3BBSrcUkdsXg== X-Google-Smtp-Source: AGHT+IGAxh6tgCbQuxUBP1A5fO4jRSL9IiDkLcltAqn5d55uXzKO8GXyajsOpTxcoRvB4/m8Gail X-Received: by 2002:a50:aad5:0:b0:572:a089:75cc with SMTP id r21-20020a50aad5000000b00572a08975ccmr9853776edc.5.1715014055698; Mon, 06 May 2024 09:47:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715014055; cv=pass; d=google.com; s=arc-20160816; b=TvJZP67vvYDEfJqrgv39DWbzFeaXt/jZZ2gCi8iSpvzwWrF/d3TZwluf03q+mII9HY UBORl7C/aS0dmsmDG3kpVkQwIbKwhMH8/5ASjysIZxRRCD4Il3Hw6YInfhoEyIDGZesk cgntFQHVNhPmyw0kehNNP1VeAocb7p/oRX0+5jt43aw46eJCQC7qASjK2fk7tIpTRTZM bQhlUZHGtxcJK9rYnVGXf7vD1brSMxgWIfZKy3GfsLww1Um7meP8U5RxW+tQMLEql9fn jYsxd3HQxI8tJl80YIJiAW3XTzwoN9E/adfhJMEDp3H88fpjiF42dyLxWPJ5fk+S2Y4/ 0qBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=lBDhS1Ebaa+YuFiVFmddrCNWvRnay3hvunupCOY2htE=; fh=wYN3lHDbTtDDYDccPLk7NQITsycis13D/pCyIZiWUwo=; b=pvdrrnHxHQm7cGTPy8yDkwtrgtdRp2aG/afoV/iEue+XBw0YvHGoLUrQvosr7xwlFU WwnG2apj/XCh/CUWg3EvkKnlpvN0jleMD/kjfVRIQ+xPrJDXbFt8q+tXl/m0GqmHM/4r xvzChMhQpkkJAH1ALZGSHNdlkuM4MXiyks0i/9ea5bwJhPNTCiJ1Mfh7Le0yrmH+QSsS fv3yJi1XdaNoy7U8ymXoCvLqQNYTTsCy501tvOwsYDxh+GySCwCtR4r1AydjnjNO5fTa DHVMNP6AA1yhUpRsYOI+Uz34Wt+kgFM2nbvSFlel4x9VpsN2Ns+kTXmOc4Ed1DEEaqIF kTpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=B1kgrnh0; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-170189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sh18-20020a1709076e9200b00a59cd47bee6si1443242ejc.158.2024.05.06.09.47.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=B1kgrnh0; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-170189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B0061F22922 for ; Mon, 6 May 2024 16:47:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FA5B156C5F; Mon, 6 May 2024 16:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="B1kgrnh0" Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (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 7B5BE15688E for ; Mon, 6 May 2024 16:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014034; cv=none; b=o9ZQrufmvVjVNniMbjVE6xrpgpNsb0WgcJkubmcxLB+qeGZX3agdIdEjHkAcSdZ1R8Qct8jLzDb/EtFUXITBQo7nEqlnK3/LRIY+XLGVwUbLoF4imT6JmTtempX2lsXf7LdCCAkNoaA3grJxzLQkK7uX9u9lw56lQwlHZFKob5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014034; c=relaxed/simple; bh=ne0VrpciWO44fCdFNq8qPNWA+XkpPJ7XBbp6hOq5Wek=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PE8huWv7Vl4DtMUQk2fys2AtSDB5h36quoX678UfMVnRtmGzEyCc6z6Yx7m9Kt9l7gvk0so7dOqa/BkO7QaLoc5t0OTblNc1mS8dOSgsRyCTIoLmlK7StL326hN0rgfyfXZ+E2nSQpwZmCwS+4Tp27t8OBC7tKg+IDCjiqtTSKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b=B1kgrnh0; arc=none smtp.client-ip=185.125.188.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9E18C3F298 for ; Mon, 6 May 2024 16:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1715014028; bh=lBDhS1Ebaa+YuFiVFmddrCNWvRnay3hvunupCOY2htE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=B1kgrnh0btQfBa8NnAftPhEln0cGKwyH7xtRfUIJhKu9aLkEMZWPfqoGwmfqptbcc xxX/JZSvndj0Sb7xztbjmm6bXx4tdK2XnKIKPoePQzP8s8Epc4mt01g8qZZaD8sb3K HLtZNIrGJ7axOEhQVOvatxGmwaZ89aqsZ3OR/yu18kE5aZnD48Mje6JN98d+IFHdiv jQ9WVhjxVvh3UkzwBdSwaarbp+6elxW/5/Kg/asOAMDyOnI6fUy7Pyn7LNdKXcE1Wr HN3fxmf5XD+5J12GBUDzE+9k1UztPb9LER5C5CPVIgaywMZe9yZ2e/sR37gXMZCKsV jr8eyL6IRplYg== Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-34da8f1bf7cso1777790f8f.2 for ; Mon, 06 May 2024 09:47:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715014028; x=1715618828; h=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=lBDhS1Ebaa+YuFiVFmddrCNWvRnay3hvunupCOY2htE=; b=M1OEJ7gH+AmcvjKqM/u7rls2fyZI7+ghrQuZfJqAASyYjQbylLqSnHFw9TfELyCBlD sOj1Y/hGqv959XYbDJPt8r31OmN5kOj1g0KTjZTutjDdCCItZwoD3b2cZqDJjMWvDsPf rFByjhiF0kXO3NT/o+WPCIINH/qqCCoiXGYx4zs1OR7N2lDay6GanPpnaDhnHN3AbUpI ac+4t1mEUGexhaN5YTNdyJrXTfftacoawEO63LAPIZQhbMpYCZYmT8x7PexIsmPLy7uG Zn3OVQlyOck8I2E3D6uIBxh4wjCIQu/55bSxQWgghcXOCkINvJdBt/XI11aFxhX9QnsC GQpQ== X-Forwarded-Encrypted: i=1; AJvYcCX55dJN9qMJVQ4JLNYet5wO5BvC1gdmAQgqSC3WKcqIeYjCVPOQZERLdcDfKYbTUeyfoXP59phgJdlxVUxqu7sJ1KSeNqKo8f2I0WnH X-Gm-Message-State: AOJu0Yz5hcnZdR/yw9S/dFQbcAPDtOlHOzmFR8yGOR8m+8Z55/zcgBB4 OkAUtKA4KZCxuMpffpTOldfa9EKNNRRQgd7eMaZ/AYTuUlT7MKMyiS255YPyiLoa9LErYcSY76x Kjh8C/SPlWP5LIvw3xiMrOjmL/6SksD3ch4LWDW7aYQSMWPAVBHUv5jD3PZN2LRVs6fKo9V9cQY 7T2SnGF97xDRGAaFi3HuHKATJqGVkkMjLis2I6J0b/xl8ZjIYptzNq X-Received: by 2002:a5d:5445:0:b0:343:6b09:653c with SMTP id w5-20020a5d5445000000b003436b09653cmr9213441wrv.43.1715014028040; Mon, 06 May 2024 09:47:08 -0700 (PDT) X-Received: by 2002:a5d:5445:0:b0:343:6b09:653c with SMTP id w5-20020a5d5445000000b003436b09653cmr9213423wrv.43.1715014027737; Mon, 06 May 2024 09:47:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240503101824.32717-1-en-wei.wu@canonical.com> <7f533913-fba9-4a29-86a5-d3b32ac44632@intel.com> In-Reply-To: <7f533913-fba9-4a29-86a5-d3b32ac44632@intel.com> From: En-Wei WU Date: Tue, 7 May 2024 00:46:56 +0800 Message-ID: Subject: Re: [Intel-wired-lan] [PATCH v2 1/2] e1000e: let the sleep codes run every time To: Sasha Neftin Cc: netdev@vger.kernel.org, rickywu0421@gmail.com, linux-kernel@vger.kernel.org, edumazet@google.com, intel-wired-lan@lists.osuosl.org, kuba@kernel.org, anthony.l.nguyen@intel.com, pabeni@redhat.com, davem@davemloft.net, "Brandeburg, Jesse" , "Ruinskiy, Dima" , "Lifshits, Vitaly" Content-Type: text/plain; charset="UTF-8" Thank you for your time. Originally, sleep codes would only be executed if the first read fails or the link status that is read is down. Some circumstances like the [v2,2/2] "e1000e: fix link fluctuations problem" would need a delay before first reading/accessing the PHY IEEE register, so that it won't read the instability of the link status bit in the PHY status register. I've realized that this approach isn't good enough since the purpose is only to fix the problem in another patch and it also changes the behavior. Here is the modification of the patch [v2,2/2] "e1000e: fix link fluctuations problem": --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1428,7 +1428,17 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) - ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); /* comments */ + ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 100000, &link); Do you think we can just add a msleep/usleep_range in front of the e1000e_phy_has_link_generic() instead of modifying the sleep codes in e1000e_phy_has_link_generic()? Thanks. On Mon, 6 May 2024 at 23:53, Sasha Neftin wrote: > > On 03/05/2024 13:18, Ricky Wu wrote: > > Originally, the sleep codes being moved forward only > > ran if we met some conditions (e.g. BMSR_LSTATUS bit > > not set in phy_status). Moving these sleep codes forward > > makes the usec_interval take effect every time. > > > > Signed-off-by: Ricky Wu > > --- > > > > In v2: > > * Split the sleep codes into this patch > > > > drivers/net/ethernet/intel/e1000e/phy.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c > > index 93544f1cc2a5..4a58d56679c9 100644 > > --- a/drivers/net/ethernet/intel/e1000e/phy.c > > +++ b/drivers/net/ethernet/intel/e1000e/phy.c > > @@ -1777,6 +1777,11 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, > > > > *success = false; > > for (i = 0; i < iterations; i++) { > > + if (usec_interval >= 1000) > > + msleep(usec_interval / 1000); > > + else > > + udelay(usec_interval); > > + > > I do not understand this approach. Why wait before first > reading/accessing the PHY IEEE register? > > For further discussion, I would like to introduce Dima Ruinskiy (architect) > > > /* Some PHYs require the MII_BMSR register to be read > > * twice due to the link bit being sticky. No harm doing > > * it across the board. > > @@ -1799,10 +1804,6 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, > > *success = true; > > break; > > } > > - if (usec_interval >= 1000) > > - msleep(usec_interval / 1000); > > - else > > - udelay(usec_interval); > > } > > > > return ret_val; >