Re: [PATCH net-next 5/8] net: dsa: microchip: Add KSZ8463 tail tag handling
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2026-01-15 17:05:51
Also in:
lkml
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2026-01-15 17:05:51
Also in:
lkml
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 ? Maxime