netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ofa-general] locking requirements when calling dev_set_mtu()
@ 2008-07-02  8:54 Eli Cohen
  2008-07-02 16:41 ` Stephen Hemminger
  2008-07-02 17:15 ` [ofa-general] " Ben Hutchings
  0 siblings, 2 replies; 3+ messages in thread
From: Eli Cohen @ 2008-07-02  8:54 UTC (permalink / raw)
  To: netdev, fubar; +Cc: Roland Dreier, general-list

Hi,

I have the need to change the MTU of IP over IB from the driver code
and not from the shell. Looking for the right way to do it I came
across the dev_set_mtu() which seems appropriate as it handles all
notifications too. However, it is not clear to me whether I have to
wrap the call to dev_set_mtu() with any locks. Specifically, I was
referred to a mail thread that suggests that I have to use
rtnl_lock()/rtnl_unlock():
http://marc.info/?l=linux-netdev&m=121201324611292&w=2

With reference to the above URL, I would say that it is possible for
me to hit to the assertion ASSERT_RTNL() if I don't take rtnl_lock
prior to calling dev_set_mtu(). However I don't hit it, though I can't
count on that there will not be a case that any function registered
for notification would expect to see the lock acquired.

Can someone shed light on this?

Thanks,
Eli

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: locking requirements when calling dev_set_mtu()
  2008-07-02  8:54 [ofa-general] locking requirements when calling dev_set_mtu() Eli Cohen
@ 2008-07-02 16:41 ` Stephen Hemminger
  2008-07-02 17:15 ` [ofa-general] " Ben Hutchings
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2008-07-02 16:41 UTC (permalink / raw)
  To: Eli Cohen; +Cc: netdev, fubar, ogerlitz, Roland Dreier, general-list

On Wed, 2 Jul 2008 11:54:09 +0300
Eli Cohen <eli@dev.mellanox.co.il> wrote:

> Hi,
> 
> I have the need to change the MTU of IP over IB from the driver code
> and not from the shell. Looking for the right way to do it I came
> across the dev_set_mtu() which seems appropriate as it handles all
> notifications too. However, it is not clear to me whether I have to
> wrap the call to dev_set_mtu() with any locks. Specifically, I was
> referred to a mail thread that suggests that I have to use
> rtnl_lock()/rtnl_unlock():
> http://marc.info/?l=linux-netdev&m=121201324611292&w=2
> 
> With reference to the above URL, I would say that it is possible for
> me to hit to the assertion ASSERT_RTNL() if I don't take rtnl_lock
> prior to calling dev_set_mtu(). However I don't hit it, though I can't
> count on that there will not be a case that any function registered
> for notification would expect to see the lock acquired.
> 

You need to call rtnl_lock() so device drivers get consistent locking.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ofa-general] Re: locking requirements when calling dev_set_mtu()
  2008-07-02  8:54 [ofa-general] locking requirements when calling dev_set_mtu() Eli Cohen
  2008-07-02 16:41 ` Stephen Hemminger
@ 2008-07-02 17:15 ` Ben Hutchings
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2008-07-02 17:15 UTC (permalink / raw)
  To: Eli Cohen; +Cc: netdev, Roland Dreier, fubar, general-list

Eli Cohen wrote:
> Hi,
> 
> I have the need to change the MTU of IP over IB from the driver code
> and not from the shell. Looking for the right way to do it I came
> across the dev_set_mtu() which seems appropriate as it handles all
> notifications too. However, it is not clear to me whether I have to
> wrap the call to dev_set_mtu() with any locks. Specifically, I was
> referred to a mail thread that suggests that I have to use
> rtnl_lock()/rtnl_unlock():
> http://marc.info/?l=linux-netdev&m=121201324611292&w=2
[...]

Essentially any function that changes net device configuration requires
the caller to hold the RTNL lock.  This probably ought to be consistently
documented through kernel-doc and/or ASSERT_RTNL() though.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-02 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-02  8:54 [ofa-general] locking requirements when calling dev_set_mtu() Eli Cohen
2008-07-02 16:41 ` Stephen Hemminger
2008-07-02 17:15 ` [ofa-general] " Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).