Thread (8 messages) 8 messages, 4 authors, 2012-10-10

Re: [PATCH V1 3/3] net/mlx4_en: Add HW timestamping (TS) support

flat view

From: Or Gerlitz <hidden>
Date: 2012-10-10 14:06:17

On 10/10/2012 05:37, Richard Cochran wrote:
On Tue, Oct 09, 2012 at 05:20:13PM +0200, Or Gerlitz wrote:
quoted
@@ -1542,6 +1611,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
  	.ndo_set_mac_address	= mlx4_en_set_mac,
  	.ndo_validate_addr	= eth_validate_addr,
  	.ndo_change_mtu		= mlx4_en_change_mtu,
+	.ndo_do_ioctl		= mlx4_en_ioctl,
  	.ndo_tx_timeout		= mlx4_en_tx_timeout,
  	.ndo_vlan_rx_add_vid	= mlx4_en_vlan_rx_add_vid,
  	.ndo_vlan_rx_kill_vid	= mlx4_en_vlan_rx_kill_vid,
You should also provide a get_ts_info function to let the users know
about the device's time stamping capabilities.
sure, will do.

quoted
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_timestamp.c b/drivers/net/ethernet/mellanox
...

+void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
+{
+	struct mlx4_dev *dev = mdev->dev;
+	u64 temp_mult;
+
+	memset(&mdev->cycles, 0, sizeof(mdev->cycles));
+	mdev->cycles.read = mlx4_en_read_clock;
+	mdev->cycles.mask = CLOCKSOURCE_MASK(48);
+
+	/* we have hca_core_clock in MHz, so to translate cycles to nsecs
+	 * we need to divide cycles by freq and multiply by 1000;
+	 * in order to get precise result we shift left the value,
+	 * since we don't have floating point there;
+	 * at the end shift result back
+	 */
+	temp_mult = ((1ull * 1000) << 29) / dev->caps.hca_core_clock;
+	mdev->cycles.mult = (u32)temp_mult;
+	mdev->cycles.shift = 29;
+
+	timecounter_init(&mdev->clock, &mdev->cycles,
+			 ktime_to_ns(ktime_get_real()));
I didn't see any watchdog code to read this clock periodically, in order to catch overflows.
Thanks for pointing this out, will look on that and see what needs to be fixed for V2

Or.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help