netdev_set_master question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings everyone,

I'm pretty new to Linux network programming.  I've written a few device
drivers but never looked into the networking core before.  Now I am
desiging a multiplexing driver (a bit like the bridge driver, but
upside-down: it will have one slave device and present multiple devices on
the top side).  I have a question about the following part of 
netdev_set_master() ...

1869  br_write_lock_bh(BR_NETPROTO_LOCK);
1870  slave->master = master;
1871  br_write_unlock_bh(BR_NETPROTO_LOCK);
1872
1873  if (old)
1874          dev_put(old);
1875
1876  if (master)
1877        slave->flags |= IFF_SLAVE;
1878  else
1879        slave->flags &= ~IFF_SLAVE;

Should the write to slave->flags be guarded by the same lock as the
write to slave->master?  If no, why not?

Is there documentation somewhere that explains the major locks in the
networking code (RTNL, BR_NETPROTO_LOCK, dev_hold(), what else?), or do
you guys enjoy explaining it to every newbie who wanders in here? ;-)  
I've googled but all I get is mountains of patches!

Thanks in advance.

-- 
Dan Eble <dane@aiinet.com>  _____  .
                           |  _  |/|
Applied Innovation Inc.    | |_| | |
http://www.aiinet.com/     |__/|_|_|

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux