[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250522111839.tlieiy5s7qfrqxbb@DEN-DL-M31836.microchip.com>
Date: Thu, 22 May 2025 13:18:39 +0200
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
CC: <UNGLinuxDriver@...rochip.com>, <andrew+netdev@...n.ch>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <richardcochran@...il.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: lan966x: Fix 1-step timestamping over ipv4 or
ipv6
The 05/22/2025 11:47, Vadim Fedorenko wrote:
Hi Vadim,
> > -static int lan966x_ptp_classify(struct lan966x_port *port, struct sk_buff *skb)
> > +static void lan966x_ptp_classify(struct lan966x_port *port, struct sk_buff *skb,
> > + u8 *rew_op, u8 *pdu_type)
> > {
> > struct ptp_header *header;
> > u8 msgtype;
> > int type;
> >
> > - if (port->ptp_tx_cmd == IFH_REW_OP_NOOP)
> > - return IFH_REW_OP_NOOP;
> > + if (port->ptp_tx_cmd == IFH_REW_OP_NOOP) {
> > + *rew_op = IFH_REW_OP_NOOP;
> > + *pdu_type = IFH_PDU_TYPE_NONE;
> > + return;
> > + }
> >
> > type = ptp_classify_raw(skb);
> > - if (type == PTP_CLASS_NONE)
> > - return IFH_REW_OP_NOOP;
> > + if (type == PTP_CLASS_NONE) {
> > + *rew_op = IFH_REW_OP_NOOP;
> > + *pdu_type = IFH_PDU_TYPE_NONE;
> > + return;
> > + }
> >
> > header = ptp_parse_header(skb, type);
> > - if (!header)
> > - return IFH_REW_OP_NOOP;
> > + if (!header) {
> > + *rew_op = IFH_REW_OP_NOOP;
> > + *pdu_type = IFH_PDU_TYPE_NONE;
> > + return;
> > + }
> >
> > - if (port->ptp_tx_cmd == IFH_REW_OP_TWO_STEP_PTP)
> > - return IFH_REW_OP_TWO_STEP_PTP;
> > + if (type & PTP_CLASS_L2)
> > + *pdu_type = IFH_PDU_TYPE_NONE;
> > + if (type & PTP_CLASS_IPV4)
> > + *pdu_type = IFH_PDU_TYPE_IPV4;
> > + if (type & PTP_CLASS_IPV6)
> > + *pdu_type = IFH_PDU_TYPE_IPV6;
>
> ptp_classify_raw() will also return PTP_CLASS_IPV4 or PTP_CLASS_IPV6
> flags set for (PTP_CLASS_VLAN|PTP_CLASS_IPV4) and
> (PTP_CLASS_VLAN|PTP_CLASS_IPV6) cases. Will the hardware support proper
> timestamp placing in these cases?
Yes, the HW seems to be working also in that case.
I just created a vlan interface and then start ptp4l on that interface
and I could see that the frames were updated correctly.
>
> > +
> > + if (port->ptp_tx_cmd == IFH_REW_OP_TWO_STEP_PTP) {
> > + *rew_op = IFH_REW_OP_TWO_STEP_PTP;
> > + return;
> > + }
> >
> > /* If it is sync and run 1 step then set the correct operation,
> > * otherwise run as 2 step
> > */
> > msgtype = ptp_get_msgtype(header, type);
> > - if ((msgtype & 0xf) == 0)
> > - return IFH_REW_OP_ONE_STEP_PTP;
> > + if ((msgtype & 0xf) == 0) {
> > + *rew_op = IFH_REW_OP_ONE_STEP_PTP;
> > + return;
> > + }
> >
> > - return IFH_REW_OP_TWO_STEP_PTP;
> > + *rew_op = IFH_REW_OP_TWO_STEP_PTP;
> > }
> >
> > static void lan966x_ptp_txtstamp_old_release(struct lan966x_port *port)
> > @@ -374,10 +395,12 @@ int lan966x_ptp_txtstamp_request(struct lan966x_port *port,
> > {
> > struct lan966x *lan966x = port->lan966x;
> > unsigned long flags;
> > + u8 pdu_type;
> > u8 rew_op;
> >
> > - rew_op = lan966x_ptp_classify(port, skb);
> > + lan966x_ptp_classify(port, skb, &rew_op, &pdu_type);
> > LAN966X_SKB_CB(skb)->rew_op = rew_op;
> > + LAN966X_SKB_CB(skb)->pdu_type = pdu_type;
> >
> > if (rew_op != IFH_REW_OP_TWO_STEP_PTP)
> > return 0;
>
--
/Horatiu
Powered by blists - more mailing lists