lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37af36f3-0df2-4433-bd45-4d4c316e7a8d@lunn.ch>
Date: Thu, 18 Sep 2025 22:46:36 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Richard Cochran <richardcochran@...il.com>,
	Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH RFC net-next 04/20] net: dsa: mv88e6xxx: split out
 set_ptp_cpu_port() code

On Thu, Sep 18, 2025 at 06:39:12PM +0100, Russell King (Oracle) wrote:
> Split out the code which sets up the upstream CPU port for PTP. This
> will be required when converted to the generic Marvell PTP library.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
>  drivers/net/dsa/mv88e6xxx/ptp.c | 42 ++++++++++++++++++++-------------
>  1 file changed, 25 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
> index f7603573d3a9..b60e4f02c256 100644
> --- a/drivers/net/dsa/mv88e6xxx/ptp.c
> +++ b/drivers/net/dsa/mv88e6xxx/ptp.c
> @@ -444,6 +444,27 @@ const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = {
>  		(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
>  };
>  
> +static int mv88e6xxx_set_ptp_cpu_port(struct mv88e6xxx_chip *chip)
> +{
> +	struct dsa_port *dp;
> +	int upstream = 0;
> +	int err;
> +
> +	if (!chip->info->ops->ptp_ops->set_ptp_cpu_port)
> +		return 0;
> +
> +	dsa_switch_for_each_user_port(dp, chip->ds) {
> +		upstream = dsa_upstream_port(chip->ds, dp->index);
> +		break;
> +	}

I think you can use dsa_switch_upstream_port(chip->ds);

It will look less odd than this loop construct.

> -	if (ptp_ops->set_ptp_cpu_port) {
> -		struct dsa_port *dp;
> -		int upstream = 0;
> -		int err;
> -
> -		dsa_switch_for_each_user_port(dp, chip->ds) {
> -			upstream = dsa_upstream_port(chip->ds, dp->index);
> -			break;
> -		}

Although i see you copied it from here. So keep it if you want.

	Andrew


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ