Re: [PATCH net-next 5/8] net: dsa: microchip: Add KSZ8463 tail tag handling
From: Bastien Curutchet
Date: Fri Jan 16 2026 - 02:08:57 EST
Hi Maxime,
On 1/15/26 6:05 PM, Maxime Chevallier wrote:
Hi Bastien,
On 15/01/2026 16:57, Bastien Curutchet (Schneider Electric) wrote:
KSZ8463 uses the KSZ9893 DSA TAG driver. However, the KSZ8463 doesn't
use the tail tag to convey timestamps to the host as KSZ9893 does. It
uses the reserved fields in the PTP header instead.
[ ... ]
+static struct sk_buff *ksz8463_rcv(struct sk_buff *skb, struct net_device *dev)
+{
+ unsigned int len = KSZ_EGRESS_TAG_LEN;
+ struct ptp_header *ptp_hdr;
+ unsigned int ptp_class;
+ unsigned int port;
+ ktime_t tstamp;
+ u8 *tag;
+
+ if (skb_linearize(skb))
+ return NULL;
+
+ /* Tag decoding */
+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
+ port = tag[0] & KSZ8463_TAIL_TAG_EG_PORT_M;
+
+ __skb_push(skb, ETH_HLEN);
+ ptp_class = ptp_classify_raw(skb);
+ __skb_pull(skb, ETH_HLEN);
+ if (ptp_class == PTP_CLASS_NONE)
+ goto common_rcv;
+
+ ptp_hdr = ptp_parse_header(skb, ptp_class);
+ if (ptp_hdr) {
+ tstamp = ksz_decode_tstamp(get_unaligned_be32(&ptp_hdr->reserved2));
+ KSZ_SKB_CB(skb)->tstamp = tstamp;
As it is using a reserved field, is it OK to leave this field as-is when forwarding
this skb to userspace, or should it be zeroed first ?
It doesn't seem to hurt, at least on my test setup (I'm using ptp4l in userspace btw), but I agree with you: it feels safer to zero it first. I'll do it in next iteration.
Best regards,
Bastien