From owner-freebsd-net@FreeBSD.ORG Sat Mar 17 22:11:55 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D48D616A400 for ; Sat, 17 Mar 2007 22:11:55 +0000 (UTC) (envelope-from jdp@polstra.com) Received: from rock.polstra.com (rock.polstra.com [64.119.0.113]) by mx1.freebsd.org (Postfix) with ESMTP id B1FCC13C459 for ; Sat, 17 Mar 2007 22:11:55 +0000 (UTC) (envelope-from jdp@polstra.com) Received: from [10.0.0.64] (adsl-sj-14-253.rockisland.net [64.119.14.253]) (authenticated bits=0) by rock.polstra.com (8.13.8/8.13.8) with ESMTP id l2HMBbQI068069 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Mar 2007 15:11:39 -0700 (PDT) (envelope-from jdp@polstra.com) Message-ID: <45FC6799.2030101@polstra.com> Date: Sat, 17 Mar 2007 15:11:37 -0700 From: John Polstra User-Agent: Thunderbird 1.5.0.10 (Macintosh/20070221) MIME-Version: 1.0 To: Aniruddha Bohra References: <45FA98DD.3080205@cs.rutgers.edu> In-Reply-To: <45FA98DD.3080205@cs.rutgers.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (rock.polstra.com [64.119.0.113]); Sat, 17 Mar 2007 15:11:39 -0700 (PDT) Cc: freebsd-net@freebsd.org Subject: Re: ether_input question X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Mar 2007 22:11:55 -0000 Aniruddha Bohra wrote: > Hi, > In two drivers, fxp and em, the assumptions about entering the > ether_input routine are different. > From em_rxeof: > > #ifdef DEVICE_POLLING > EM_UNLOCK() > (*ifp->if_input)() > EM_UNLOCK() > #else > (*ifp->if_input)() > #endif > > While in fxp: > > FXP_UNLOCK() > (*ifp->if_input)() > FXP_LOCK() > > > My question is : > Does ether_input() assume it is the only thread executing the code? If > it is the case, what is the > reason for dropping the lock in the DEVICE_POLLING case? There is actually no difference between these cases. In the !DEVICE_POLLING case, the em driver does not hold its driver lock when it calls em_rxeof. The call is made from em_handle_rxtx, where you'll see that the driver has not acquired a lock when it calls em_rxeof. Thus, in all cases the if_input function is called without holding the driver lock. John