* [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse
@ 2017-06-19 20:30 Cliff Spradlin
2017-06-20 12:55 ` Miroslav Lichvar
2017-06-27 0:53 ` Brown, Aaron F
0 siblings, 2 replies; 3+ messages in thread
From: Cliff Spradlin @ 2017-06-19 20:30 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 igb
driver still allowed TX packets to request HW timestamping. In this
situation, the _IGB_PTP_TX_IN_PROGRESS flag was set and would never
clear. This prevented any future HW timestamping requests to succeed.
Fix this by checking that the NIC is configured for HW TX timestamping
before accepting a HW TX timestamping request.
Signed-off-by: Cliff Spradlin <cspradlin@google.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 63b035454cd0..4077a09fd4c2 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5388,7 +5388,8 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
- if (!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
+ if (adapter->tstamp_config.tx_type & HWTSTAMP_TX_ON &&
+ !test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
&adapter->state)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
tx_flags |= IGB_TX_FLAGS_TSTAMP;
--
2.13.1.518.g3df882009-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse
2017-06-19 20:30 [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse Cliff Spradlin
@ 2017-06-20 12:55 ` Miroslav Lichvar
2017-06-27 0:53 ` Brown, Aaron F
1 sibling, 0 replies; 3+ messages in thread
From: Miroslav Lichvar @ 2017-06-20 12:55 UTC (permalink / raw)
To: intel-wired-lan
On Mon, Jun 19, 2017 at 01:30:43PM -0700, Cliff Spradlin wrote:
> 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 igb
> driver still allowed TX packets to request HW timestamping. In this
> situation, the _IGB_PTP_TX_IN_PROGRESS flag was set and would never
> clear. This prevented any future HW timestamping requests to succeed.
Good catch!
This probably explains some weird cases I saw where HW timestamping
stopped working and the only thing that fixed it was to rmmod &&
modprobe the igb driver. I suspected a faulty HW and it's probably
just me messing with hwstamp_ctl at wrong time.
Thanks,
--
Miroslav Lichvar
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse
2017-06-19 20:30 [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse Cliff Spradlin
2017-06-20 12:55 ` Miroslav Lichvar
@ 2017-06-27 0:53 ` Brown, Aaron F
1 sibling, 0 replies; 3+ messages in thread
From: Brown, Aaron F @ 2017-06-27 0:53 UTC (permalink / raw)
To: intel-wired-lan
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf
> Of Cliff Spradlin
> Sent: Monday, June 19, 2017 1:31 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH] igb: 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 igb
> driver still allowed TX packets to request HW timestamping. In this
> situation, the _IGB_PTP_TX_IN_PROGRESS flag was set and would never
> clear. This prevented any future HW timestamping requests to succeed.
>
> Fix this by checking that the NIC is configured for HW TX timestamping
> before accepting a HW TX timestamping request.
>
> Signed-off-by: Cliff Spradlin <cspradlin@google.com>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-27 0:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-19 20:30 [Intel-wired-lan] [PATCH] igb: protect TX timestamping from API misuse Cliff Spradlin
2017-06-20 12:55 ` Miroslav Lichvar
2017-06-27 0:53 ` Brown, Aaron F
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.