linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Sean Anderson <sean.anderson@seco.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Alexandru Marginean <alexandru.marginean@nxp.com>,
	linux-kernel@vger.kernel.org,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net-next v5 5/8] net: phylink: Adjust link settings based on rate adaptation
Date: Wed, 7 Sep 2022 11:10:58 +0100	[thread overview]
Message-ID: <YxhuMjZsBb7wCBFy@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220906161852.1538270-6-sean.anderson@seco.com>

On Tue, Sep 06, 2022 at 12:18:49PM -0400, Sean Anderson wrote:
> @@ -1015,19 +1086,45 @@ static void phylink_link_up(struct phylink *pl,
>  			    struct phylink_link_state link_state)
>  {
>  	struct net_device *ndev = pl->netdev;
> +	int speed, duplex;
> +	bool rx_pause;
> +
> +	speed = link_state.speed;
> +	duplex = link_state.duplex;
> +	rx_pause = !!(link_state.pause & MLO_PAUSE_RX);
> +
> +	switch (link_state.rate_adaptation) {
> +	case RATE_ADAPT_PAUSE:
> +		/* The PHY is doing rate adaption from the media rate (in
> +		 * the link_state) to the interface speed, and will send
> +		 * pause frames to the MAC to limit its transmission speed.
> +		 */
> +		speed = phylink_interface_max_speed(link_state.interface);
> +		duplex = DUPLEX_FULL;
> +		rx_pause = true;
> +		break;
> +
> +	case RATE_ADAPT_CRS:
> +		/* The PHY is doing rate adaption from the media rate (in
> +		 * the link_state) to the interface speed, and will cause
> +		 * collisions to the MAC to limit its transmission speed.
> +		 */
> +		speed = phylink_interface_max_speed(link_state.interface);
> +		duplex = DUPLEX_HALF;
> +		break;
> +	}
>  
>  	pl->cur_interface = link_state.interface;
> +	if (link_state.rate_adaptation == RATE_ADAPT_PAUSE)
> +		link_state.pause |= MLO_PAUSE_RX;

I specifically omitted this from my patch because I don't think we
should tell the user that "Link is Up - ... - flow control rx" if
we have rate adaption, but the media link is not using flow control.

The "Link is Up" message tells the user what was negotiated on the
media, not what is going on inside their network device, so the
fact we're using rate adaption which has turned on RX pause on the
MAC is neither here nor there.

>  
>  	if (pl->pcs && pl->pcs->ops->pcs_link_up)
>  		pl->pcs->ops->pcs_link_up(pl->pcs, pl->cur_link_an_mode,
> -					 pl->cur_interface,
> -					 link_state.speed, link_state.duplex);
> +					  pl->cur_interface, speed, duplex);

It seems you have one extra unnecessary space here - not sure how
that occurred as it isn't in my original patch.

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

  reply	other threads:[~2022-09-07 10:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 16:18 [PATCH net-next v5 0/8] net: phy: Add support for rate adaptation Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 1/8] net: phylink: Document MAC_(A)SYM_PAUSE Sean Anderson
2022-09-07  9:38   ` Russell King (Oracle)
2022-09-07 16:52     ` Sean Anderson
2022-09-07 18:04       ` Russell King (Oracle)
2022-09-07 20:11         ` Sean Anderson
2022-09-07 21:01           ` Russell King (Oracle)
2022-09-07 22:39             ` Sean Anderson
2022-09-08 14:21               ` Russell King (Oracle)
2022-09-08 21:03                 ` Sean Anderson
2022-09-08 21:58                   ` Russell King (Oracle)
2022-09-06 16:18 ` [PATCH net-next v5 2/8] net: phylink: Export phylink_caps_to_linkmodes Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 3/8] net: phylink: Generate caps and convert to linkmodes separately Sean Anderson
2022-09-07  9:42   ` Russell King (Oracle)
2022-09-07 16:55     ` Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 4/8] net: phy: Add support for rate adaptation Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 5/8] net: phylink: Adjust link settings based on " Sean Anderson
2022-09-07 10:10   ` Russell King (Oracle) [this message]
2022-09-07 17:01     ` Sean Anderson
2022-09-07 18:06       ` Russell King (Oracle)
2022-09-06 16:18 ` [PATCH net-next v5 6/8] net: phylink: Adjust advertisement " Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 7/8] net: phy: aquantia: Add some additional phy interfaces Sean Anderson
2022-09-06 16:18 ` [PATCH net-next v5 8/8] net: phy: aquantia: Add support for rate adaptation Sean Anderson

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=YxhuMjZsBb7wCBFy@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandru.marginean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sean.anderson@seco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).