All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	Antoine Tenart <atenart@kernel.org>,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v4] net: macb: Fix several edge cases in validate
Date: Tue, 26 Oct 2021 11:30:08 -0400	[thread overview]
Message-ID: <4e430fbb-0908-fd3b-bb6e-ec316ea8d66a@seco.com> (raw)
In-Reply-To: <20211025174401.1de5e95d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

Hi Jakub,

On 10/25/21 8:44 PM, Jakub Kicinski wrote:
> On Mon, 25 Oct 2021 13:24:05 -0400 Sean Anderson wrote:
>> There were several cases where validate() would return bogus supported
>> modes with unusual combinations of interfaces and capabilities. For
>> example, if state->interface was 10GBASER and the macb had HIGH_SPEED
>> and PCS but not GIGABIT MODE, then 10/100 modes would be set anyway. In
>> another case, SGMII could be enabled even if the mac was not a GEM
>> (despite this being checked for later on in mac_config()). These
>> inconsistencies make it difficult to refactor this function cleanly.
>
> Since you're respinning anyway (AFAIU) would you mind clarifying
> the fix vs refactoring question? Sounds like it could be a fix for
> the right (wrong?) PHY/MAC combination, but I don't think you're
> intending it to be treated as a fix.
>
> If it's a fix it needs [PATCH net] in the subject and a Fixes tag,
> if it's not a fix it needs [PATCH net-next] in the subject.
>
> This will make the lifes of maintainers and backporters easier,
> thanks :)

I don't know if it's a "fix" per se. The current logic isn't wrong,
since I believe that the configurations where the above patch would make
a difference do not exist. However, as noted in the commit message, this
makes refactoring difficult. For example, one might want to implement
supported_interfaces like

        if (bp->caps & MACB_CAPS_HIGH_SPEED &&
            bp->caps & MACB_CAPS_PCS)
                __set_bit(PHY_INTERFACE_MODE_10GBASER, supported);
        if (macb_is_gem(bp) && bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
                __set_bit(PHY_INTERFACE_MODE_GMII, supported);
		phy_interface_set_rgmii(supported);
                if (bp->caps & MACB_CAPS_PCS)
                        __set_bit(PHY_INTERFACE_MODE_SGMII, supported);
        }
        __set_bit(PHY_INTERFACE_MODE_MII, supported);
        __set_bit(PHY_INTERFACE_MODE_RMII, supported);

but then you still need to check for GIGABIT_MODE in validate to
determine whether 10GBASER should "support" 10/100. See [1] for more
discussion.

If you think this fixes a bug, then the appropriate tag is

Fixes: 7897b071ac3b ("net: macb: convert to phylink")

--Sean

[1] https://lore.kernel.org/netdev/YXaIWFB8Kx9rm%2Fj9@shell.armlinux.org.uk/

  reply	other threads:[~2021-10-26 15:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 17:24 [PATCH v4] net: macb: Fix several edge cases in validate Sean Anderson
2021-10-25 21:19 ` Russell King (Oracle)
2021-10-25 21:35   ` Sean Anderson
2021-10-26 16:37     ` Nicolas Ferre
2021-10-26 17:04       ` Russell King (Oracle)
2021-10-26 17:28         ` Sean Anderson
2021-10-26 17:46           ` Russell King (Oracle)
2021-10-26 17:49             ` Sean Anderson
2021-10-26 18:28               ` Russell King (Oracle)
2021-10-26 18:52                 ` Sean Anderson
2021-10-27  7:02                   ` Nicolas.Ferre
2021-10-26  0:44 ` Jakub Kicinski
2021-10-26 15:30   ` Sean Anderson [this message]
2021-10-26 15:39     ` Jakub Kicinski
2021-10-26 16:32       ` Nicolas Ferre
2021-10-26 15:51     ` Russell King (Oracle)

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=4e430fbb-0908-fd3b-bb6e-ec316ea8d66a@seco.com \
    --to=sean.anderson@seco.com \
    --cc=atenart@kernel.org \
    --cc=claudiu.beznea@microchip.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.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.