All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, guru.anbalagane@oracle.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 13/22] i40e: correct check for reading TSYNINDX from the receive descriptor
Date: Mon, 31 Oct 2016 15:29:43 -0700	[thread overview]
Message-ID: <1477952992-125662-14-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1477952992-125662-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

When hardware has taken a timestamp for a received packet, it indicates
which RXTIME register the timestamp was placed in by some bits in the
receive descriptor. It uses 3 bits, one to indicate if the descriptor
index is valid (ie: there was a timestamp) and 2 bits to indicate which
of the 4 registers to read. However, the driver currently does not check
the TSYNVALID bit and only checks the index. It assumes a zero index
means no timestamp, and a non zero index means a timestamp occurred.
While this appears to be true, it prevents ever reading a timestamp in
RXTIME[0], and causes the first timestamp the device captures to be
ignored.

Fix this by using the TSYNVALID bit correctly as the true indicator of
whether the packet has an associated timestamp.

Also rename the variable rsyn to tsyn as this is more descriptive and
matches the register names.

Change-ID: I4437e8f3a3df2c2ddb458b0fb61420f3dafc4c12
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index daade4fe..c9eb6b8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1410,11 +1410,12 @@ void i40e_process_skb_fields(struct i40e_ring *rx_ring,
 	u64 qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
 	u32 rx_status = (qword & I40E_RXD_QW1_STATUS_MASK) >>
 			I40E_RXD_QW1_STATUS_SHIFT;
-	u32 rsyn = (rx_status & I40E_RXD_QW1_STATUS_TSYNINDX_MASK) >>
+	u32 tsynvalid = rx_status & I40E_RXD_QW1_STATUS_TSYNVALID_MASK;
+	u32 tsyn = (rx_status & I40E_RXD_QW1_STATUS_TSYNINDX_MASK) >>
 		   I40E_RXD_QW1_STATUS_TSYNINDX_SHIFT;
 
-	if (unlikely(rsyn)) {
-		i40e_ptp_rx_hwtstamp(rx_ring->vsi->back, skb, rsyn);
+	if (unlikely(tsynvalid)) {
+		i40e_ptp_rx_hwtstamp(rx_ring->vsi->back, skb, tsyn);
 		rx_ring->last_rx_timestamp = jiffies;
 	}
 
-- 
2.7.4

  parent reply	other threads:[~2016-10-31 22:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 22:29 [net-next 00/22][pull request] 40GbE Intel Wired LAN Driver Updates 2016-10-31 Jeff Kirsher
2016-10-31 22:29 ` [net-next 01/22] i40e: Add missing \n to end of dev_err message Jeff Kirsher
2016-10-31 22:29 ` [net-next 02/22] i40e: drop is_vf and is_netdev fields in struct i40e_mac_filter Jeff Kirsher
2016-10-31 22:29 ` [net-next 03/22] i40e: make use of __dev_uc_sync and __dev_mc_sync Jeff Kirsher
2016-10-31 22:29 ` [net-next 04/22] i40e: move i40e_put_mac_in_vlan and i40e_del_mac_all_vlan Jeff Kirsher
2016-10-31 22:29 ` [net-next 05/22] i40e: refactor i40e_put_mac_in_vlan to avoid changing f->vlan Jeff Kirsher
2016-10-31 22:29 ` [net-next 06/22] i40e: When searching all MAC/VLAN filters, ignore removed filters Jeff Kirsher
2016-10-31 22:29 ` [net-next 07/22] i40e: implement __i40e_del_filter and use where applicable Jeff Kirsher
2016-10-31 22:29 ` [net-next 08/22] i40e: store MAC/VLAN filters in a hash with the MAC Address as key Jeff Kirsher
2016-10-31 22:29 ` [net-next 09/22] i40e: properly cleanup on allocation failure in i40e_sync_vsi_filters Jeff Kirsher
2016-10-31 22:29 ` [net-next 10/22] i40e: fix MAC filters when removing VLANs Jeff Kirsher
2016-10-31 22:29 ` [net-next 11/22] i40e: avoid looping to check whether we're in VLAN mode Jeff Kirsher
2016-10-31 22:29 ` [net-next 12/22] i40e: remove duplicate add/delete adminq command code for filters Jeff Kirsher
2016-10-31 22:29 ` Jeff Kirsher [this message]
2016-10-31 22:29 ` [net-next 14/22] i40e: use a mutex instead of spinlock in PTP user entry points Jeff Kirsher
2016-10-31 22:29 ` [net-next 15/22] i40e: replace PTP Rx timestamp hang logic Jeff Kirsher
2016-10-31 22:29 ` [net-next 16/22] i40evf: avoid an extra msleep while Jeff Kirsher
2016-10-31 22:29 ` [net-next 17/22] i40e: Add common function for finding VSI by type Jeff Kirsher
2016-10-31 22:29 ` [net-next 18/22] i40e: Reorder logic for coalescing RS bits Jeff Kirsher
2016-10-31 22:29 ` [net-next 19/22] i40e: clear mac filter count on reset Jeff Kirsher
2016-10-31 22:29 ` [net-next 20/22] i40e: Fix for division by zero Jeff Kirsher
2016-10-31 22:29 ` [net-next 21/22] i40e: Implementation of ERROR state for NVM update state machine Jeff Kirsher
2016-10-31 22:29 ` [net-next 22/22] i40e: removed unreachable code Jeff Kirsher
2016-11-01 14:59 ` [net-next 00/22][pull request] 40GbE Intel Wired LAN Driver Updates 2016-10-31 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=1477952992-125662-14-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=guru.anbalagane@oracle.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.