netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Manjunath Patil <manjunath.b.patil@oracle.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	Andrew Bowers <andrewx.bowers@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 5/7] ixgbe: protect TX timestamping from API misuse
Date: Sat,  2 Nov 2019 05:14:15 -0700	[thread overview]
Message-ID: <20191102121417.15421-6-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20191102121417.15421-1-jeffrey.t.kirsher@intel.com>

From: Manjunath Patil <manjunath.b.patil@oracle.com>

HW timestamping can only be requested for a packet if the NIC is first
setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the ixgbe
driver still allowed TX packets to request HW timestamping. In this
situation, we see 'clearing Tx Timestamp hang' noise in the log.

Fix this by checking that the NIC is configured for HW TX timestamping
before accepting a HW TX timestamping request.

similar-to:
	(26bd4e2 igb: protect TX timestamping from API misuse)
	(0a6f2f0 igb: Fix a test with HWTSTAMP_TX_ON)

Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6c9edd272c7a..fb98b7ca3c6a 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8650,7 +8650,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
 
 	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
 	    adapter->ptp_clock) {
-		if (!test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
+		if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON &&
+		    !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
 					   &adapter->state)) {
 			skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
 			tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
-- 
2.21.0


  parent reply	other threads:[~2019-11-02 12:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02 12:14 [net-next 0/7][pull request] 10GbE Intel Wired LAN Driver Updates 2019-11-02 Jeff Kirsher
2019-11-02 12:14 ` [net-next 1/7] fm10k: add missing field initializers to TLV attributes) Jeff Kirsher
2019-11-02 12:14 ` [net-next 2/7] fm10k: add support for ndo_get_vf_stats operation Jeff Kirsher
2019-11-02 12:14 ` [net-next 3/7] ixgbe: Make use of cpumask_local_spread to improve RSS locality Jeff Kirsher
2019-11-02 12:14 ` [net-next 4/7] fm10k: update driver version to match out-of-tree Jeff Kirsher
2019-11-02 12:14 ` Jeff Kirsher [this message]
2019-11-04 19:53   ` [net-next 5/7] ixgbe: protect TX timestamping from API misuse Jakub Kicinski
2019-11-04 21:15     ` Jeff Kirsher
2019-11-02 12:14 ` [net-next 6/7] i40e: enable X710 support Jeff Kirsher
2019-11-02 12:14 ` [net-next 7/7] i40e: implement VF stats NDO Jeff Kirsher

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=20191102121417.15421-6-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=davem@davemloft.net \
    --cc=manjunath.b.patil@oracle.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 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).