All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: Frank Wunderlich <linux@fw-web.de>,
	linux-mediatek@lists.infradead.org,
	Alexander Couzens <lynxis@fe80.eu>, Felix Fietkau <nbd@nbd.name>,
	John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mtk_sgmii: implement mtk_pcs_ops
Date: Thu, 20 Oct 2022 09:33:15 +0100	[thread overview]
Message-ID: <Y1EHy0t5nXOF/3Mw@shell.armlinux.org.uk> (raw)
In-Reply-To: <949F5EE5-B22D-40E2-9783-0F75ACFE2C1F@public-files.de>

On Thu, Oct 20, 2022 at 07:54:49AM +0200, Frank Wunderlich wrote:
> Am 18. Oktober 2022 18:39:01 MESZ schrieb "Russell King (Oracle)" <linux@armlinux.org.uk>:
> >Hi,
> >
> >A couple of points:
> >
> >On Tue, Oct 18, 2022 at 05:35:06PM +0200, Frank Wunderlich wrote:
> 
> >> +	regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val);
> >> +	state->an_complete = !!(val & SGMII_AN_COMPLETE);
> >> +	state->link = !!(val & SGMII_LINK_STATYS);
> >> +	state->pause = 0;
> >
> >Finally, something approaching a reasonable implementation for this!
> >Two points however:
> >1) There's no need to set state->pause if there is no way to get that
> >   state.
> >2) There should also be a setting for state->pause.
> 
> Currently it looks like pause cannot be controlled in sgmii-mode so we disabled it here to not leave it undefined. Should i drop assignment here?

Why do you think it would be undefined?

static void phylink_mac_pcs_get_state(struct phylink *pl,
                                      struct phylink_link_state *state)
{
...
        if  (state->an_enabled) {
...
                state->pause = MLO_PAUSE_NONE;
        } else {
,,,
                state->pause = pl->link_config.pause;
	}
...
        if (pl->pcs)
                pl->pcs->ops->pcs_get_state(pl->pcs, state);

So, phylink will call your pcs_get_state() function having initialised
it to something sensible.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!


WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: Frank Wunderlich <linux@fw-web.de>,
	linux-mediatek@lists.infradead.org,
	Alexander Couzens <lynxis@fe80.eu>, Felix Fietkau <nbd@nbd.name>,
	John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mtk_sgmii: implement mtk_pcs_ops
Date: Thu, 20 Oct 2022 09:33:15 +0100	[thread overview]
Message-ID: <Y1EHy0t5nXOF/3Mw@shell.armlinux.org.uk> (raw)
In-Reply-To: <949F5EE5-B22D-40E2-9783-0F75ACFE2C1F@public-files.de>

On Thu, Oct 20, 2022 at 07:54:49AM +0200, Frank Wunderlich wrote:
> Am 18. Oktober 2022 18:39:01 MESZ schrieb "Russell King (Oracle)" <linux@armlinux.org.uk>:
> >Hi,
> >
> >A couple of points:
> >
> >On Tue, Oct 18, 2022 at 05:35:06PM +0200, Frank Wunderlich wrote:
> 
> >> +	regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val);
> >> +	state->an_complete = !!(val & SGMII_AN_COMPLETE);
> >> +	state->link = !!(val & SGMII_LINK_STATYS);
> >> +	state->pause = 0;
> >
> >Finally, something approaching a reasonable implementation for this!
> >Two points however:
> >1) There's no need to set state->pause if there is no way to get that
> >   state.
> >2) There should also be a setting for state->pause.
> 
> Currently it looks like pause cannot be controlled in sgmii-mode so we disabled it here to not leave it undefined. Should i drop assignment here?

Why do you think it would be undefined?

static void phylink_mac_pcs_get_state(struct phylink *pl,
                                      struct phylink_link_state *state)
{
...
        if  (state->an_enabled) {
...
                state->pause = MLO_PAUSE_NONE;
        } else {
,,,
                state->pause = pl->link_config.pause;
	}
...
        if (pl->pcs)
                pl->pcs->ops->pcs_get_state(pl->pcs, state);

So, phylink will call your pcs_get_state() function having initialised
it to something sensible.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-10-20  8:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 15:35 [PATCH] net: mtk_sgmii: implement mtk_pcs_ops Frank Wunderlich
2022-10-18 15:35 ` Frank Wunderlich
2022-10-18 15:35 ` Frank Wunderlich
2022-10-18 16:39 ` Russell King (Oracle)
2022-10-18 16:39   ` Russell King (Oracle)
2022-10-18 16:39   ` Russell King (Oracle)
2022-10-20  5:54   ` Frank Wunderlich
2022-10-20  5:54     ` Frank Wunderlich
2022-10-20  8:33     ` Russell King (Oracle) [this message]
2022-10-20  8:33       ` Russell King (Oracle)
2022-10-20 12:02       ` Aw: " Frank Wunderlich
2022-10-20 12:02         ` Frank Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1EHy0t5nXOF/3Mw@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=frank-w@public-files.de \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@fw-web.de \
    --cc=lynxis@fe80.eu \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.