Commit 95657e6a authored by David S. Miller's avatar David S. Miller

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/nex

t-queue

Tony Nguyen says:

====================
ice: detect and report PTP timestamp issues

Jacob Keller says:

This series fixes a few small issues with the cached PTP Hardware Clock
timestamp used for timestamp extension. It also introduces extra checks to
help detect issues with this logic, such as if the cached timestamp is not
updated within the 2 second window.

This introduces a few statistics similar to the ones already available in
other Intel drivers, including tx_hwtstamp_skipped and tx_hwtstamp_timeouts.

It is intended to aid in debugging issues we're seeing with some setups
which might be related to incorrect cached timestamp values.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8ea731d4 b1a582e6
...@@ -136,6 +136,11 @@ static const struct ice_stats ice_gstrings_pf_stats[] = { ...@@ -136,6 +136,11 @@ static const struct ice_stats ice_gstrings_pf_stats[] = {
ICE_PF_STAT("mac_remote_faults.nic", stats.mac_remote_faults), ICE_PF_STAT("mac_remote_faults.nic", stats.mac_remote_faults),
ICE_PF_STAT("fdir_sb_match.nic", stats.fd_sb_match), ICE_PF_STAT("fdir_sb_match.nic", stats.fd_sb_match),
ICE_PF_STAT("fdir_sb_status.nic", stats.fd_sb_status), ICE_PF_STAT("fdir_sb_status.nic", stats.fd_sb_status),
ICE_PF_STAT("tx_hwtstamp_skipped", ptp.tx_hwtstamp_skipped),
ICE_PF_STAT("tx_hwtstamp_timeouts", ptp.tx_hwtstamp_timeouts),
ICE_PF_STAT("tx_hwtstamp_flushed", ptp.tx_hwtstamp_flushed),
ICE_PF_STAT("tx_hwtstamp_discarded", ptp.tx_hwtstamp_discarded),
ICE_PF_STAT("late_cached_phc_updates", ptp.late_cached_phc_updates),
}; };
static const u32 ice_regs_dump_list[] = { static const u32 ice_regs_dump_list[] = {
...@@ -2826,6 +2831,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, ...@@ -2826,6 +2831,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,
tx_rings[i].count = new_tx_cnt; tx_rings[i].count = new_tx_cnt;
tx_rings[i].desc = NULL; tx_rings[i].desc = NULL;
tx_rings[i].tx_buf = NULL; tx_rings[i].tx_buf = NULL;
tx_rings[i].tx_tstamps = &pf->ptp.port.tx;
err = ice_setup_tx_ring(&tx_rings[i]); err = ice_setup_tx_ring(&tx_rings[i]);
if (err) { if (err) {
while (i--) while (i--)
...@@ -2884,6 +2890,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, ...@@ -2884,6 +2890,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,
/* clone ring and setup updated count */ /* clone ring and setup updated count */
rx_rings[i] = *vsi->rx_rings[i]; rx_rings[i] = *vsi->rx_rings[i];
rx_rings[i].count = new_rx_cnt; rx_rings[i].count = new_rx_cnt;
rx_rings[i].cached_phctime = pf->ptp.cached_phc_time;
rx_rings[i].desc = NULL; rx_rings[i].desc = NULL;
rx_rings[i].rx_buf = NULL; rx_rings[i].rx_buf = NULL;
/* this is to allow wr32 to have something to write to /* this is to allow wr32 to have something to write to
......
...@@ -1522,6 +1522,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) ...@@ -1522,6 +1522,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
ring->netdev = vsi->netdev; ring->netdev = vsi->netdev;
ring->dev = dev; ring->dev = dev;
ring->count = vsi->num_rx_desc; ring->count = vsi->num_rx_desc;
ring->cached_phctime = pf->ptp.cached_phc_time;
WRITE_ONCE(vsi->rx_rings[i], ring); WRITE_ONCE(vsi->rx_rings[i], ring);
} }
......
This diff is collapsed.
...@@ -163,6 +163,7 @@ struct ice_ptp_port { ...@@ -163,6 +163,7 @@ struct ice_ptp_port {
* @work: delayed work function for periodic tasks * @work: delayed work function for periodic tasks
* @extts_work: work function for handling external Tx timestamps * @extts_work: work function for handling external Tx timestamps
* @cached_phc_time: a cached copy of the PHC time for timestamp extension * @cached_phc_time: a cached copy of the PHC time for timestamp extension
* @cached_phc_jiffies: jiffies when cached_phc_time was last updated
* @ext_ts_chan: the external timestamp channel in use * @ext_ts_chan: the external timestamp channel in use
* @ext_ts_irq: the external timestamp IRQ in use * @ext_ts_irq: the external timestamp IRQ in use
* @kworker: kwork thread for handling periodic work * @kworker: kwork thread for handling periodic work
...@@ -171,12 +172,19 @@ struct ice_ptp_port { ...@@ -171,12 +172,19 @@ struct ice_ptp_port {
* @clock: pointer to registered PTP clock device * @clock: pointer to registered PTP clock device
* @tstamp_config: hardware timestamping configuration * @tstamp_config: hardware timestamping configuration
* @reset_time: kernel time after clock stop on reset * @reset_time: kernel time after clock stop on reset
* @tx_hwtstamp_skipped: number of Tx time stamp requests skipped
* @tx_hwtstamp_timeouts: number of Tx skbs discarded with no time stamp
* @tx_hwtstamp_flushed: number of Tx skbs flushed due to interface closed
* @tx_hwtstamp_discarded: number of Tx skbs discarded due to cached PHC time
* being too old to correctly extend timestamp
* @late_cached_phc_updates: number of times cached PHC update is late
*/ */
struct ice_ptp { struct ice_ptp {
struct ice_ptp_port port; struct ice_ptp_port port;
struct kthread_delayed_work work; struct kthread_delayed_work work;
struct kthread_work extts_work; struct kthread_work extts_work;
u64 cached_phc_time; u64 cached_phc_time;
unsigned long cached_phc_jiffies;
u8 ext_ts_chan; u8 ext_ts_chan;
u8 ext_ts_irq; u8 ext_ts_irq;
struct kthread_worker *kworker; struct kthread_worker *kworker;
...@@ -185,6 +193,11 @@ struct ice_ptp { ...@@ -185,6 +193,11 @@ struct ice_ptp {
struct ptp_clock *clock; struct ptp_clock *clock;
struct hwtstamp_config tstamp_config; struct hwtstamp_config tstamp_config;
u64 reset_time; u64 reset_time;
u32 tx_hwtstamp_skipped;
u32 tx_hwtstamp_timeouts;
u32 tx_hwtstamp_flushed;
u32 tx_hwtstamp_discarded;
u32 late_cached_phc_updates;
}; };
#define __ptp_port_to_ptp(p) \ #define __ptp_port_to_ptp(p) \
......
...@@ -2255,8 +2255,10 @@ ice_tstamp(struct ice_tx_ring *tx_ring, struct sk_buff *skb, ...@@ -2255,8 +2255,10 @@ ice_tstamp(struct ice_tx_ring *tx_ring, struct sk_buff *skb,
/* Grab an open timestamp slot */ /* Grab an open timestamp slot */
idx = ice_ptp_request_ts(tx_ring->tx_tstamps, skb); idx = ice_ptp_request_ts(tx_ring->tx_tstamps, skb);
if (idx < 0) if (idx < 0) {
tx_ring->vsi->back->ptp.tx_hwtstamp_skipped++;
return; return;
}
off->cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | off->cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX |
(ICE_TX_CTX_DESC_TSYN << ICE_TXD_CTX_QW1_CMD_S) | (ICE_TX_CTX_DESC_TSYN << ICE_TXD_CTX_QW1_CMD_S) |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment