netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Parshuram Thombare <pthombar@cadence.com>
Cc: nicolas.ferre@microchip.com, davem@davemloft.net,
	netdev@vger.kernel.org, f.fainelli@gmail.com,
	hkallweit1@gmail.com, linux-kernel@vger.kernel.org,
	rafalc@cadence.com, piotrs@cadence.com, jank@cadence.com
Subject: Re: [PATCH 1/3] net: ethernet: add support for PCS and 2.5G speed
Date: Fri, 22 Feb 2019 22:39:53 +0100	[thread overview]
Message-ID: <20190222213953.GN5894@lunn.ch> (raw)
In-Reply-To: <20190222201225.GA15633@lvlogina.cadence.com>

>  	/* mask with MAC supported features */
> -	if (macb_is_gem(bp) && bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)
> -		phy_set_max_speed(phydev, SPEED_1000);
> -	else
> -		phy_set_max_speed(phydev, SPEED_100);
> +	if (macb_is_gem(bp)) {
> +		linkmode_copy(phydev->supported, PHY_GBIT_FEATURES);
> +		if (bp->caps & MACB_CAPS_TWO_PT_FIVE_GIG_SPEED)
> +			linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> +					 phydev->supported);
> +	} else {
> +		linkmode_copy(phydev->supported, PHY_BASIC_FEATURES);
> +	}
> +
> +	linkmode_copy(phydev->advertising, phydev->supported);

This is not correct. Just because the MAC can do 2.5G does not mean
the PHY can. So you should not be adding links modes. Also, somebody
might be using a PHY that can do 2.5G with a MAC which can only do 1G.

The correct thing to do is call phy_set_max_speed() with the maximum
speed the MAC can do.

      Andrew

  reply	other threads:[~2019-02-22 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 20:12 [PATCH 1/3] net: ethernet: add support for PCS and 2.5G speed Parshuram Thombare
2019-02-22 21:39 ` Andrew Lunn [this message]
2019-02-23  6:24   ` Parshuram Raju Thombare
2019-02-25  2:31 ` Florian Fainelli
2019-02-25  9:11   ` Parshuram Raju Thombare
2019-02-25 17:21     ` Florian Fainelli
2019-02-26  9:23       ` Nicolas.Ferre
2019-02-26 17:09         ` David Miller

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=20190222213953.GN5894@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jank@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=piotrs@cadence.com \
    --cc=pthombar@cadence.com \
    --cc=rafalc@cadence.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).