[net-next v14 06/12] net: mtip: Add net_device_ops functions to the L2 switch driver

Lukasz Majewski lukma at denx.de
Wed Jul 9 03:08:16 PDT 2025


Hi Paolo,

> On 7/1/25 1:49 PM, Lukasz Majewski wrote:
> > +static netdev_tx_t mtip_start_xmit_port(struct sk_buff *skb,
> > +					struct net_device *dev,
> > int port) +{
> > +	struct mtip_ndev_priv *priv = netdev_priv(dev);
> > +	struct switch_enet_private *fep = priv->fep;
> > +	unsigned short status;
> > +	struct cbd_t *bdp;
> > +	void *bufaddr;
> > +
> > +	spin_lock(&fep->hw_lock);  
> 
> mtip_start_xmit_port() runs with BH disabled. The above lock variant
> is inconsistent with what you use in patch 4.

I've looked into the fec_main.c driver. They use for TX path
__netif_tx_lock(nq, cpu); which is a simple spin_lock(). I've followed
the same approach (as _irqsave() seems to be an overkill).

This function (mtip_start_xmit_port()) is call as a callback from:
.ndo_start_xmit (member of struct net_device_ops).

IIRC net core code provides locking on this call anyway.

> Please be sure to run
> tests vs the next iteration with CONFIG_PROVE_LOCKING enabled.

This is already enabled. Locking in this driver is a bit special, as
one uDMA is used for both ports... (unlikely as in fec_main.c).

> 
> /P
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Johanna Denk,
Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194
Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250709/ac12929d/attachment.sig>


More information about the linux-arm-kernel mailing list