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:   Wed, 22 Mar 2023 13:23:36 +0530
From:   Pavan Chebbi <pavan.chebbi@...adcom.com>
To:     Tony Nguyen <anthony.l.nguyen@...el.com>
Cc:     davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com, netdev@...r.kernel.org,
        Andrii Staikov <andrii.staikov@...el.com>,
        richardcochran@...il.com, Jacob Keller <jacob.e.keller@...el.com>,
        Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com>
Subject: Re: [PATCH net-next 1/3] igb: refactor igb_ptp_adjfine_82580 to use diff_by_scaled_ppm

On Wed, Mar 22, 2023 at 1:32 AM Tony Nguyen <anthony.l.nguyen@...el.com> wrote:
>
> From: Andrii Staikov <andrii.staikov@...el.com>
>
> Driver's .adjfine interface functions use adjust_by_scaled_ppm and
> diff_by_scaled_ppm introduced in commit 1060707e3809
> ("ptp: introduce helpers to adjust by scaled parts per million")
> to calculate the required adjustment in a concise manner,
> but not igb_ptp_adjfine_82580.
> Fix it by introducing IGB_82580_BASE_PERIOD and changing function logic
> to use diff_by_scaled_ppm.
>
> Signed-off-by: Andrii Staikov <andrii.staikov@...el.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> ---

Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@...adcom.com>

>  drivers/net/ethernet/intel/igb/igb_ptp.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index 6f471b91f562..405886ee5261 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -67,6 +67,7 @@
>  #define INCVALUE_82576_MASK            GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
>  #define INCVALUE_82576                 (16u << IGB_82576_TSYNC_SHIFT)
>  #define IGB_NBITS_82580                        40
> +#define IGB_82580_BASE_PERIOD          0x800000000
>
>  static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
>  static void igb_ptp_sdp_init(struct igb_adapter *adapter);
> @@ -209,17 +210,11 @@ static int igb_ptp_adjfine_82580(struct ptp_clock_info *ptp, long scaled_ppm)
>         struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
>                                                ptp_caps);
>         struct e1000_hw *hw = &igb->hw;
> -       int neg_adj = 0;
> +       bool neg_adj;
>         u64 rate;
>         u32 inca;
>
> -       if (scaled_ppm < 0) {
> -               neg_adj = 1;
> -               scaled_ppm = -scaled_ppm;
> -       }
> -       rate = scaled_ppm;
> -       rate <<= 13;
> -       rate = div_u64(rate, 15625);
> +       neg_adj = diff_by_scaled_ppm(IGB_82580_BASE_PERIOD, scaled_ppm, &rate);
>
>         inca = rate & INCVALUE_MASK;
>         if (neg_adj)
> --
> 2.38.1
>

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ