Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3423781pxb; Mon, 18 Oct 2021 15:08:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx10BOUw4tPwfZ9OlgEyQyDqV3prli+HCVeFwotHS5zu1R41aJpWHxo5bWWHJ+0EjdeZd3y X-Received: by 2002:a05:6402:849:: with SMTP id b9mr48802694edz.215.1634594920593; Mon, 18 Oct 2021 15:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634594920; cv=none; d=google.com; s=arc-20160816; b=JW/6aRQbO+UjtRWOMOSl2RK1Wbf7EJdzOX3M5jTUsiWOPgq612N1QXGiioyzbtUuXJ wNJlXNbS3Bfp4aGtpW189qh9NibpArJp4BFKmR0rZYLVdESZ/6NGxJtd6a3uz/aannqI HyPg8q5hguyTpBfchbjm3jnCPpGKMgkW+JGBK01Jw1CphhQpoAFoefLxHtrk2H7XWFc7 sht1C+qbn988LC5xaf3s18ry2TLTlvPR79gufYC5wqO787H9racrW8W+k9MJPxrYUN4E G7UcRRjGDjNz038utVe+ARJ73xx4a0313ob4J9ESHl+PUgyKD4/Ntxawsc/MPzt0zfSl TfPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0jATFIJZGaGNJtI9nrB9A/vH/sBn6bZ/u4kev59KQDU=; b=HQ8waxEEne2F7CjcKI/CVQPnafN4kwnC0qORybhaXhaQs/HdtOEWjIyzgKPbtGAike ODoJCps7WBPRsGujTuMQiyL4MZAbWL1lTShf4uXfLYDv2YeI12iQ/QlAAPcmqyoEloab LItcDL0SgCcMfJLVLT1vbVenokSOBliXpRC4+5DRm2SKIQJFsdymMQ17c2YO96tYtYS/ c2moAEkyEl6zWIkEueEDgRENqrPK5waBZa0jB+GFBuB5FNEYmd3LFuGZYP/TVDNtzf1M ws/mzExeaeBXjhz0SeHFaPyWzukn9d3my/pfYXnKpHv2VaFqx4Zzy2nRF/vdBeteYOgC Usig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=TlE0Cpnf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si32686253ejo.688.2021.10.18.15.07.54; Mon, 18 Oct 2021 15:08:40 -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=@lunn.ch header.s=20171124 header.b=TlE0Cpnf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233775AbhJRWGZ (ORCPT + 99 others); Mon, 18 Oct 2021 18:06:25 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45396 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233633AbhJRWGW (ORCPT ); Mon, 18 Oct 2021 18:06:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=0jATFIJZGaGNJtI9nrB9A/vH/sBn6bZ/u4kev59KQDU=; b=TlE0CpnflLLrtpn7Q37GMlaV49 0/yZ9p1p5gDe31wEsAI/I9pIXpIccKfhPZld5y2zAF2Kr/uM7WnT/jXnhkSx3RQ5AXH0+O2GMlpfO Y06hNiqZ9BIzV+oQV2x33bR5AZAHTZ6vBIbxJCfTr9tk0Zd4h/q9atKp4PvaFpDek3tg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1mcajm-00B0y8-8D; Tue, 19 Oct 2021 00:04:06 +0200 Date: Tue, 19 Oct 2021 00:04:06 +0200 From: Andrew Lunn To: 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 Subject: Re: [PATCH v3 12/13] net: phy: adjust qca8081 master/slave seed value if link down Message-ID: References: <20211018033333.17677-1-luoj@codeaurora.org> <20211018033333.17677-13-luoj@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211018033333.17677-13-luoj@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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