From owner-freebsd-drivers@FreeBSD.ORG Wed May 16 18:56:45 2012 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6BBF106566C; Wed, 16 May 2012 18:56:45 +0000 (UTC) (envelope-from david.somayajulu@qlogic.com) Received: from db3outboundpool.messaging.microsoft.com (db3ehsobe004.messaging.microsoft.com [213.199.154.142]) by mx1.freebsd.org (Postfix) with ESMTP id 33A4F8FC15; Wed, 16 May 2012 18:56:44 +0000 (UTC) Received: from mail70-db3-R.bigfish.com (10.3.81.249) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 14.1.225.23; Wed, 16 May 2012 18:41:25 +0000 Received: from mail70-db3 (localhost [127.0.0.1]) by mail70-db3-R.bigfish.com (Postfix) with ESMTP id 6FE041E04AC; Wed, 16 May 2012 18:41:25 +0000 (UTC) X-SpamScore: -1 X-BigFish: VPS-1(zzc85fh14ffIzz1202hzz8275bh8275dhz2fh2a8h668h839hd25h) X-Forefront-Antispam-Report: CIP:198.70.193.61; KIP:(null); UIP:(null); IPV:NLI; H:avexcashub1.qlogic.com; RD:avexcashub1.qlogic.com; EFVD:NLI Received-SPF: pass (mail70-db3: domain of qlogic.com designates 198.70.193.61 as permitted sender) client-ip=198.70.193.61; envelope-from=david.somayajulu@qlogic.com; helo=avexcashub1.qlogic.com ; 1.qlogic.com ; Received: from mail70-db3 (localhost.localdomain [127.0.0.1]) by mail70-db3 (MessageSwitch) id 1337193683554175_9568; Wed, 16 May 2012 18:41:23 +0000 (UTC) Received: from DB3EHSMHS006.bigfish.com (unknown [10.3.81.249]) by mail70-db3.bigfish.com (Postfix) with ESMTP id 82CFB10026E; Wed, 16 May 2012 18:41:23 +0000 (UTC) Received: from avexcashub1.qlogic.com (198.70.193.61) by DB3EHSMHS006.bigfish.com (10.3.87.106) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 16 May 2012 18:41:22 +0000 Received: from avexmb1.qlogic.org ([fe80::9545:3a4f:c131:467d]) by avexcashub1.qlogic.org ([::1]) with mapi; Wed, 16 May 2012 11:41:26 -0700 From: David Somayajulu To: "freebsd-net@freebsd.org" , "freebsd-current@freebsd.org (freebsd-current@FreeBSD.org)" , "freebsd-drivers@freebsd.org" Date: Wed, 16 May 2012 11:41:25 -0700 Thread-Topic: Ethernet Drivers: Question on ifp->if_ioctl invocation for SIOCADDMULTI and SIOCDELMULTI Thread-Index: Ac0zkCqD5TmECMzeQBqgnK1AAFmspg== Message-ID: <75E1A2A7D185F841A975979B0906BBA67C7A229F49@AVEXMB1.qlogic.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-OriginatorOrg: qlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "davidcs@FreeBSD.org" Subject: Ethernet Drivers: Question on ifp->if_ioctl invocation for SIOCADDMULTI and SIOCDELMULTI X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2012 18:56:46 -0000 Hi All, When ifp->if_ioctl() is invoked for the ioctl cmd SIOCADDMULTI, IN_MULTI_LOCK() is called in one of the functions in_joingroup() in the ca= ller stack. >From netinet/in_var.h, line 357 : #define IN_MULTI_LOCK() mtx_lock= (&in_multi_mtx) >From netinet/in_mcast.c 1098 in_joingroup(struct ifnet *ifp, const struct in_addr *gina, 1099 /*const*/ struct in_mfilter *imf, struct in_multi **pinm) 1100 { 1101 int error; 1102 1103 IN_MULTI_LOCK(); 1104 error =3D in_joingroup_locked(ifp, gina, imf, pinm); 1105 IN_MULTI_UNLOCK(); 1106 This is also the case for SIOCDELMULTI, where the function holding "in_mul= ti_mtx" lock is in_leavegroup() This poses a problem in the driver in that the hardware dependent function = performing it, is not allowed to sleep() in case it needs to poll some sta= te. Question: 1. If I want to implement any delays - for the above case - in the dr= iver using DELAY(usec) macro, is there a maximum amount of time that the dr= iver is allowed to complete this function? I am concerned that if it takes = to too long I might run into a soft_lockup() situation. 2. Is it o.k to defer the processing in a separate in a separate thre= ad which can sleep() ? Thanks David S. ________________________________ This message and any attached documents contain information from QLogic Cor= poration or its wholly-owned subsidiaries that may be confidential. If you = are not the intended recipient, you may not read, copy, distribute, or use = this information. If you have received this transmission in error, please n= otify the sender immediately by reply e-mail and then delete this message. From owner-freebsd-drivers@FreeBSD.ORG Thu May 17 15:00:42 2012 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2DDE4106564A; Thu, 17 May 2012 15:00:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id F32708FC18; Thu, 17 May 2012 15:00:38 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3FB1EB94E; Thu, 17 May 2012 11:00:38 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Thu, 17 May 2012 10:33:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <75E1A2A7D185F841A975979B0906BBA67C7A229F49@AVEXMB1.qlogic.org> In-Reply-To: <75E1A2A7D185F841A975979B0906BBA67C7A229F49@AVEXMB1.qlogic.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201205171033.37636.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 17 May 2012 11:00:38 -0400 (EDT) Cc: "freebsd-net@freebsd.org" , "freebsd-current@freebsd.org \(freebsd-current@FreeBSD.org\)" , "davidcs@FreeBSD.org" Subject: Re: Ethernet Drivers: Question on ifp->if_ioctl invocation for SIOCADDMULTI and SIOCDELMULTI X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 15:00:42 -0000 On Wednesday, May 16, 2012 2:41:25 pm David Somayajulu wrote: > Hi All, > When ifp->if_ioctl() is invoked for the ioctl cmd SIOCADDMULTI, > > > > IN_MULTI_LOCK() is called in one of the functions in_joingroup() in the caller stack. > > > > >From netinet/in_var.h, line 357 : #define IN_MULTI_LOCK() mtx_lock(&in_multi_mtx) > > > > >From netinet/in_mcast.c > 1098 in_joingroup(struct ifnet *ifp, const struct in_addr *gina, > 1099 /*const*/ struct in_mfilter *imf, struct in_multi **pinm) > 1100 { > 1101 int error; > 1102 > 1103 IN_MULTI_LOCK(); > 1104 error = in_joingroup_locked(ifp, gina, imf, pinm); > 1105 IN_MULTI_UNLOCK(); > 1106 > > This is also the case for SIOCDELMULTI, where the function holding "in_multi_mtx" lock is in_leavegroup() > > This poses a problem in the driver in that the hardware dependent function performing it, is not allowed to sleep() in case it needs to poll some state. > > Question: > > 1. If I want to implement any delays - for the above case - in the driver using DELAY(usec) macro, is there a maximum amount of time that the driver is allowed to complete this function? I am concerned that if it takes to too long I might run into a soft_lockup() situation. > > 2. Is it o.k to defer the processing in a separate in a separate thread which can sleep() ? You can always queue a task to update the MAC table if you need to use a sleep. -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Sat May 19 21:19:20 2012 Return-Path: Delivered-To: drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D5A9106564A for ; Sat, 19 May 2012 21:19:20 +0000 (UTC) (envelope-from apache@s15434952.onlinehome-server.info) Received: from s15434952.onlinehome-server.info (s15434952.onlinehome-server.info [82.165.150.156]) by mx1.freebsd.org (Postfix) with ESMTP id 1FDFA8FC14 for ; Sat, 19 May 2012 21:19:20 +0000 (UTC) Received: from s15434952.onlinehome-server.info (unknown [127.0.0.1]) by s15434952.onlinehome-server.info (Postfix) with ESMTP id EA0F88C4BA2 for ; Sat, 19 May 2012 21:18:25 +0000 (UTC) Received: by s15434952.onlinehome-server.info (Postfix, from userid 48) id 00FE38D42DD; Sat, 19 May 2012 21:16:34 +0000 (UTC) To: drivers@freebsd.org From: Sgt Larry Wayne MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit Message-Id: <20120519211635.00FE38D42DD@s15434952.onlinehome-server.info> Date: Sat, 19 May 2012 22:16:35 +0100 (BST) Cc: Subject: Read Now X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: larrywn917@mail.com List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 21:19:20 -0000 Hello, My name is Staff Sergeant Larry Wayne with a desperate need for an mutual business proposal that will benefit both of us, I have been lucky enough to come about some cash here in Afghanistan and i want to work with you to ship it out of this country and invest my own share into lucrative business with your advise and assistance, please get back to me if you are interested to hear Sgt Larry Wayne