From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <robh+dt@kernel.org>,
<UNGLinuxDriver@microchip.com>, <p.zabel@pengutronix.de>,
<netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v3 3/6] net: lan966x: add port module support
Date: Wed, 24 Nov 2021 16:43:23 +0100 [thread overview]
Message-ID: <20211124154323.44liimrwzthsh547@soft-dev3-1.localhost> (raw)
In-Reply-To: <YZ5UXdiNNf011skU@shell.armlinux.org.uk>
The 11/24/2021 15:03, Russell King (Oracle) wrote:
>
> On Wed, Nov 24, 2021 at 03:58:00PM +0100, Horatiu Vultur wrote:
> > > This doesn't look like the correct sequence to me. Shouldn't the net
> > > device be unregistered first, which will take the port down by doing
> > > so and make it unavailable to userspace to further manipulate. Then
> > > we should start tearing other stuff down such as destroying phylink
> > > and disabling interrupts (in the caller of this.)
> >
> > I can change the order as you suggested.
> > Regarding the interrupts, shouldn't they be first disable and then do
> > all the teardown?
>
> Depends if you need them disabled before you do the teardown. However,
> what would be the effect of disabling interrupts while the user still
> has the ability to interact with the port - that is the main point.
>
> Generally the teardown should be the reverse of setup - where it's now
> accepted that all setup should be done prior to user publication. So,
> user interfaces should be removed and then teardown should proceed.
Yes, I get your point. I will remove the interface and then I will
disable the interrupts.
>
> > > What is the difference between "portmode" and "phy_mode"? Does it matter
> > > if port->config.phy_mode get zeroed when lan966x_port_pcs_set() is
> > > called from lan966x_pcs_config()? It looks to me like the first call
> > > will clear phy_mode, setting it to PHY_INTERFACE_MODE_NA from that point
> > > on.
> >
> > The purpose was to use portmode to configure the MAC and the phy_mode
> > to configure the serdes. There are small issues regarding this which
> > will be fix in the next series also I will add some comments just to
> > make it clear.
> >
> > Actually, port->config.phy_mode will not get zeroed. Because right after
> > the memset it follows: 'config = port->config'.
>
> Ah, missed that, thanks. However, why should portmode and phy_mode be
> different?
Because the serdes knows only few modes(QSGMII, SGMII, GMII) and this
information will come from DT. So I would like to have one variable that
will configure the serdes ('phy_mode') and one will configure the MAC
('portmode').
>
> > Actually, like you mentioned it needs to be link partner's advertisement
> > so that code can be simplified more:
> >
> > if (DEV_PCS1G_ANEG_STATUS_ANEG_COMPLETE_GET(val)) {
> > state->an_complete = true;
> >
> > bmsr |= state->link ? BMSR_LSTATUS : 0;
> > bmsr |= BMSR_ANEGCOMPLETE;
> >
> > lp_adv = DEV_PCS1G_ANEG_STATUS_LP_ADV_GET(val);
> > phylink_mii_c22_pcs_decode_state(state, bmsr, lp_adv);
> > }
> >
> > Because inside phylink_mii_c22_pcs_decode_state, more precisely in
> > phylink_decode_c37_work, state->advertising will have the local
> > advertising.
>
> Correct.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
--
/Horatiu
next prev parent reply other threads:[~2021-11-24 15:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 8:39 [PATCH net-next v3 0/6] net: lan966x: Add lan966x switch driver Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 1/6] dt-bindings: net: lan966x: Add lan966x-switch bindings Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 2/6] net: lan966x: add the basic lan966x driver Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 3/6] net: lan966x: add port module support Horatiu Vultur
2021-11-24 10:20 ` Russell King (Oracle)
2021-11-24 14:58 ` Horatiu Vultur
2021-11-24 15:03 ` Russell King (Oracle)
2021-11-24 15:43 ` Horatiu Vultur [this message]
2021-11-24 16:04 ` Russell King (Oracle)
2021-11-25 11:16 ` Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 4/6] net: lan966x: add mactable support Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 5/6] net: lan966x: add ethtool configuration and statistics Horatiu Vultur
2021-11-24 8:39 ` [PATCH net-next v3 6/6] net: lan966x: Update MAINTAINERS to include lan966x driver Horatiu Vultur
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=20211124154323.44liimrwzthsh547@soft-dev3-1.localhost \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
/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).