]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/mellanox/mlx4/en_cq.c
net/mlx4_en: Add HW timestamping (TS) support
[~andy/linux] / drivers / net / ethernet / mellanox / mlx4 / en_cq.c
index b8d0854a7ad1e1a3d77d39dc883cb806a3b071c9..1e6c594d6d04d282c0dd453ef6a9351d34e98983 100644 (file)
@@ -77,6 +77,7 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
        struct mlx4_en_dev *mdev = priv->mdev;
        int err = 0;
        char name[25];
+       int timestamp_en = 0;
        struct cpu_rmap *rmap =
 #ifdef CONFIG_RFS_ACCEL
                priv->dev->rx_cpu_rmap;
@@ -123,8 +124,13 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
        if (!cq->is_tx)
                cq->size = priv->rx_ring[cq->ring].actual_size;
 
-       err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt, &mdev->priv_uar,
-                           cq->wqres.db.dma, &cq->mcq, cq->vector, 0);
+       if ((cq->is_tx && priv->hwtstamp_config.tx_type) ||
+           (!cq->is_tx && priv->hwtstamp_config.rx_filter))
+               timestamp_en = 1;
+
+       err = mlx4_cq_alloc(mdev->dev, cq->size, &cq->wqres.mtt,
+                           &mdev->priv_uar, cq->wqres.db.dma, &cq->mcq,
+                           cq->vector, 0, timestamp_en);
        if (err)
                return err;