From owner-freebsd-current@freebsd.org Mon May 22 19:29:18 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 5DCC8D781C3; Mon, 22 May 2017 19:29:18 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (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 EB9561A59; Mon, 22 May 2017 19:29:17 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr0-x235.google.com with SMTP id l50so44382543wrc.3; Mon, 22 May 2017 12:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=fRko37wv6ABCVwMhFF6X/sU93qzX/tIAwxJoTpvnrp0=; b=LvQb7mBWy4IZ05lzFyag91RUKebAtDJCFD49eP03606GdpgUByGXBZbyolcrLptYS1 K2FoZroyWOdlNSCbQinYNc4LF0hbhn8HKHfiVolhuzhjYKyjC2gZzku5GFpEYrUg5j5w ztRuKQ9aKalVrCmWX7sM38/O2Y4IrmdNoXB5sWKuiSmshjNiBJGcE8zUt30tjUPBKk76 g+TmkZ8ZmBZgW9eWM2lUAWBiejWzRXAqEeVmFWjV9stQcolySc23SJuO2klKDLeyS0er avXEUxzwQiAPTtYnF/NSrg+LVRdbHcNlo7tzQDRPlkDco1/jUkVPSSBjY1m6Viq1D62N 7Tvw== 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:from:date:message-id:subject :to; bh=fRko37wv6ABCVwMhFF6X/sU93qzX/tIAwxJoTpvnrp0=; b=D08Fv6GT0d4fBbnZfQLPH22+wN0C31TO4sjSsgAdOuHc4zMsJrK7gbma7cwxh/8wkm Ne1jUQXqIWQWyGNQJqOhGKJAl/U7/LmLww2ykhI5B5p92j2nkkftulwKGgu0ow7O8m02 kv2MHeZS+XkMH2FKrGT/ALVvCq1viSfPUvENQTK5mDvJlqf/dnCOuqA6htfx22nBT0tE D1vL2iGwWVoJwGDNTih366XuNCsWlp7Gg1AJl9G8LXmJnmbSzUWNWFXcQ7KKIuYBdYYe T6PG5cnxzjZA6IEG9tEsaMP6xAxY5ZYLgWtfIi3ZeRN4Nh2pH3fA/02rtAWLpGW8rD+F 6ZuA== X-Gm-Message-State: AODbwcAfK/tPVX1qk7+z8LelDvY+87SSKJ539cYnZRbv1r/5UiPeswHG lecGuToPFdYFIXy3WG3AupnkUaXgnK6Z X-Received: by 10.223.134.80 with SMTP id 16mr14969019wrw.62.1495481355834; Mon, 22 May 2017 12:29:15 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.28.193.134 with HTTP; Mon, 22 May 2017 12:29:15 -0700 (PDT) From: Adrian Chadd Date: Mon, 22 May 2017 12:29:15 -0700 X-Google-Sender-Auth: 2i8jdfJTTPAcNiVt_N2d1Jb9WDg Message-ID: Subject: [rfc] breaking out if_ath into ... lots of modules To: "freebsd-wireless@freebsd.org" , freebsd-current Content-Type: text/plain; charset="UTF-8" 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 19:29:18 -0000 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. Thanks! -adrian