Thread (14 messages) 14 messages, 5 authors, 2015-12-24

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

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help