Re: [PATCH net] net: fall back to skb_iif for the timestamping pktinfo if_index
Miroslav Lichvar <[email protected]>
| Newsgroups | org.kernel.vger.netdev |
|---|---|
| Message-ID | <aov5lCT4P_3tmRqR@localhost> |
On Sun, Aug 23, 2026 at 02:21:00AM -0300, JR Lanteigne wrote: > put_ts_pktinfo() resolves the interface index of a received packet > from its napi id. The lookup fails on drivers whose napi instances > are not attached to the delivering net_device (e.g. ti cpsw, which > keeps them on an internal dummy device) and on kernels built without > CONFIG_NET_RX_BUSY_POLL, where skb_napi_id() is always 0. In those > cases SCM_TIMESTAMPING_PKTINFO carries if_index 0 and applications > cannot tell which interface produced the hardware timestamp. chronyd, > for example, then ignores valid hardware timestamps. That's the intended behavior, from timestamping.rst: A valid (non-zero) interface index will be returned only if CONFIG_NET_RX_BUSY_POLL is enabled and the driver is using NAPI. > Fall back to skb->skb_iif, which is set for every received packet. > On aggregated interfaces this reports the aggregating device instead > of the physical one, but only in cases where the napi lookup already > failed and nothing was reported at all. That would cause applications to receive a wrong index in some cases, right? If it's possible, it should report the index of the physical interface, but it should not be guessing. > A userspace fallback for existing kernels was proposed to chrony > separately. That makes sense to me. It's a bug that it doesn't check for zero value. -- Miroslav Lichvar