From owner-freebsd-net@FreeBSD.ORG Fri Dec 13 21:52:45 2013 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95306F9; Fri, 13 Dec 2013 21:52:45 +0000 (UTC) Received: from mail-qa0-x229.google.com (mail-qa0-x229.google.com [IPv6:2607:f8b0:400d:c00::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 442E81170; Fri, 13 Dec 2013 21:52:45 +0000 (UTC) Received: by mail-qa0-f41.google.com with SMTP id j5so1207471qaq.14 for ; Fri, 13 Dec 2013 13:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=nwi2xysP+AaPzZd6A2D1DacmW5GmBVPEBslIwcLN4sk=; b=kNSwebv1n7DtXvKtOBeyYAAbquo4JehcxpT6AaChO7NhKNximH5VGYPqn6ibrTcf+v iOReZG3POPh+IkZ4akNOe4v5ytndan55SDBHGnSCn1ORtm21DuValmhcb3oiQqilIiyi MlR2v8O2uCWaoOFDdN1d6PRwYuA++4u0KPc17Hz8vlGjJ4J/Nuqma6L6h8u80vHkMZx5 EeRb7txyPx6yP17x3/R8j2gze88h19pvn3MYrJc6XHf+k5I+8X2Pw8hfuvVEBNXq31w/ ri30a1zlFu5n0Naa0j4rY4mBK477gPj0pVqZvzWG3MewAwfM7kNnVGEOi1BZz/3LKfrD JmpA== MIME-Version: 1.0 X-Received: by 10.224.89.73 with SMTP id d9mr8814196qam.5.1386971564414; Fri, 13 Dec 2013 13:52:44 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Fri, 13 Dec 2013 13:52:44 -0800 (PST) In-Reply-To: <20131213212430.GA80282@onelab2.iet.unipi.it> References: <20131213212430.GA80282@onelab2.iet.unipi.it> Date: Fri, 13 Dec 2013 13:52:44 -0800 X-Google-Sender-Auth: 7PmzL_AOrB2iBaP2CBWLSlebWyo Message-ID: Subject: Re: IFF_DRV_OACTIVE handling in *_stop() for intel nic drivers ? From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: Jack F Vogel , "net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 21:52:45 -0000 ... OACTIVE by design is racy. We should just not be using it in newer drivers. I think the correct thing to do is to just plain ignore setting it ever. -a On 13 December 2013 13:24, Luigi Rizzo wrote: > I am trying to make sense of what is the intended handling of > if_drv_flags in the *_stop() and *_init() routines for the > intel nic drivers and i see three different patterns (below). > I think the correct one is ixgbe.c which leaves IFF_DRV_OACTIVE alone, > although one could argue that IFF_DRV_OACTIVE should be cleaned > up just in case (as done in if_lem.c). > What really seems wrong is setting the flag in the _stop() > function as it is done in if_em.c and if_igb.c . > > So which one should we pick ? > > cheers > luigi > > if_lem.c > lem_stop() > ... > /* Tell the stack that the interface is no longer active */ > ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > > lem_init_locked() > ... (near the end) > ifp->if_drv_flags |= IFF_DRV_RUNNING; > ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > > > if_em.c > em_stop() > ... > /* Tell the stack that the interface is no longer active */ > ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > ifp->if_drv_flags |= IFF_DRV_OACTIVE; > > em_init_locked() > ... (near the end) > /* Set the interface as ACTIVE */ > ifp->if_drv_flags |= IFF_DRV_RUNNING; > ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > > if_igb.c > igb_stop() > ... > /* Tell the stack that the interface is no longer active */ > ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > ifp->if_drv_flags |= IFF_DRV_OACTIVE; > > igb_init_locked() > ... (near the end) > ifp->if_drv_flags |= IFF_DRV_RUNNING; > ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > > ixgbe.c > ixgbe_stop() > ... > /* Let the stack know...*/ > ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > > ixgbe_init_locked() > ... (at the very end) > /* Now inform the stack we're ready */ > ifp->if_drv_flags |= IFF_DRV_RUNNING; > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"