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.