From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 29 12:54:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CAC8D16A4CE for ; Wed, 29 Oct 2003 12:54:08 -0800 (PST) Received: from serl.cs.colorado.edu (serl-fs.cs.colorado.edu [128.138.242.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B7F343FBD for ; Wed, 29 Oct 2003 12:54:06 -0800 (PST) (envelope-from John.Giacomoni@colorado.edu) Received: from colorado.edu (localhost [127.0.0.1]) by serl.cs.colorado.edu (8.12.9/8.12.6) with ESMTP id h9TKrviQ015470 for ; Wed, 29 Oct 2003 13:53:58 -0700 (MST) Date: Wed, 29 Oct 2003 13:53:56 -0700 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; charset=US-ASCII; format=flowed From: John Giacomoni To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <03723039-0A52-11D8-8B79-0003930719D8@colorado.edu> X-Mailer: Apple Mail (2.552) Subject: Which mutex to lock when accessing a "struct ifnet*" ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2003 20:54:08 -0000 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 _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