[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230203092404.rc7bzrlbnmkjtf4f@soft-dev3-1>
Date: Fri, 3 Feb 2023 10:24:04 +0100
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: Casper Andersson <casper.casan@...il.com>
CC: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
"Steen Hegelund" <Steen.Hegelund@...rochip.com>,
Daniel Machon <daniel.machon@...rochip.com>,
<UNGLinuxDriver@...rochip.com>,
"Richard Cochran" <richardcochran@...il.com>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH net] net: microchip: sparx5: fix PTP init/deinit not
checking all ports
The 02/03/2023 09:55, Casper Andersson wrote:
>
> Check all ports instead of just port_count ports. PTP init was only
> checking ports 0 to port_count. If the hardware ports are not mapped
> starting from 0 then they would be missed, e.g. if only ports 20-30 were
> mapped it would attempt to init ports 0-10, resulting in NULL pointers
> when attempting to timestamp. Now it will init all mapped ports.
>
> Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
> Signed-off-by: Casper Andersson <casper.casan@...il.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@...rochip.com>
> ---
> drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
> index 0ed1ea7727c5..69e76634f9aa 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
> @@ -633,7 +633,7 @@ int sparx5_ptp_init(struct sparx5 *sparx5)
> /* Enable master counters */
> spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG);
>
> - for (i = 0; i < sparx5->port_count; i++) {
> + for (i = 0; i < SPX5_PORTS; i++) {
> port = sparx5->ports[i];
> if (!port)
> continue;
> @@ -649,7 +649,7 @@ void sparx5_ptp_deinit(struct sparx5 *sparx5)
> struct sparx5_port *port;
> int i;
>
> - for (i = 0; i < sparx5->port_count; i++) {
> + for (i = 0; i < SPX5_PORTS; i++) {
> port = sparx5->ports[i];
> if (!port)
> continue;
> --
> 2.34.1
>
--
/Horatiu
Powered by blists - more mailing lists