Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5403739rwb; Wed, 17 Aug 2022 17:22:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5B6kYbr4KjEE55YiJJbMdg6hRezhadZze20FffpAW+F5q9HoQ82HFqmc0baY6sWpb0fRLO X-Received: by 2002:a63:4183:0:b0:41b:f6d3:8825 with SMTP id o125-20020a634183000000b0041bf6d38825mr547110pga.193.1660782169475; Wed, 17 Aug 2022 17:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660782169; cv=none; d=google.com; s=arc-20160816; b=LyD1duis3nbGYGTmRvQhwJtdkMb0Nokm9AgUTixlhkgS2Uyw2A/Fg6skidmbQPGDZz zCF1zvhShlF6hMiiYYohctBo1k5Vz3hy4uOvRkip9eyvx76DRBs8/AwwyZBbRT9Bkduz Tj/BGNSfeTE9QYr6M0N3WBlXJ6kMtacZAgVg1p5gFpJIBeQLW3G63Cim411Mg22B02Kh ePpL2T72vcd4yzs7qCWb5HLxJPwlfHlKIA/0/CsxOPQD1ijOFo+dHKLM6tjuq+rUjaXP OIFDwb74qoyMq1xctSnjFEdyhGfp0gbywlN8uasJDCgSwiiR+Vo2CppLTBiVFS5dMcPv a+2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ku7R+2tnT1/PcWq+UB/v9DdP1lt1rkcxhef05o0ooII=; b=CqSwayxOFWvqTDw0OQ/eGcxpJlvtsL4dSuMhey7wn5eowZcfCwm8YJC6c59lfWTfKh WEiZqah5A2fmV2ankklHdiRQMffnNMCqaY+0R1w+21FiK04zhZDa7goo4ySbkDYg5PXr MkjKnDS3OsjVp5KJ7iW0+EsqvSCU6VvY7u0zEfleSNJk+UhJLxnUsA+ADmi1P8l+guLT N3AdYJcB+iI8ZogxAjmmu1bZsUc/zljv1Fkgv9NHSkF+ID5H7CkSKe6fZt5zX/fQirb/ 7i1KfHpUPFhqq3rSijgokbXGZE4QexfSpkwiBlT5Xq+/FU9FZO1m5oe0fio+/vLcABNw 6BUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HR1nx7iq; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a65694c000000b0041d7e787be6si183650pgq.170.2022.08.17.17.22.36; Wed, 17 Aug 2022 17:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HR1nx7iq; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239767AbiHRAL7 (ORCPT + 65 others); Wed, 17 Aug 2022 20:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233930AbiHRAL6 (ORCPT ); Wed, 17 Aug 2022 20:11:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754F9A2859 for ; Wed, 17 Aug 2022 17:11:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E46ECB81FF4 for ; Thu, 18 Aug 2022 00:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C22FC433C1 for ; Thu, 18 Aug 2022 00:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660781514; bh=Ku7R+2tnT1/PcWq+UB/v9DdP1lt1rkcxhef05o0ooII=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HR1nx7iqPCnyMVmkN3PP/0lGjh1kAJFRWmTF7SZakyggGSK6tCJGiUYmVkdCiCGjN mJw/yLX9vKXxZ8xA2VkZYloqY6VbXlhOLMD0ne5FEgEXjYnkMc0pNQJ7Y0MYxTvvpl j6odjTYic92jT24bXJtUq9zaU+kTKukV/eCQz2jQvs4vwNORYE4Lp4Jd7Hv2f3ejdg BhxcWsGKrjPDTtqIsM7rJwxxTpWtmeS5BU+6sTIA6TT8qyt7pU7ThyPsoMJWxI3JfC 0p3PCvzKTBWakeir3E68CrZ8WuD869ZtaUuIzYxL3bd68hL7EJ6oIzedZ7a4bqRm1t mcLFpwTRJchAg== Received: by mail-wr1-f50.google.com with SMTP id h24so3819616wrb.8 for ; Wed, 17 Aug 2022 17:11:54 -0700 (PDT) X-Gm-Message-State: ACgBeo2mYlJWjfYGrTC8rz8icuiOtDRg+VjepiNH/HY93TbkL/gK2NAz X0xXxUggaFlvEjpj60fC9eMtusDlqwAWv9l5GdI= X-Received: by 2002:adf:d238:0:b0:21e:c972:7505 with SMTP id k24-20020adfd238000000b0021ec9727505mr193529wrh.536.1660781512698; Wed, 17 Aug 2022 17:11:52 -0700 (PDT) MIME-Version: 1.0 References: <473fc7b169f288b7815a7736cf33ac0ec1599a09.1660606893.git.objelf@gmail.com> <5b24421363048bff1a9f03174cb0223b3e226bf9.camel@sipsolutions.net> In-Reply-To: <5b24421363048bff1a9f03174cb0223b3e226bf9.camel@sipsolutions.net> From: Sean Wang Date: Wed, 17 Aug 2022 17:11:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/9] wifi: mac80211: allow enabling chanctx until hw registration To: Johannes Berg Cc: =?UTF-8?B?U2VhbiBXYW5nICjnjovlv5fkupgp?= , Felix Fietkau , lorenzo.bianconi@redhat.com, Soul.Huang@mediatek.com, YN.Chen@mediatek.com, Leon.Yen@mediatek.com, Eric-SY.Chang@mediatek.com, Deren Wu , km.lin@mediatek.com, jenhao.yang@mediatek.com, robin.chiu@mediatek.com, Eddie.Chen@mediatek.com, ch.yeh@mediatek.com, posh.sun@mediatek.com, ted.huang@mediatek.com, Stella.Chang@mediatek.com, Tom.Chou@mediatek.com, steve.lee@mediatek.com, jsiuda@google.com, frankgor@google.com, kuabhs@google.com, druth@google.com, abhishekpandit@google.com, shawnku@google.com, linux-wireless@vger.kernel.org, "moderated list:ARM/Mediatek SoC support" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Johannes, On Wed, Aug 17, 2022 at 1:30 AM Johannes Berg wrote: > > On Wed, 2022-08-17 at 01:28 -0700, Sean Wang wrote: > > Based on mt76 driver logic, alloc_hw would be needed before loading firmware > > because alloc_hw creates an instance of "struct mt76_dev*" the > > firmware loading relies on, > > and so the firmware capabilities cannot be decided before we alloc_hw > > in mt76 driver. > > > > I don't really see why you couldn't change that though? There's no > fundamental reason you need to load the firmware before registering with > mac80211? > It could be changed but it would break the consistency of the current mt76 driver. mt76 driver does the things in the following order - ieee80211_alloc_hw (where an instance of "struct mt76_dev *" would be created) - register bus operation into mt76 core (depending on struct mt76_dev to provide an abstraction layer for mt76 core to access bus) - read chip identifier (depending on bus operation) - load the firmware capabilities (depending on chip identifier) - initialize the hardware .... -ieee80211_register_hw If firmware capability is needed to load before ieee80211_alloc_hw, we need to create kind of similar functions to read chip identifiers and load firmware. I know It may not a strong reason not to change, but if we can support read firmware capabilities after alloc_hw, it provides flexibility to the vendor driver and helps mt7921 look more consistent and save a few changes across different mt7921 bus drivers (mt7921 now supports SDIO, USB, PCIe type driver). > And fundamentally, I'm not even sure how you are achieving a change of I kmemdup the const ops and ieee80211_alloc_hw with the duplicated ops the duplicated ops would be updated by the actual firmware capabilities before ieee80211_register_hw. > the ops - you're meant to point those to a *const* ops, so you need two > versions of the ops, one with and one without chanctx, and point to the > correct one at allocation ... > If you don't like the reason and the way I proposed in the patch, please let me know. I still can move on to the way you suggested here. > johannes