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]
Date:   Sat, 12 Oct 2019 12:02:42 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Igor Russkikh <Igor.Russkikh@...antia.com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        Egor Pomozov <Egor.Pomozov@...antia.com>,
        Dmitry Bezrukov <Dmitry.Bezrukov@...antia.com>,
        "andrew@...n.ch" <andrew@...n.ch>,
        Simon Edelhaus <sedelhaus@...vell.com>,
        Sergey Samoilenko <Sergey.Samoilenko@...antia.com>
Subject: Re: [PATCH v2 net-next 03/12] net: aquantia: add basic ptp_clock
 callbacks

On Tue, Oct 08, 2019 at 10:56:40AM +0000, Igor Russkikh wrote:

> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> index d5a28904f708..ba1597bb6eab 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> @@ -16,15 +16,107 @@
>  struct aq_ptp_s {
>  	struct aq_nic_s *aq_nic;
>  
> +	spinlock_t ptp_lock;
>  	struct ptp_clock *ptp_clock;
>  	struct ptp_clock_info ptp_info;
>  };
>  
> +/* aq_ptp_adjfreq
> + * @ptp: the ptp clock structure
> + * @ppb: parts per billion adjustment from base
> + *
> + * adjust the frequency of the ptp cycle counter by the
> + * indicated ppb from the base frequency.
> + */
> +static int aq_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)

The adjfreq() callback is deprecated.  Please implement adjfine() instead.

> +{
> +	struct aq_ptp_s *aq_ptp = container_of(ptp, struct aq_ptp_s, ptp_info);
> +	struct aq_nic_s *aq_nic = aq_ptp->aq_nic;
> +
> +	mutex_lock(&aq_nic->fwreq_mutex);

Here you use a different lock than...

> +	aq_nic->aq_hw_ops->hw_adj_clock_freq(aq_nic->aq_hw, ppb);
> +	mutex_unlock(&aq_nic->fwreq_mutex);
> +
> +	return 0;
> +}
> +
> +/* aq_ptp_adjtime
> + * @ptp: the ptp clock structure
> + * @delta: offset to adjust the cycle counter by
> + *
> + * adjust the timer by resetting the timecounter structure.
> + */
> +static int aq_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
> +{
> +	struct aq_ptp_s *aq_ptp = container_of(ptp, struct aq_ptp_s, ptp_info);
> +	struct aq_nic_s *aq_nic = aq_ptp->aq_nic;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&aq_ptp->ptp_lock, flags);

... here.  Is it safe to concurrently set the time and the frequency?

> +	aq_nic->aq_hw_ops->hw_adj_sys_clock(aq_nic->aq_hw, delta);
> +	spin_unlock_irqrestore(&aq_ptp->ptp_lock, flags);
> +
> +	return 0;
> +}

Thanks,
Richard

Powered by blists - more mailing lists