Which mutex to lock when accessing a "struct ifnet*" ?

John Giacomoni John.Giacomoni at colorado.edu
Wed Oct 29 12:54:08 PST 2003


I'm writing some code which examines the the state of a "struct ifnet*"
as returned by "ifunit".

In what situations is it possible for the "struct <foo>_softc"
to be deleted taking it's "struct ifnet" with it?
Does it never go away?

I assume it is possible for the structure to go away given
support for pcmcia cards.

Is Giant the correct lock as suggested by the /usr/src/sys/net/bpf.c
(when it calls ifpromisc) to protect against this occurrence?
doesn't seem right as my understanding is Giant is being eliminated.

The other assumption would be struct ifnet's own mutex but there
would be a race to locking it after one gets a reference to it
(via ifunit).

Ideas?

thanks

John G


--

University of Colorado at Boulder          John.Giacomoni at colorado.edu
Department of Computer Science                     phone: 303.492.8115
Engineering Center, ECCS 121                              303.492.7906
430 UCB                                            fax:   303.492.2844
Boulder, CO 80303-0430
USA



More information about the freebsd-hackers mailing list