Skip to content

Commit

Permalink
net: ethernet: update drivers to make both SW and HW TX timestamps
Browse files Browse the repository at this point in the history
Some drivers were calling the skb_tx_timestamp() function only when
a hardware timestamp was not requested. Now that applications can use
the SOF_TIMESTAMPING_OPT_TX_SWHW option to request both software and
hardware timestamps, the drivers need to be modified to unconditionally
call skb_tx_timestamp().

CC: Richard Cochran <[email protected]>
CC: Willem de Bruijn <[email protected]>
Signed-off-by: Miroslav Lichvar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
mlichvar authored and davem330 committed May 21, 2017
1 parent b50a5c7 commit 74abc9b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/amd/xgbe/xgbe-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,7 @@ static void xgbe_prep_tx_tstamp(struct xgbe_prv_data *pdata,
spin_unlock_irqrestore(&pdata->tstamp_lock, flags);
}

if (!XGMAC_GET_BITS(packet->attributes, TX_PACKET_ATTRIBUTES, PTP))
skb_tx_timestamp(skb);
skb_tx_timestamp(skb);
}

static void xgbe_prep_vlan(struct sk_buff *skb, struct xgbe_packet_data *packet)
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5868,10 +5868,10 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
adapter->tx_hwtstamp_skb = skb_get(skb);
adapter->tx_hwtstamp_start = jiffies;
schedule_work(&adapter->tx_hwtstamp_work);
} else {
skb_tx_timestamp(skb);
}

skb_tx_timestamp(skb);

netdev_sent_queue(netdev, skb->len);
e1000_tx_queue(tx_ring, tx_flags, count);
/* Make sure there is space in the ring for the next send. */
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,7 @@ static netdev_tx_t sxgbe_xmit(struct sk_buff *skb, struct net_device *dev)
priv->hw->desc->tx_enable_tstamp(first_desc);
}

if (!tqueue->hwts_tx_en)
skb_tx_timestamp(skb);
skb_tx_timestamp(skb);

priv->hw->dma->enable_dma_transmission(priv->ioaddr, txq_index);

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2880,8 +2880,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
priv->xstats.tx_set_ic_bit++;
}

if (!priv->hwts_tx_en)
skb_tx_timestamp(skb);
skb_tx_timestamp(skb);

if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
priv->hwts_tx_en)) {
Expand Down Expand Up @@ -3084,8 +3083,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->xstats.tx_set_ic_bit++;
}

if (!priv->hwts_tx_en)
skb_tx_timestamp(skb);
skb_tx_timestamp(skb);

/* Ready to fill the first descriptor and set the OWN bit w/o any
* problems because all the descriptors are actually ready to be
Expand Down

0 comments on commit 74abc9b

Please sign in to comment.