Skip to content

Commit

Permalink
net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb
Browse files Browse the repository at this point in the history
When skb_match is NULL, it means we received a PTP IRQ for a timestamp
ID that the kernel has no idea about, since there is no skb in the
timestamping queue with that timestamp ID.

This is a grave error and not something to just "continue" over.
So print a big warning in case this happens.

Also, move the check above ocelot_get_hwtimestamp(), there is no point
in reading the full 64-bit current PTP time if we're not going to do
anything with it anyway for this skb.

Fixes: 4e3b046 ("net: mscc: PTP Hardware Clock (PHC) support")
Signed-off-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
vladimiroltean authored and kuba-moo committed Oct 13, 2021
1 parent 52849bc commit 9fde506
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mscc/ocelot.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,12 @@ void ocelot_get_txtstamp(struct ocelot *ocelot)

spin_unlock_irqrestore(&port->tx_skbs.lock, flags);

if (WARN_ON(!skb_match))
continue;

/* Get the h/w timestamp */
ocelot_get_hwtimestamp(ocelot, &ts);

if (unlikely(!skb_match))
continue;

/* Set the timestamp into the skb */
memset(&shhwtstamps, 0, sizeof(shhwtstamps));
shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
Expand Down

0 comments on commit 9fde506

Please sign in to comment.