netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com
Subject: Re: [net-next 06/12] ixgbe: Hardware Timestamping + PTP Hardware Clock (PHC)
Date: Thu, 10 May 2012 16:11:22 +0200	[thread overview]
Message-ID: <20120510141122.GB3392@localhost.localdomain> (raw)
In-Reply-To: <1336632413-19135-7-git-send-email-jeffrey.t.kirsher@intel.com>

Mostly, this looks very good. I do have one concern and a nit, though.

On Wed, May 09, 2012 at 11:46:47PM -0700, Jeff Kirsher wrote:
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 1693ec3..9a83c40 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -789,6 +789,13 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
>  		total_bytes += tx_buffer->bytecount;
>  		total_packets += tx_buffer->gso_segs;
>  
> +#ifdef CONFIG_IXGBE_PTP
> +		if (unlikely(tx_buffer->tx_flags &
> +			     IXGBE_TX_FLAGS_TSTAMP))
> +			ixgbe_ptp_tx_hwtstamp(q_vector,
> +					      tx_buffer->skb);

This looks strangely wrapped.

> +
> +#endif
>  		/* free the skb */
>  		dev_kfree_skb_any(tx_buffer->skb);
>  

...

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
> new file mode 100644
> index 0000000..0b6553e
> --- /dev/null
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c

...

> +/**
> + * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp
> + * @q_vector: structure containing interrupt and ring information
> + * @skb: particular skb to send timestamp with
> + *
> + * if the timestamp is valid, we convert it into the timecounter ns
> + * value, then store that result into the shhwtstamps structure which
> + * is passed up the network stack
> + */
> +void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
> +			   struct sk_buff *skb)
> +{
> +	struct ixgbe_adapter *adapter;
> +	struct ixgbe_hw *hw;
> +	struct skb_shared_hwtstamps *shhwtstamps;
> +	u64 regval = 0, ns;
> +	u32 tsyncrxctl;
> +	unsigned long flags;
> +
> +	/* we cannot process timestamps on a ring without a q_vector */
> +	if (!q_vector || !q_vector->adapter)
> +		return;
> +
> +	adapter = q_vector->adapter;
> +	hw = &adapter->hw;
> +
> +	tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL);
> +	regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL);
> +	regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32;
> +
> +	/*
> +	 * If this bit is set, then the RX registers contain the time stamp. No
> +	 * other packet will be time stamped until we read these registers, so
> +	 * read the registers to make them available again. Because only one
> +	 * packet can be time stamped at a time, we know that the register
> +	 * values must belong to this one here and therefore we don't need to
> +	 * compare any of the additional attributes stored for it.

I suspect that this assumption is wrong. What happens if the time
stamping logic locks a value but the packet is lost because the ring
is full?

BTW, the IGB driver also has this defect.

Thanks,
Richard

  reply	other threads:[~2012-05-10 14:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10  6:46 [net-next 00/12][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-05-10  6:46 ` [net-next 01/12] igb: output register's information related to RX/TX queue[4-15] Jeff Kirsher
2012-05-10  6:46 ` [net-next 02/12] ixgbe: Exit on error case in VF message processing Jeff Kirsher
2012-05-10  6:46 ` [net-next 03/12] ixgbe: Clean up priority based flow control Jeff Kirsher
2012-05-10  6:46 ` [net-next 04/12] ixgbe: Set Drop_EN bit when multiple Rx queues are present w/o " Jeff Kirsher
2012-05-10  6:46 ` [net-next 05/12] ixgbe: Fix bogus error message Jeff Kirsher
2012-05-10  6:46 ` [net-next 06/12] ixgbe: Hardware Timestamping + PTP Hardware Clock (PHC) Jeff Kirsher
2012-05-10 14:11   ` Richard Cochran [this message]
2012-05-10 21:53     ` Keller, Jacob E
2012-05-11  5:15       ` Richard Cochran
2012-05-11 18:05         ` Keller, Jacob E
2012-05-11 19:23         ` Keller, Jacob E
2012-05-12  5:34           ` Richard Cochran
2012-05-14 17:28             ` Jacob Keller
2012-05-14 22:42             ` Jacob Keller
2012-05-15  5:32               ` Richard Cochran
2012-05-11 19:34         ` Keller, Jacob E
2012-05-12  5:24           ` Richard Cochran
2012-05-10  6:46 ` [net-next 07/12] ixgbe: Enable timesync clock-out feature for PPS support on X540 Jeff Kirsher
2012-05-10 14:17   ` Richard Cochran
2012-05-10 21:54     ` Keller, Jacob E
2012-05-11  5:36       ` Richard Cochran
2012-05-11 18:09         ` Keller, Jacob E
2012-05-10 22:08     ` Keller, Jacob E
2012-05-11  5:40       ` Richard Cochran
2012-05-11 18:10         ` Keller, Jacob E
2012-05-10  6:46 ` [net-next 08/12] ixgbe: correct disable_rx_buff timeout Jeff Kirsher
2012-05-10  6:46 ` [net-next 09/12] ixgbe: add support for get_ts_info Jeff Kirsher
2012-05-10  6:46 ` [net-next 10/12] ixgbe: support software timestamping Jeff Kirsher
2012-05-10  6:46 ` [net-next 11/12] ixgbe: cleanup the hwmon function calls Jeff Kirsher
2012-05-10  6:46 ` [net-next 12/12] ixgbe: update version number Jeff Kirsher
2012-05-11  3:18 ` [net-next 00/12][pull request] Intel Wired LAN Driver Updates David Miller

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=20120510141122.GB3392@localhost.localdomain \
    --to=richardcochran@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.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).