From nobody Tue Jan 7 18:01:50 2025 X-Original-To: freebsd-wireless@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YSJll21PMz5kwBs for ; Tue, 07 Jan 2025 18:01:55 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YSJll1QwFz4gpv; Tue, 7 Jan 2025 18:01:55 +0000 (UTC) (envelope-from bz@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736272915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mUelUH8HM24QwgWLw8Lrr9PR4ethPmQzDZAfws/l9qY=; b=Tpxy/jOP4AmQQ5x8sT8S4joTJa5giD1LJ9GW6LWDLp3R6yfklQlzCFE/1nrQHwX1WAtw9m YtC7PeZAD6wX/88JYB1snrk/S2disE3bq+32SlRgVjROBtlptxKfGX6a8OFDRDQ7fY+aPT sEP0zn0PW2d7AMwO0ju1ijwOa76Z3fzKMktiR7khvomS9R7KpgBz0bVym0bZxgp/0zO+pO g5X0LicQ0XW+qEHUH4OR/y0gVc9fX3S4vOdcCpAPUQeKzrp28riQlSbAeT8CNqIDmp4erl cQwPi3PH1KvFKZ0XQfxj//SATBRzBQxTneocDVWqVGyxmYqOIKMw1FMJf8LcdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736272915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mUelUH8HM24QwgWLw8Lrr9PR4ethPmQzDZAfws/l9qY=; b=MKEbv8f6zhvzaXRlWl4LXFMYaX1JOc/m7DL1FpO8OZhxv6A0eiB3CX6f034P58zP3FbJfw u+JGopNhW/XXMM6BgPPPhnOJREpSMMY/rZYr76/0EDfJqOyPpT+Ssoku7nTip6LFK/vViU EafSeE+6vkZiF80luW9qkNE02BAjwWOcSsyQowQd5DHHYChiSYCq1L5m9UneEdlj1Js2dE IbozezEakWK0laLS7X9YZui6eJaiJX50RUJ8+mTAgMW4qEUE2rQ2ypYIyz7Ge+ZIZod7jC O6qh8jO7Z9NXKfmkXCo1Qd3dVTpE28mOBKyqjsUQ3WzfWUFosNJhsFjWKvB3Ow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736272915; a=rsa-sha256; cv=none; b=WL6pIQrcV4g+SeG/X5FKxdXKvjx96l2xcBWjCx0e2TmQXWLrwizzB7H4QOW9inT/LIskLI jFoC/tKqs9Pxk5gQlqLPnNq1ZM8nSffXbQ2VRNbSrP+SF61WUCgcUxlXVpeMdZIILTKUOd G67wSP1uZeeVgsqY1u62O0gJ8ZZ5DR/GcTUt3MDIrlWam5RKbAm7UOErQweSvQxo+6NuD3 51RIWaqFZ5VPGdHVMQXBkJmTt8NBYvuK+DkUQ3UGVhmnMQewwKauENEg2BQofNBOKHeGi8 IXTVxPTJdIydRycpjaJ/oWcsPJiX1uuWHK0k0/enoRkPbTCoeJlsKkAYEOfUGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E6" (verified OK)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YSJlk73cHz3Jk; Tue, 07 Jan 2025 18:01:54 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id AC92FA64805; Tue, 07 Jan 2025 18:01:46 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 10DB82D029DD; Tue, 7 Jan 2025 18:01:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id IX8PVMcqWxBf; Tue, 7 Jan 2025 18:01:52 +0000 (UTC) Received: from strong-aiccu0.sbone.de (strong-aiccu0.sbone.de [IPv6:fde9:577b:c1a9:f491::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id DE2672D029D8; Tue, 7 Jan 2025 18:01:51 +0000 (UTC) Date: Tue, 7 Jan 2025 18:01:50 +0000 (UTC) From: "Bjoern A. Zeeb" To: Adrian Chadd cc: freebsd-wireless Subject: Re: net80211 channel cleanup - IEEE80211_IS_CHAN_DEFINED() / IEEE80211_IS_CHAN_ANYC() In-Reply-To: Message-ID: <2846qs8s-3503-s299-1158-sppp2r312293@serrofq.bet> References: <322ss8n1-1334-8s6q-85s9-80nsns73724q@SerrOFQ.bet> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Discussions List-Archive: https://lists.freebsd.org/archives/freebsd-wireless List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-wireless@freebsd.org Sender: owner-freebsd-wireless@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Fri, 27 Dec 2024, Adrian Chadd wrote: > On Thu, 26 Dec 2024 at 22:58, Bjoern A. Zeeb wrote: > >> On Sat, 21 Dec 2024, Adrian Chadd wrote: >> >>> hi! >>> >>> i've started on the bare minimum to start cleaning up the way we handle >>> channels in net80211. The first part - no matter what direction we >>> eventually DO go - is to try and remove all of the direct pointer >>> comparisons and dereferences that are going on. >>> >>> So along this topic, i've created a diff to demonstrate a couple of those >>> cases: >>> >>> https://reviews.freebsd.org/D48172 >>> >>> Specifically: >>> >>> * IEEE80211_IS_CHAN_DEFINED() returns true if the channel isn't null; and >> >> I am sceptical about this one; see further below. >> >> >>> * IEEE80211_IS_CHAN_ANYC() returns true if the channel is the "any >> channel" >>> channel (ie IEEE80211_CHAN_ANYC). >> >> I would suggest to keep the IEEE80211_CHAN_ prefix and insert the IS >> after that: IEEE80211_CHAN_IS_ANYC() >> > > ok, why's that? All of the other mcaros are IEEE80211_IS_CHAN_xxx(). > (I don't mind renaming it, I'm just curious why!) Grml. Yes. So be it. The flags are all IEEE80211_CHAN_* and it would've been nice to have the common prefix for all channel stuff but history... >> There are also plain "ANY" (no C) cases which should also be covered but >> they fit even less into this scheme. >> > > Which ones? I want to make sure those get covered too. I just grepped and didn't go through them anymore in drivers ... There seem to be two halfs in this output unintenionally nicely ordered ;-) sys/dev/bwi/bwiphy.c: if (chan == IEEE80211_CHAN_ANY) sys/dev/bwi/bwirf.c: rf->rf_curchan = IEEE80211_CHAN_ANY; sys/dev/bwi/bwirf.c: if (chan == IEEE80211_CHAN_ANY) sys/dev/bwi/bwirf.c: if (chan == IEEE80211_CHAN_ANY) { sys/dev/ral/rt2560.c: KASSERT(chan != 0 && chan != IEEE80211_CHAN_ANY, ("chan 0x%x", chan)); sys/dev/ral/rt2661.c: KASSERT(chan != 0 && chan != IEEE80211_CHAN_ANY, ("chan 0x%x", chan)); sys/dev/ral/rt2860.c: if (chan == 0 || chan == IEEE80211_CHAN_ANY) sys/dev/usb/wlan/if_rum.c: if (chan == 0 || chan == IEEE80211_CHAN_ANY) sys/dev/usb/wlan/if_run.c: if (chan == 0 || chan == IEEE80211_CHAN_ANY) sys/dev/usb/wlan/if_upgt.c: if (channel == 0 || channel == IEEE80211_CHAN_ANY) { sys/dev/usb/wlan/if_ural.c: if (chan == 0 || chan == IEEE80211_CHAN_ANY) sys/dev/usb/wlan/if_zyd.c: if (chan == 0 || chan == IEEE80211_CHAN_ANY) { -- Bjoern A. Zeeb r15:7