# Re: \[net-next 1/3\] net: dsa: optimize tx timestamp request handling

- From: Kurt Kanzenbach \<kurt@linutronix.de\>
- Date: 2021-04-19 06:46:38 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2021/04/6343281
- Thread: https://ratatoskr.run/netdev/2021/04/6341702/t.md

```text
On Fri Apr 16 2021, Yangbo Lu wrote:
> Optimization could be done on dsa_skb_tx_timestamp(), and dsa device
> drivers should adapt to it.
>
> - Check SKBTX_HW_TSTAMP request flag at the very beginning, instead of in
>   port_txtstamp, so that most skbs not requiring tx timestamp just return.
>
> - No longer to identify PTP packets, and limit tx timestamping only for PTP
>   packets. If device driver likes, let device driver do.
>
> - It is a waste to clone skb directly in dsa_skb_tx_timestamp().
>   For one-step timestamping, a clone is not needed. For any failure of
>   port_txtstamp (this may usually happen), the skb clone has to be freed.
>   So put skb cloning into port_txtstamp where it really needs.
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

PTP still works.

Tested-by: Kurt Kanzenbach <kurt@linutronix.de> # hellcreek
```

## Attachments

- [signature.asc](https://ratatoskr.run/linux-doc/2021/04/6343281/attachment/0) (application/pgp-signature, 832 bytes)
