Subject: Re: [PATCH net 2/4] igc: Check if hardware TX timestamping is enabled earlier

From: Jakub Kicinski <[email-masked]>
Date: Wed, 31 May 2023 23:10:29 -0700

On Tue, 30 May 2023 10:49:26 -0700 Tony Nguyen wrote:
> -	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
> +	if (unlikely(adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON &&
> +		     skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
>  		/* FIXME: add support for retrieving timestamps from
>  		 * the other timer registers before skipping the
>  		 * timestamping request.
> @@ -1586,7 +1587,7 @@ static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb,
>  		unsigned long flags;
>  
>  		spin_lock_irqsave(&adapter->ptp_tx_lock, flags);
> -		if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON && !adapter->ptp_tx_skb) {
> +		if (!adapter->ptp_tx_skb) {

AFAICT the cancel / cleanup path is not synchronized (I mean for
accesses to adapter->tstamp_config) so this looks racy to me :(