All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ixgbe: protect TX timestamping from API misuse
@ 2019-10-05 15:20 ` Manjunath Patil
  0 siblings, 0 replies; 4+ messages in thread
From: Manjunath Patil @ 2019-10-05 15:20 UTC (permalink / raw)
  To: jeffrey.t.kirsher, davem, intel-wired-lan, netdev, linux-kernel
  Cc: manjunath.b.patil, cspradlin, christophe.jaillet

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>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 1ce2397..dd24aeb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8640,7 +8640,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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 1/1] ixgbe: protect TX timestamping from API misuse
@ 2019-10-05 15:20 ` Manjunath Patil
  0 siblings, 0 replies; 4+ messages in thread
From: Manjunath Patil @ 2019-10-05 15:20 UTC (permalink / raw)
  To: intel-wired-lan

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>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 1ce2397..dd24aeb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8640,7 +8640,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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [Intel-wired-lan] [PATCH 1/1] ixgbe: protect TX timestamping from API misuse
  2019-10-05 15:20 ` [Intel-wired-lan] " Manjunath Patil
@ 2019-10-08 16:54   ` Bowers, AndrewX
  -1 siblings, 0 replies; 4+ messages in thread
From: Bowers, AndrewX @ 2019-10-08 16:54 UTC (permalink / raw)
  To: intel-wired-lan, netdev, linux-kernel

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Manjunath Patil
> Sent: Saturday, October 5, 2019 8:20 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; davem@davemloft.net;
> intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Cc: manjunath.b.patil@oracle.com; christophe.jaillet@wanadoo.fr;
> cspradlin@google.com
> Subject: [Intel-wired-lan] [PATCH 1/1] ixgbe: protect TX timestamping from
> API misuse
> 
> 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>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 1/1] ixgbe: protect TX timestamping from API misuse
@ 2019-10-08 16:54   ` Bowers, AndrewX
  0 siblings, 0 replies; 4+ messages in thread
From: Bowers, AndrewX @ 2019-10-08 16:54 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Manjunath Patil
> Sent: Saturday, October 5, 2019 8:20 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; davem at davemloft.net;
> intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org; linux-
> kernel at vger.kernel.org
> Cc: manjunath.b.patil at oracle.com; christophe.jaillet at wanadoo.fr;
> cspradlin at google.com
> Subject: [Intel-wired-lan] [PATCH 1/1] ixgbe: protect TX timestamping from
> API misuse
> 
> 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>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-08 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-05 15:20 [PATCH 1/1] ixgbe: protect TX timestamping from API misuse Manjunath Patil
2019-10-05 15:20 ` [Intel-wired-lan] " Manjunath Patil
2019-10-08 16:54 ` Bowers, AndrewX
2019-10-08 16:54   ` Bowers, AndrewX

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.