Re: [PATCH net-next V2 3/4] net/mlx5e: Add HW timestamping (TS) support
From: Saeed Mahameed <hidden>
Date: 2015-12-22 10:01:12
From: Saeed Mahameed <hidden>
Date: 2015-12-22 10:01:12
On Mon, Dec 21, 2015 at 11:15 AM, Richard Cochran [off-list ref] wrote:
On Sun, Dec 20, 2015 at 11:46:30PM +0200, Saeed Mahameed wrote:quoted
+/* Should run once every mlx5e_tstamp->overflow_period */ +static void mlx5e_timestamp_overflow(struct work_struct *work) +{ + struct delayed_work *dwork = to_delayed_work(work); + struct mlx5e_tstamp *tstamp = container_of(dwork, struct mlx5e_tstamp, overflow_work); + unsigned long flags; + + write_lock_irqsave(&tstamp->lock, flags); + timecounter_read(&tstamp->clock); + if (tstamp->overflow_period) + schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period);You don't need this test, and the call to schedule_delayed_work can be outside of the lock.
Ok, but what will happen if somehow tstamp->overflow_period is zero ? the work will run too rapidly. don't we need to have protection against such case.