From owner-freebsd-current@freebsd.org Mon May 22 20:44:08 2017 Return-Path: Delivered-To: freebsd-current@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 33CE9D772B6 for ; Mon, 22 May 2017 20:44:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (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 EEC2910FC for ; Mon, 22 May 2017 20:44:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22a.google.com with SMTP id o5so4871547ith.1 for ; Mon, 22 May 2017 13:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=fZni93DQa3eQKKZWPH71Fa4Dh/ZePUdAsUFd21rYnfc=; b=ebvSfH8tEPrGCuwJW0BgvBQaSdIuM33mU4a182SQ/oJiOCiZgeyswN50/j7wUu5zD2 WfYZ76cJXWofVBqExVp967lg2IiQukVHirZkxmno9pb9sJ6lO7HJCOgqR/pAelRI/e30 m+wqIcKjE5XqIK2Yyq7SiGop5ynuY4niTkyFv0Zzsiyd5sVIOZT97mHbv/eXQOXSBzLL IBSh81QWSMc81g4a6bYrfrVgh5pzt8TtmYuZobx/I7aNb/qZ8HUWW5pbsIXzY3/ue8H0 PSGljActFgUWk0x1oyCLiIhC5T3sh0eFgiFGqR4gXOrejhhxXVkfMTO/bFiZq/T33UfI BIBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=fZni93DQa3eQKKZWPH71Fa4Dh/ZePUdAsUFd21rYnfc=; b=QJR/WnbTU3bX9tXHO9tuWf3k2nGzUe15bIr0ELiuUs4b1mkusQEWxn+yYnz5QRVf0r a1o8H0ht90wV939g/NeC3c90XZ+RIbplZ5tm07LBkeM/9W3CqzgjPFD9Kl3zJ05WlyHX CpElQ74mZRYx6HyhNUr15mOjo3jF9gPScs9T6vB5fCoSuPawddDsCT5Ej+6Yk4vx6PGp dre9yyHrZJscOn0Cfn7Hf4DWh7BuAoigEewnoyvmLgBYWtcSJAhjRTIo/r2ZJQxQkAzk tXOrlYKHQxuyl1XiEduxDG9upBOKyVqqr003UR1u8brIh5VXuEnMidGJF4O2dmue+EBg lvhQ== X-Gm-Message-State: AODbwcBtdSthfT8UxQ7cqL1BrIsWhM1SmZ09ec9RDVy9CZgCIkfPBPhj O5mSu9cq8Xgn3jNvmNk7mGRZALXnY/Ec X-Received: by 10.107.188.132 with SMTP id m126mr26963166iof.148.1495485847298; Mon, 22 May 2017 13:44:07 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Mon, 22 May 2017 13:44:06 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:64b3:7ae1:cf64:fe87] In-Reply-To: <1901874.v6m8jKq4cl@ralph.baldwin.cx> References: <1901874.v6m8jKq4cl@ralph.baldwin.cx> From: Warner Losh Date: Mon, 22 May 2017 14:44:06 -0600 X-Google-Sender-Auth: 3Tao-lAn2txZX5BKMNqP9fQN4_U Message-ID: Subject: Re: [rfc] breaking out if_ath into ... lots of modules To: John Baldwin Cc: FreeBSD Current , Adrian Chadd , "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2017 20:44:08 -0000 On Mon, May 22, 2017 at 2:17 PM, John Baldwin wrote: > On Monday, May 22, 2017 12:29:15 PM Adrian Chadd wrote: > > Hi, > > > > I've been putting this off for a few years, but now I've reached a > > point where I kind of need to do this. > > > > The TL;DR is this - I'd like to break the ath driver /back/ out into > > separate modules, and then have them be run-time loadable. It's part > > for space savings, and part for the upcoming ath10k work where I need > > to reuse the regulatory EEPROM code. > > > > The reason? I can't easily build a modular ath driver without > > compiling in /everything/. For the AR933x/AR934x embedded platforms > > which don't require the previous HAL chipset code, this is almost > > 800kbyte extra binary code in the kernel that doesn't ever get run. > > For earlier boards (say the AR9280 embedded boards), it's roughly > > 600kbyte of AR9300 HAL code that doesn't ever get run. > > > > I have a patchset (which I'll push up soon) which turns if_ath into: > > > > * if_ath - only the driver; > > * (if_ath_pci / if_ath_ahb stay the same); > > * ath_hal - only the shared, global HAL code (osdep routines, HAL > > core, regulatory code); > > * ath_rate - the ath rate control code (either sample, amrr, onoe); > > * ath_dfs - just dfs_null for now, but this will eventually be a radar > detector; > > * ath_hal_{ar5210,ar5211,ar5212,ar5416,ar9300} - the individual chipset > HALs. > > > > Now, I'm thinking of further breaking out ar5416 into > > {ar5416,ar9001,ar9002} just to save space for the embedded builds > > (like AR9103/AR9106 which some people still use) but that can come > > later. > > > > There's no AR2312/AR5312 11abg + MIPS4k core support in FreeBSD, so > > I'll go and look at making the AR5312 wifi support work. That'll > > become another HAL module. > > > > On the regulatory side, I then need to divorce the EEPROM regulatory > > code from ath_hal and turn /it/ into a separate module because, > > surprise, the ath10k 11ac hardware uses the same regulatory code. I'll > > do this particular step later. > > > > What does this mean? > > > > * If you compile up a kernel with everything in it, nothing will > > change - hopefully this is the majority of users; > > * If you compile a modular kernel or embedded platform - you need to > > load ath_hal and the relevant HAL modules before you load if_ath / > > if_ath_pci otherwise it won't find your hardware. > > > > I realise this is a bit of a POLA change, but I'd like to get it into > > -HEAD before FreeBSD-12 is cut. > > Why not have if_ath.ko just be a wrapper module that depends on everything > like dtraceall.ko? That would let 'kldload if_ath' and the auto-loading > code in ifconfig still DTRT. You could name the "only the driver" module > ath.ko or some such. > I like this a lot. There's much magic in places like netstat and people's loader.conf files that this solution would preseve that yours would break. Warner