From owner-freebsd-wireless@freebsd.org Tue Sep 8 15:26:46 2015 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4749C9CC62B; Tue, 8 Sep 2015 15:26:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 113151AF5; Tue, 8 Sep 2015 15:26:46 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by ioii196 with SMTP id i196so122225199ioi.3; Tue, 08 Sep 2015 08:26:45 -0700 (PDT) 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=PjEEAJ6MXKlEi8jeDAZuQplNulqmDWvUc6dvu8VLBtY=; b=a9s+v3VsXigsetCb7csWhjcxmGajbZbQ0bzSkJiGdvFsjUhYoCXaXEu9JxuoPeusTg +9sP2u6AZA8CxHql9RGn/ONFb7/R6hgrviCJovSuRZ1TNtZCcE9eelaRREhOS0xO+IVg hMd9pVHB1YryswFlGOvdxUmkEIH+pAJWjW9XjtK+eNbVAH1PsSpQoBN7FTNjl3xEKa2G jy1G6REzz7z5uG7ru7HsMwGUG8s/JumX9tcmj4ql4vcHFlBJZqF/eyQQYc4zcYX8MYVh Up6zikXyxXGsorwPoQj6kHrp9WQA7wnN/hdUptXBlY/SEooLc33IbDsC3OyztbTIDoAh 96+Q== MIME-Version: 1.0 X-Received: by 10.107.13.75 with SMTP id 72mr39721631ion.75.1441726005448; Tue, 08 Sep 2015 08:26:45 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Tue, 8 Sep 2015 08:26:45 -0700 (PDT) In-Reply-To: <20150908152233.GV1023@glebius.int.ru> References: <20150908152233.GV1023@glebius.int.ru> Date: Tue, 8 Sep 2015 08:26:45 -0700 X-Google-Sender-Auth: BeLM1sfX_R_hxFYAwlUTotdWfIw Message-ID: Subject: Re: more net80211 changes :/ From: Adrian Chadd To: Gleb Smirnoff , "freebsd-wireless@freebsd.org" Cc: Andriy Voskoboinyk , "net@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 15:26:46 -0000 I'm fine with this. The main odd-ball here is iwm(4) that requires interrupts to be up before the NIC is initialised (firmware), and it will do firmware loading and commands before you can get the MAC which is required for attach. Flesh it out a bit more with iwm(4) and I'll take a look at the results. :) Thanks! -adrian On 8 September 2015 at 08:22, Gleb Smirnoff wrote: > Hi! > > It looks like another sweep over net80211 drivers is required. It isn't > going to be as huge as previous one. > > The problem is that in the "new world order", there will be only if_attach(), > instead of if_alloc() / fill & hack / ether_ifattach. What right now happens > with net80211 is that all drivers have the same copy & paste in their > ic_vap_create, which yields in a sequence of: > > - if_alloc > - driver specific code > - ether_ifattach > > Which isn't possible to collapse into if_attach(), since driver code is > in the middle. > > Another problem is embedding if ieee80211_vap into driver's softc. This > is a bad habit, which was proved by ifnet experience (fixed decade ago). > > What patch does: > > - Inline ieee80211_vap_setup() and ieee80211_vap_attach() into wlan_clone_create(). > Note, that this moves code from ieee80211.c to into ieee80211_freebsd.c, > which is good, since this code about interaction with ifnet layer, which > is FreeBSD specific and will be more FreeBSD specific. > As dependency ifmedia support code and ieee80211_get_counter() also naturally > move to the same file. > > - In the new long wlan_clone_create(), after initial error checking call > ic_vap_preattach() to allow driver do its own error checking. I predict > that for now ath(4) will be the only driver to use ic_vap_preattach(). > > - If no errors, go with allocating and attaching the interface, and then > call ic_vap_postattach. > > - The ic_vap_postattach() for all drivers (save ath) would be remnants > of ic_vap_create(), where all copy and paste is removed and only driver > specific bits remain. > > - ic_vap_postattach() may allocate driver specific softc for vap, which > now longer has ieee80211_vap embedded. > > This also removes all ambiguities with mac address handling, which was > juggled between three functions before. > > The current patch covers iwn(4) only. Now sending this mail with patched > driver. Changing MAC aldo tested - works. > > I'm starting to convert rest of drivers and meanwhile, waiting for your > input. May be you have ideas what else can be improved here. > > -- > Totus tuus, Glebius.