Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Oct 2003 13:53:56 -0700
From:      John Giacomoni <John.Giacomoni@colorado.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Which mutex to lock when accessing a "struct ifnet*" ?
Message-ID:  <03723039-0A52-11D8-8B79-0003930719D8@colorado.edu>

next in thread | raw e-mail | index | archive | help

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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?03723039-0A52-11D8-8B79-0003930719D8>