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: eran ben elisha <hidden>
Date: 2015-12-24 14:02:15

+void mlx5e_fill_hwstamp(struct mlx5e_tstamp *tstamp,
+                       struct skb_shared_hwtstamps *hwts,
+                       u64 timestamp)
+{
+       unsigned long flags;
+       u64 nsec;
+
+       memset(hwts, 0, sizeof(struct skb_shared_hwtstamps));
+       read_lock_irqsave(&tstamp->lock, flags);
Richard and others,
Any special reason to use read_lock_irqsave and not just read_lock?
On second thought could not see any good reason for that,
but saw many other examples which uses irqsave.

thanks,
Eran
+       nsec = timecounter_cyc2time(&tstamp->clock, timestamp);
+       read_unlock_irqrestore(&tstamp->lock, flags);
+
+       hwts->hwtstamp = ns_to_ktime(nsec);
+}
+
+static cycle_t mlx5e_read_clock(const struct cyclecounter *cc)
+{
+       struct mlx5e_tstamp *tstamp = container_of(cc, struct mlx5e_tstamp,
+                                                  cycles);
+       struct mlx5e_priv *priv = container_of(tstamp, struct mlx5e_priv,
+                                              tstamp);
+
+       return mlx5_core_read_clock(priv->mdev) & cc->mask;
+}
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help