Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp294302pxb; Thu, 13 Jan 2022 06:53:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx86Z3wvalXF/F837XwqafnHe7/0n5ted/WiRCInKmE87pT+XtG/RWGtU5fBb8vIx/4emAN X-Received: by 2002:a17:90b:1e07:: with SMTP id pg7mr5557581pjb.228.1642085591292; Thu, 13 Jan 2022 06:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642085591; cv=none; d=google.com; s=arc-20160816; b=V/RM2ZRH8RJiHrBNA35QG/3ewFEkPUsyx0B5xCOPtK7edXQyGF/Y+jlbQzM/ggyGgt duB7y+copx+zYWAx9RAzbFTcBCNw3QAMCJFor9ciK6tJD+IEQAnrvJYQ6bRgKN0O0B9W kw27JOuiNaexKfYSyM6VupLMeOFLSS0UcW50TWX4b/qkPNBAmk5I4BxYWmBiCDicpWlG VLWcWD8QK67CrlrqhGvOHIml2fKu/p57HMj62XycpQolnbvAa73pgKx5HZkL0t4MxJeu F5w795F6eqcw1l0UjBDzMepbVfsEolpxpoVH6bwQkETcuhcr624dDYo/VwEaleKV+9i/ flYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=rzDsMujw1lDQC62R+XcADw0gNhdH5mlMs29QqFd8KFk=; b=uPyornaAQWYXNypGCCcL7NGvdSGAkxKwN4cXjQYUEiJmqUg24xGBoKdws/ERAhAZ0x OL8Vv2fMsULY6fBUJ/HbSU4zM2dLQ9Vk9t4OPqaDf+UPwhj0T7inoGMJLNxTOhTK9w7R 3r3KHFIgSWyPveSZA7OfGjwkhZ6L9DJlW5rvXychm4lIHgrf+WeLYCe4+QvWwHGtQuBZ UNxVGqSeTKbdJMBGW+tPCzIGkA9NSxHpKE1la7r3qU9CZzY0OL6X7pqmkhotOUdc7t+g S97V2UckrZ5Wk4NsaIjvY+UbZNlh6vj5lR+it5xb3GTfzu0hIE3wOqAzzaoFqm5hJTRJ Ybrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si3332770pgu.75.2022.01.13.06.52.58; Thu, 13 Jan 2022 06:53:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiAMJaC convert rfc822-to-8bit (ORCPT + 71 others); Thu, 13 Jan 2022 04:30:02 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55679 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233382AbiAMJaB (ORCPT ); Thu, 13 Jan 2022 04:30:01 -0500 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id BB9BF6002D; Thu, 13 Jan 2022 09:29:55 +0000 (UTC) Date: Thu, 13 Jan 2022 10:29:54 +0100 From: Miquel Raynal To: Alexander Aring Cc: Stefan Schmidt , linux-wpan - ML , "David S. Miller" , Jakub Kicinski , "open list:NETWORKING [GENERAL]" , Michael Hennerich , Harry Morris , Varka Bhadram , Xue Liu , Alan Ott , David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , "linux-wireless@vger.kernel.org Wireless" Subject: Re: [wpan-next v2 27/27] net: ieee802154: ca8210: Refuse most of the scan operations Message-ID: <20220113102954.7a0e213e@xps13> In-Reply-To: References: <20220112173312.764660-1-miquel.raynal@bootlin.com> <20220112173312.764660-28-miquel.raynal@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Alexander, alex.aring@gmail.com wrote on Wed, 12 Jan 2022 17:48:59 -0500: > Hi, > > On Wed, 12 Jan 2022 at 12:34, Miquel Raynal wrote: > > > > The Cascada 8210 hardware transceiver is kind of a hardMAC which > > interfaces with the softMAC and in practice does not support sending > > anything else than dataframes. This means we cannot send any BEACON_REQ > > during active scans nor any BEACON in general. Refuse these operations > > officially so that the user is aware of the limitation. > > > > Signed-off-by: Miquel Raynal > > --- > > drivers/net/ieee802154/ca8210.c | 25 ++++++++++++++++++++++++- > > 1 file changed, 24 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c > > index d3a9e4fe05f4..49c274280e3c 100644 > > --- a/drivers/net/ieee802154/ca8210.c > > +++ b/drivers/net/ieee802154/ca8210.c > > @@ -2385,6 +2385,25 @@ static int ca8210_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on) > > return link_to_linux_err(status); > > } > > > > +static int ca8210_enter_scan_mode(struct ieee802154_hw *hw, > > + struct cfg802154_scan_request *request) > > +{ > > + /* This xceiver can only send dataframes */ > > + if (request->type != NL802154_SCAN_PASSIVE) > > + return -EOPNOTSUPP; > > + > > + return 0; > > +} > > + > > +static int ca8210_enter_beacons_mode(struct ieee802154_hw *hw, > > + struct cfg802154_beacons_request *request) > > +{ > > + /* This xceiver can only send dataframes */ > > + return -EOPNOTSUPP; > > +} > > + > > +static void ca8210_exit_scan_beacons_mode(struct ieee802154_hw *hw) { } > > + > > static const struct ieee802154_ops ca8210_phy_ops = { > > .start = ca8210_start, > > .stop = ca8210_stop, > > @@ -2397,7 +2416,11 @@ static const struct ieee802154_ops ca8210_phy_ops = { > > .set_cca_ed_level = ca8210_set_cca_ed_level, > > .set_csma_params = ca8210_set_csma_params, > > .set_frame_retries = ca8210_set_frame_retries, > > - .set_promiscuous_mode = ca8210_set_promiscuous_mode > > + .set_promiscuous_mode = ca8210_set_promiscuous_mode, > > + .enter_scan_mode = ca8210_enter_scan_mode, > > + .exit_scan_mode = ca8210_exit_scan_beacons_mode, > > + .enter_beacons_mode = ca8210_enter_beacons_mode, > > + .exit_beacons_mode = ca8210_exit_scan_beacons_mode, > > }; > > so there is no flag that this driver can't support scanning currently > and it works now because the offload functionality will return > -ENOTSUPP? This is misleading because I would assume if it's not > supported we can do it by software which the driver can't do. I believe there is a misunderstanding. This is what I have understood from your previous comments in v1: "This driver does not support transmitting anything else than datagrams", which is what I assumed was a regular data packet. IOW, sending a MAC_CMD such as a beacon request or sending a beacon was not supported physically by the hardware. Hence, most of the scans operations cannot be performed and must be rejected (all but a passive scan, assuming that receiving beacons was okay). Please mind the update in that hook which currently is just an FYI from the mac to the drivers and not a "do it by yourself" injunction. So answering -EOPNOTSUPP to the mac here does not mean: "I cannot handle it by myself, the scan cannot happen" but "I cannot handle the forged frames, so let's just not try" > ... I see that the offload functions now are getting used and have a > reason to be upstream, but the use of it is wrong. As a personal matter of taste, I don't like flags when it comes to something complex like supporting a specific operation. Just in the scanning procedure there are 4 different actions and a driver might support only a subset of these, which is totally fine but hard to properly describe by well-named flags. Here the driver hooks say to the driver which are interested "here is what is going to happen" and then they can: - ignore the details by just not implementing the hooks, let the mac do its job, they will then transmit the relevant frames forged by the mac - eventually enter a specific mode internally for this operation, but basically do the same as above, ie. transmitting the frames forged by the mac - refuse the operation by returning an error code if something cannot be done I've experienced a number of situations in the MTD world and later with IIO drivers where flags have been remodeled and reused in different manners, until the flag description gets totally wrong and undescriptive regarding what it actually does. Hence my main idea of letting drivers refuse these operations instead of having the mac doing it for them. I can definitely use flags if you want, but in this case, what flags do you want to see? Thanks, Miquèl