From: Richard Cochran <richardcochran@gmail.com>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Eran Ben Elisha <eranbe@mellanox.com>,
Tal Alon <talal@mellanox.com>, Majd Dibbiny <majd@mellanox.com>,
Achiad Shochat <achiad@mellanox.com>,
saeedm@dev.mellanox.co.il
Subject: Re: [PATCH net-next V2 3/4] net/mlx5e: Add HW timestamping (TS) support
Date: Mon, 21 Dec 2015 10:15:09 +0100 [thread overview]
Message-ID: <20151221091509.GA2297@localhost.localdomain> (raw)
In-Reply-To: <1450647991-13736-4-git-send-email-saeedm@mellanox.com>
On Sun, Dec 20, 2015 at 11:46:30PM +0200, Saeed Mahameed wrote:
> +/* 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.
> + write_unlock_irqrestore(&tstamp->lock, flags);
> +}
> +void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv)
> +{
> + struct mlx5e_tstamp *tstamp = &priv->tstamp;
> +
> + if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz))
> + return;
> +
> + write_lock(&tstamp->lock);
> + tstamp->overflow_period = 0; /* Signal overflow_check to stop */
> + write_unlock(&tstamp->lock);
This is unnecessary because
> +
> + cancel_delayed_work_sync(&tstamp->overflow_work);
this will block until the work is cancelled.
> +}
Thanks,
Richard
next prev parent reply other threads:[~2015-12-21 9:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-20 21:46 [PATCH net-next V2 0/4] Introduce mlx5 ethernet timestamping Saeed Mahameed
2015-12-20 21:46 ` [PATCH net-next V2 1/4] net/mlx5e: Do not modify the TX SKB Saeed Mahameed
2015-12-21 5:05 ` Or Gerlitz
2015-12-20 21:46 ` [PATCH net-next V2 2/4] net/mlx5_core: Add support for reading hardware timestamp Saeed Mahameed
2015-12-20 21:46 ` [PATCH net-next V2 3/4] net/mlx5e: Add HW timestamping (TS) support Saeed Mahameed
2015-12-21 9:15 ` Richard Cochran [this message]
2015-12-21 14:35 ` Saeed Mahameed
2015-12-21 18:35 ` Richard Cochran
2015-12-22 9:56 ` Saeed Mahameed
2015-12-22 10:00 ` Saeed Mahameed
2015-12-22 17:01 ` Richard Cochran
2015-12-24 14:02 ` eran ben elisha
2015-12-20 21:46 ` [PATCH net-next V2 4/4] net/mlx5e: Add PTP Hardware Clock (PHC) support Saeed Mahameed
2015-12-21 9:16 ` Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151221091509.GA2297@localhost.localdomain \
--to=richardcochran@gmail.com \
--cc=achiad@mellanox.com \
--cc=davem@davemloft.net \
--cc=eranbe@mellanox.com \
--cc=majd@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=saeedm@dev.mellanox.co.il \
--cc=saeedm@mellanox.com \
--cc=talal@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).