# Re: \[PATCH v2\] net: mscc: ocelot: add missing lock protection in ocelot\_port\_xmit()

- From: Ziyi Guo \<hidden\>
- Date: 2026-02-08 22:16:12 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/02/3406942
- Thread: https://ratatoskr.run/netdev/2026/01/3395606/t.md

```text
On Sun, Feb 8, 2026 at 7:35 AM Vladimir Oltean
[ref] wrote:
>
> The idea is not bad, but I would move one step further.
>
> Refactor the rew_op handling into an ocelot_xmit_timestamp() function as
> a first preparatory patch. The logic will need to be called from two
> places and it's good not to duplicate it.
>
> Then create two separate ocelot_port_xmit_fdma() and ocelot_port_xmit_inj(),
> as a second preparatory patch.
>
> static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
> {
>         if (static_branch_unlikely(&ocelot_fdma_enabled))
>                 return ocelot_port_xmit_fdma(skb, dev);
>
>         return ocelot_port_xmit_inj(skb, dev);
> }
>
> Now, as the third patch, add the required locking in ocelot_port_xmit_inj().
>
> It's best for the FDMA vs register injection code paths to be as
> separate as possible.


Thanks Vladimir and folks for your time. I'll split it into three
patches as series, and send a v3 version.

Best,
Ziyi
```
