Re: git: 0f7b9777f8f3 - main - rtw88: split driver up into a core and pci part
Date: Mon, 13 Jun 2022 17:37:31 UTC
On Mon, 13 Jun 2022, Warner Losh wrote: > On Mon, Jun 13, 2022, 8:28 AM John Baldwin <jhb@freebsd.org> wrote: > >> On 6/12/22 11:43 AM, Bjoern A. Zeeb wrote: >>> The branch main has been updated by bz: >>> >>> URL: >> https://cgit.FreeBSD.org/src/commit/?id=0f7b9777f8f39fbc230b3e1de2f844d9f839adea >>> >>> commit 0f7b9777f8f39fbc230b3e1de2f844d9f839adea >>> Author: Bjoern A. Zeeb <bz@FreeBSD.org> >>> AuthorDate: 2022-06-12 18:35:58 +0000 >>> Commit: Bjoern A. Zeeb <bz@FreeBSD.org> >>> CommitDate: 2022-06-12 18:35:58 +0000 >>> >>> rtw88: split driver up into a core and pci part >>> >>> Split the driver up into two modules (if_rtw88_pci.ko and >> rtw88_core.ko). >>> This is in preparation for the hopefully eventually upcoming USB >> support >>> using the same driver core. >>> >>> Note: this changes the module name to load to if_rtw88_pci.ko >> instead of >>> if_rtw88.ko. If using devmatch(8) everything should stay the same >> as >>> the driver name (used for net.wlan.devices) stays rtw88. If using >>> kld_list in rc.conf or loader.conf you will need to adjust the name. >>> Update man page for this. >>> >>> MFC after: 3 days >> >> This sort of split in a .ko is kind of rare for drivers in the tree that >> support >> multiple bus attachments. Usually we just lump all the attachments into >> the same >> .ko. It's true that with the death of ISA, etc. we no longer have as many >> drivers >> with multiple bus attachments, but the norm has been to include them all >> in a >> single .ko. Is there a reason you can't follow the normal practice here? I am not oppsed to one big blob but I wonder if it is "normal practise" these days? I honestly didn't think much beyond PCI is in PCI and USB load where I plug USB in but I couldn't think of many times having both and more code exposure than needed. So you made me go and think a bit about it and look into it: rtwn(4) is split up as "predecessor"; probably also influenced my above thinking. Upstream has this one written in a way that it can be split up natively between buses. In theory I this could be split up into even per-chipset mostly apart from "core" and then one could even start bundling chipset+fw together as an entity but that didn't seem like "common practise". I think the main argument is that this isn't just a few lines of bus attachment but larger parts of the driver (PCI vs. USB to come) given the PCI per-chipset files contain tables etc. and is way bigger than the actual common code (and USB will be fairly small I believe). -r-xr-xr-x 1 root wheel 308536 Jun 13 13:33 /boot/kernel/rtw88_core.ko -r-xr-xr-x 1 root wheel 998712 Jun 13 13:33 /boot/kernel/if_rtw88_pci.ko And I don't neccessarily want to pull in two bus dependencies into the same driver even if that seems the historical way of thinking; "MINIMAL" is still a goal we once set out for and a way of thinking and autoloading does sort things out these days without users having to fiddle anything in the default case. Why do I need to load 1M file for PCI on a machine w/o PCI? Why do we have separate parts for ACPI vs. FDT? Why don't we have NTB support for AMD and Intel and ... together in one .ko? Why is mac-* not one module? Why are geom part implementations not one, or why are congestion control protocols, or ipfw modules separate? Why do I not get Panasonic, Fujitsu, Toshiba and HP ACPI modules on my Thinkpad (even same bus attachments)? Or why do we not put all firmware blobs for the same driver in one file (given firmware 9 can)? Because there is no point in loading 12 firmware images into memory when 1 suffices? Isn't it actually more common to put things apart these days for various reasons? I'd tend to argue that time has moved on and making things self-contained smaller and simpler is a good thing in a too complex world. > Agreed. Furthermore, in the past when a couple of drivers did the we had > issues and confusion. Please don't MFC until this discussion is done. Sure, I'll hold off on that. And given I've been pondering the current state ... could someone please enlighten me on those past issues? I am actually keen to hear them as I have a feeling they might change my entire way of thinking about the current view for a good reason. /bz -- Bjoern A. Zeeb r15:7