Re: [PATCH net-next v2 1/2] net: mana: introduce helper to get a master netdev

Konstantin Taranov
2024-07-03T09:20:21Z

> > +/* the caller should hold rcu_read_lock */ struct net_device
> > +*mana_get_master_netdev_rcu(struct mana_context *ac, u32 port_index)
> > +{
> > + struct net_device *ndev;
>
> From the comments, this function requires rcu_read_lock. Can the following
> be added in this function?
>
> RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "no rcu read lock held");
>
> If rcu_read_lock is not held, this function will notify the caller.
> This can explicitly ensure that rcu_read_lock should be held before this
> fuction is called.

Thanks! Great idea!

>
> Best Regards,
>
> Zhu Yanjun
>