From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16B79C433EF for ; Wed, 20 Oct 2021 13:27:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDF2E6128E for ; Wed, 20 Oct 2021 13:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbhJTNaD (ORCPT ); Wed, 20 Oct 2021 09:30:03 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:50344 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhJTNaC (ORCPT ); Wed, 20 Oct 2021 09:30:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634736468; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=c5i1CMhYy4g8vaYaKlzxS5Vj9oYBF5BrdPZbK42iW3Y=; b=iLEN6J1VCnQh9vHBzfYVOvr4HR2GwupEKLjKcp5W6xjIMPaIONjUZ2tu/pf0cEQ5pcCyMT5R VAmcV46wKbyT2dH56+zaazI217SPDAL1fcFZxVhRRE1OLWFuT7DLEJdH9W3cVQIeBiVMvtIb TLlCN7+HBqMpI0vabgygW9qD9T4= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 617019535ca800b6c18e95d5 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 20 Oct 2021 13:27:47 GMT Sender: quic_luoj=quicinc.com@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 39526C43617; Wed, 20 Oct 2021 13:27:47 +0000 (UTC) Received: from [10.92.1.38] (unknown [180.166.53.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luoj) by smtp.codeaurora.org (Postfix) with ESMTPSA id 41A57C4338F; Wed, 20 Oct 2021 13:27:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 41A57C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=quicinc.com Subject: Re: [PATCH v3 12/13] net: phy: adjust qca8081 master/slave seed value if link down To: Andrew Lunn , Luo Jie Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sricharan@codeaurora.org References: <20211018033333.17677-1-luoj@codeaurora.org> <20211018033333.17677-13-luoj@codeaurora.org> From: Jie Luo Message-ID: <087c328d-2909-6750-8711-71abb8d5e301@quicinc.com> Date: Wed, 20 Oct 2021 21:27:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/19/2021 6:04 AM, Andrew Lunn wrote: > On Mon, Oct 18, 2021 at 11:33:32AM +0800, Luo Jie wrote: >> 1. The master/slave seed needs to be updated when the link can't >> be created. >> >> 2. The case where two qca8081 PHYs are connected each other and >> master/slave seed is generated as the same value also needs >> to be considered, so adding this code change into read_status >> instead of link_change_notify. >> >> Signed-off-by: Luo Jie >> --- >> drivers/net/phy/at803x.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c >> index 5d007f89e9d3..77aaf9e72781 100644 >> --- a/drivers/net/phy/at803x.c >> +++ b/drivers/net/phy/at803x.c >> @@ -1556,6 +1556,22 @@ static int qca808x_read_status(struct phy_device *phydev) >> else >> phydev->interface = PHY_INTERFACE_MODE_SMII; >> >> + /* generate seed as a lower random value to make PHY linked as SLAVE easily, >> + * except for master/slave configuration fault detected. >> + * the reason for not putting this code into the function link_change_notify is >> + * the corner case where the link partner is also the qca8081 PHY and the seed >> + * value is configured as the same value, the link can't be up and no link change >> + * occurs. >> + */ >> + if (!phydev->link) { >> + if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { >> + qca808x_phy_ms_seed_enable(phydev, false); >> + } else { >> + qca808x_phy_ms_random_seed_set(phydev); >> + qca808x_phy_ms_seed_enable(phydev, true); >> + } >> + } > Are you assuming here that the status is polled once a second, and > each poll you choose a new seed and see if it succeeds? What happens > when interrupts are used, not polling? > > Andrew Hi Andrew, yes, this code assumes that the PHY POLL is used, and choose a new random seed value on each poll if no link is created. when the interrupts is used, this corner case seems can't be covered since there is no related interrupt occurs when the seed is configured as same value.