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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190805171702.GA1552@localhost>
Date:   Mon, 5 Aug 2019 10:17:03 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Hubert Feurstein <h.feurstein@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Vladimir Oltean <olteanv@...il.com>
Subject: Re: [RFC] net: dsa: mv88e6xxx: ptp: improve phc2sys precision for
 mv88e6xxx  switch in combination with imx6-fec

On Fri, Aug 02, 2019 at 06:32:48PM +0200, Hubert Feurstein wrote:

> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 2f6057e7335d..20f589dc5b8b 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1814,11 +1814,25 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
>  
>  	reinit_completion(&fep->mdio_done);
>  
> -	/* start a write op */
> -	writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE |
> -		FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) |
> -		FEC_MMFR_TA | FEC_MMFR_DATA(value),
> -		fep->hwp + FEC_MII_DATA);
> +	if (bus->ptp_sts) {
> +		unsigned long flags = 0;
> +		local_irq_save(flags);
> +		__iowmb();
> +		/* >Take the timestamp *after* the memory barrier */
> +		ptp_read_system_prets(bus->ptp_sts);
> +		writel_relaxed(FEC_MMFR_ST | FEC_MMFR_OP_WRITE |
> +			FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) |
> +			FEC_MMFR_TA | FEC_MMFR_DATA(value),
> +			fep->hwp + FEC_MII_DATA);
> +		ptp_read_system_postts(bus->ptp_sts);

Regarding generic support of this, see if you can't place the
ptp_read_system_prets/postts() calls at the mii_bus layer.  This could
mean, for example, offering a two-part write API, to split this write
operation from...

> +		local_irq_restore(flags);
> +	} else {
> +		/* start a write op */
> +		writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE |
> +			FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) |
> +			FEC_MMFR_TA | FEC_MMFR_DATA(value),
> +			fep->hwp + FEC_MII_DATA);
> +	}
>
>  	/* wait for end of transfer */
>  	time_left = wait_for_completion_timeout(&fep->mdio_done,

...this kind of thing ^^^

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ