Netdev List
 help / color / mirror / Atom feed
From: "Imre Kaloz" <kaloz@kernel.org>
To: "Elad Nachman" <enachman@marvell.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"Oleksandr Mazur" <oleksandr.mazur@plvision.eu>
Subject: Re: [EXTERNAL] [PATCH net] net: marvell: prestera: disable port before changing its MAC mode
Date: Sun, 15 Nov 2026 23:50:37 +0100	[thread overview]
Message-ID: <80c7731e-41ee-4e14-a262-a2bc18136ef6@app.fastmail.com> (raw)
In-Reply-To: <BL1PPFB0715B38B6145C7DCFD147033D05BDB7D2@BL1PPFB0715B38B.namprd18.prod.outlook.com>

Hi,

On Sun, Nov 15, 2026, at 17:49, Elad Nachman wrote:
>> prestera_pcs_config() writes a new mode or inband setting to a port
>> that is already enabled, as when phylink switches an SFP port to
>> inband SGMII. The firmware can then report link down and no link up
>> until the port is disabled and enabled again.
>> 
>> Disable the port before such a write. Exercising this needs a link
>> partner, so no in-tree test covers it.
>> 
>> Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
>> Signed-off-by: Imre Kaloz <kaloz@kernel.org>
>> ---
>>  .../net/ethernet/marvell/prestera/prestera_main.c  | 14 +++++++++++++-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
>> index a82e7a8029851..39ebd1944be55 100644
>> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
>> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
>> @@ -307,13 +307,14 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
>>                              bool permit_pause_to_mac)
>>  {
>>       struct prestera_port *port = prestera_pcs_to_port(pcs);
>> -     struct prestera_port_mac_config cfg_mac;
>> +     struct prestera_port_mac_config cfg_mac, old;
>>       int err;
>> 
>>       err = prestera_port_cfg_mac_read(port, &cfg_mac);
>>       if (err)
>>               return err;
>> 
>> +     old = cfg_mac;
>>       cfg_mac.admin = true;
>>       cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
>>       cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
>> @@ -339,6 +340,17 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
>>               break;
>>       }
>> 
>> +     /* Firmware may not report link up after the mode or inband setting of
>> +      * an enabled port changes until the port is disabled and re-enabled.
>> +      */
>> +     if (old.admin && (old.mode != cfg_mac.mode ||
>> +                       old.inband != cfg_mac.inband)) {
>> +             old.admin = false;
>> +             err = prestera_port_cfg_mac_write(port, &old);
>> +             if (err)
>> +                     return err;
>> +     }
>> +
>>       err = prestera_port_cfg_mac_write(port, &cfg_mac);
>>       if (err)
>>               return err;
>> --
>> 2.47.3
>> 
> 
> Reviewed-by: Elad Nachman <enachman@marvell.com>

Thanks, Elad.

The Sashiko review found that a switch between 2500BASE-X and SGMII,
which share one MAC mode, skips the disable. v2 also compares the
speed and sets it for SGMII. Since that changes the logic you
reviewed, v2 will not carry your Reviewed-by; I would be glad if you
could look at v2 and add it there.


Thanks,
Imre

      parent reply	other threads:[~2026-11-15 22:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 10:15 [PATCH net] net: marvell: prestera: disable port before changing its MAC mode Imre Kaloz
2026-11-11 10:20 ` netdev-bot+sinfo
     [not found] ` <BL1PPFB0715B38BE2E57548F95CCBDFCAF7DB712@BL1PPFB0715B38B.namprd18.prod.outlook.com>
2026-11-11 16:42   ` [EXTERNAL] " Imre Kaloz
     [not found]     ` <PH3PPFA2D0C836CFB7D296376875E16ECC8DB702@PH3PPFA2D0C836C.namprd18.prod.outlook.com>
2026-11-12 18:50       ` Imre Kaloz
     [not found]         ` <BL1PPFB0715B38BF7C2E60F8CA62C66A205DB7D2@BL1PPFB0715B38B.namprd18.prod.outlook.com>
2026-11-15 15:41           ` Imre Kaloz
2026-11-15 10:59 ` netdev-bot+sashiko
2026-11-15 15:50   ` Imre Kaloz
     [not found] ` <BL1PPFB0715B38B6145C7DCFD147033D05BDB7D2@BL1PPFB0715B38B.namprd18.prod.outlook.com>
2026-11-15 22:50   ` Imre Kaloz [this message]

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=80c7731e-41ee-4e14-a262-a2bc18136ef6@app.fastmail.com \
    --to=kaloz@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=enachman@marvell.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr.mazur@plvision.eu \
    --cc=pabeni@redhat.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