[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230711175454.040822b1@kernel.org>
Date: Tue, 11 Jul 2023 17:54:54 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Leon Romanovsky <leon@...nel.org>
Cc: Florian Kauer <florian.kauer@...utronix.de>, Tony Nguyen
<anthony.l.nguyen@...el.com>, davem@...emloft.net, pabeni@...hat.com,
edumazet@...gle.com, netdev@...r.kernel.org, kurt@...utronix.de,
vinicius.gomes@...el.com, muhammad.husaini.zulkifli@...el.com,
tee.min.tan@...ux.intel.com, aravindhan.gunasekaran@...el.com,
sasha.neftin@...el.com, Naama Meir <naamax.meir@...ux.intel.com>
Subject: Re: [PATCH net 5/6] igc: Fix launchtime before start of cycle
On Tue, 11 Jul 2023 13:12:33 +0300 Leon Romanovsky wrote:
> > If I understand correctly, ktime_sub_ns(txtime, baset_est) will only return
> > something larger than s32 max if cycle_time is larger than s32 max and if that
> > is the case everything will be broken anyway since the corresponding hardware
> > register only holds 30 bits.
>
> I suggest you to use proper variable types, what about the following
> snippet?
>
> ktime_t launchtime;
>
> launchtime = ktime_sub_ns(txtime, baset_est);
> WARN_ON(upper_32_bits(launchtime));
> div_s64_rem(launchtime, cycle_time, &launchtime);
>
> return cpu_to_le32(lower_32_bits(launchtime));
That needs to be coupled with some control path checks on cycle_time?
Seems like a separate fix TBH.
Powered by blists - more mailing lists