Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1503758pxb; Wed, 20 Oct 2021 06:29:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ3sqrUf6xIQN6C2nmJNelYT9/rklVA103fF2DaXXHI8ileUDRarHTgHdW6Vnw5ibLiQNi X-Received: by 2002:a17:90b:1049:: with SMTP id gq9mr7372441pjb.180.1634736548349; Wed, 20 Oct 2021 06:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634736548; cv=none; d=google.com; s=arc-20160816; b=1JqLQnqAejPStxXF1jNKLrPbheDkzJcXFm3EOZvCAW2VI1OCG6e7DeNadDwmCuIwk5 MuZNfCjNhITYjeqKzuaNz77jEqHuZsmRvLYaBsymtDf9LvZY1ZtP678BWbwpUbCQjsn4 I0plAvkS+qsoLGCVj3P9e8N53Z5m9AAcpaKiYbeWFW99TFIoKSdLtuqgTclcAwnfwfIN ZnIQzGrxQ1niQ9kYv34VhnxN1gHIEhBBDnKh6ax36wVGZkyzQidIjr8EwGQlQp9IVL3U Ql6B3gN5+XG5WMPyuC6RRcKxzkiCkEwdLiaQXyOj8LjTP4xNHbX7NTihkxvXc8fxe3vr fDfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=c5i1CMhYy4g8vaYaKlzxS5Vj9oYBF5BrdPZbK42iW3Y=; b=jqZqaT5TB7iISSJOmHYlvQf6XdLAw7F+Uv/oXmN//YsM1O140BDVlPeUc165k6OACt BYvxtowrwt74JR+3tON4VbBtWmQ4SxEj/xfXGBZzdQRKjU9q/u31s+zY66b/SIs7vfCp T19RuNkFzoyFRlIPGZAGgg9Srsy/kzg0CszvppuI3BoRZ87v/7+D3cCMESA7ThWxqa42 G/d9XHgu9OCOQG6Zt/fBmls4SnT6C0bpFtdWdWGtHuOWeQGxRinfSQmaFIMWxmJ6XyEX ruJzNaR3YxRVSOXEm+6TzWzwDkjjC3eUK3IAM3JmosOn/scLsyfq3O1IzWlYLTvkYgbQ +o7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=iLEN6J1V; spf=pass (google.com: 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mw8si3457488pjb.161.2021.10.20.06.28.52; Wed, 20 Oct 2021 06:29:08 -0700 (PDT) Received-SPF: pass (google.com: 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=@mg.codeaurora.org header.s=smtp header.b=iLEN6J1V; spf=pass (google.com: 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbhJTNaC (ORCPT + 99 others); Wed, 20 Oct 2021 09:30:02 -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) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 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.