From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84FFEECAAD4 for ; Sat, 3 Sep 2022 18:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229624AbiICSVl (ORCPT ); Sat, 3 Sep 2022 14:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232682AbiICSVi (ORCPT ); Sat, 3 Sep 2022 14:21:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3794F185 for ; Sat, 3 Sep 2022 11:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662229295; 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=9vUwm+ZLlJ49I/kvdB8M6Mu/W/Id29WXk+ZzGVSsdeY=; b=BBd3JPKEJYelbtosZNgiIRzISfjbR46Jf3ZnAMWT3fZtucm2tC0K8UIheqRvHOmhvhvDgX Z4pHdVWv/B6vNWVCX1XPaz8G7d2HDCKWr3Mf/qtBOVjavjN+HI7PzdSA4ipUY1xFMhGf+y NMbNw3fWpvB8cS8clBYrSpJAm2kQOHk= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-455-pc2-D0S1NiO0nCkmNt0nJQ-1; Sat, 03 Sep 2022 14:21:27 -0400 X-MC-Unique: pc2-D0S1NiO0nCkmNt0nJQ-1 Received: by mail-qt1-f197.google.com with SMTP id fy12-20020a05622a5a0c00b00344569022f7so3927111qtb.17 for ; Sat, 03 Sep 2022 11:21:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9vUwm+ZLlJ49I/kvdB8M6Mu/W/Id29WXk+ZzGVSsdeY=; b=lhmV4UIQ+kc7c8qPtxizA/l/wV0mWjDWGTpnKAt3GxPnw2LADZESy7SZKFi9fbZbxQ J1p+iGdsnoVEIYCkQrEL0Rp6q92SwgvpP2gqrty3dXbtrrvICKOp3lAdq1qUZnjBhOFu m0nBmijIYbm+6620vVE/ZMPrvWWWU3iyO+mIik2jKyNUxJL35q4oBgvTrD+r3sS0h/Mo Npu6EMrD5vVSNGKX0lgXJrexGAufOORakhofmZMWB8o9vnBoJZpe9CcF8se12IBMj5+N RmJrL/FatiQbc6Ae+D7eq83/OzezPa7AGxVeSqDfnp4ob/3ArtsoEYHVKh23SmNnaL7i fJrA== X-Gm-Message-State: ACgBeo1KIEkj0b6Xy6nY28dw+wsxFkEpYOwN3Q/s7YZR2fze4zVAMIrS 1MyWoGpMqtPXoOureCTnd2ycJfZQahZXuELvQY++W7qPjtU5rxkyPuY8y1a1dSB8deJ/8Gqx1MF m38aPxP8Q7LaSRm6NCcWM0XOYtj9g92pkdG4NzQ== X-Received: by 2002:a05:6214:5086:b0:499:2979:2df4 with SMTP id kk6-20020a056214508600b0049929792df4mr13266370qvb.2.1662229286578; Sat, 03 Sep 2022 11:21:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR65oJ1Qc8s8YzgUoRVDObKOWz/BWziJGs5Pajo4U0NT0AVw0EKynSHDFHkuMJlLC1rC8cjA4GdHotpbqyi8aR0= X-Received: by 2002:a05:6214:5086:b0:499:2979:2df4 with SMTP id kk6-20020a056214508600b0049929792df4mr13266357qvb.2.1662229286249; Sat, 03 Sep 2022 11:21:26 -0700 (PDT) MIME-Version: 1.0 References: <20220701143052.1267509-1-miquel.raynal@bootlin.com> <20220823182950.1c722e13@xps-13> <20220824122058.1c46e09a@xps-13> <20220824152648.4bfb9a89@xps-13> <20220825145831.1105cb54@xps-13> <20220826095408.706438c2@xps-13> <20220829100214.3c6dad63@xps-13> <20220831173903.1a980653@xps-13> <20220901020918.2a15a8f9@xps-13> <20220901150917.5246c2d0@xps-13> <20220903020829.67db0af8@xps-13> <20220903180556.6430194b@xps-13> In-Reply-To: <20220903180556.6430194b@xps-13> From: Alexander Aring Date: Sat, 3 Sep 2022 14:21:15 -0400 Message-ID: Subject: Re: [PATCH wpan-next 01/20] net: mac802154: Allow the creation of coordinator interfaces To: Miquel Raynal Cc: Alexander Aring , Stefan Schmidt , linux-wpan - ML , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Network Development , David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org Hi, On Sat, Sep 3, 2022 at 12:06 PM Miquel Raynal wrote: > > Hi Alexander, > > aahringo@redhat.com wrote on Sat, 3 Sep 2022 10:20:24 -0400: > > > Hi, > > > > On Fri, Sep 2, 2022 at 8:08 PM Miquel Raynal wrote: > > ... > > > > > > > > I am sorry, I never looked into Zephyr for reasons... Do they not have > > > > something like /proc/interrupts look if you see a counter for your > > > > 802.15.4 transceiver? > > > > > > > > > Also, can you please clarify when are we talking about software and > > > > > when about hardware filters. > > > > > > > > > > > > > Hardware filter is currently e.g. promiscuous mode on or off setting. > > > > Software filtering is depending which receive path the frame is going > > > > and which hardware filter is present which then acts like actually > > > > with hardware filtering. > > > > I am not sure if this answers this question? > > > > > > I think my understand gets clearer now that I've digged into Zephyr's > > > ieee802154 layer and in the at86rf230 datasheet. > > > > > > > okay, I think for zephyr questions you are here on the wrong mailinglist. > > > > > I will answer the previous e-mail but just for not I wanted to add that > > > I managed to get Zephyr working, I had to mess around in the code a > > > little bit and actually I discovered a net command which is necessary > > > to use in order to turn the iface up, whatever. > > > > > > > aha. > > > > > So I was playing with the atusb devices and I _think_ I've found a > > > firmware bug or a hardware bug which is going to be problematic. In > > > > the firmware is open source, I think it's fine to send patches here (I > > did it as well once for do a quick hack to port it to rzusb) the atusb > > is "mostly" at the point that they can do open hardware from the > > qi-hardware organization. > > > > > iface.c, when creating the interface, if you set the hardware filters > > > (set_panid/short/ext_addr()) there is no way you will be able to get a > > > fully transparent promiscuous mode. I am not saying that the whole > > > > What is a transparent promiscuous mode? > > I observe something very weird: > > A/ If at start up time we set promisc_mode(true) and then we set the hw > address filters, all the frames are forwarded to the MAC. > > B/ If at start up time we set the hw address filters and then set > promisc_mode(true), there is some filtering happening (like the Acks > which are dropped by the PHY. > > I need to investigate this further because I don't get why in case B we > don't have the same behavior than in case A. > Looking in the datasheet I see only set address filters -> then setting promiscuous mode is specified? Not the other way around... > > > promiscuous mode does not work anymore, I don't really know. What I was > > > interested in were the acks, and getting them is a real pain. At least, > > > enabling the promiscuous mode after setting the hw filters will lead to > > > the acks being dropped immediately while if the promiscuous mode is > > > enabled first (like on monitor interfaces) the acks are correctly > > > forwarded by the PHY. > > > > If we would not disable AACK handling (means we receive a frame with > > ack requested bit set we send a ack back) we would ack every frame it > > receives (speaking on at86rf233). > > Yes, but when sending MAC frames I would like to: > - be in promiscuous mode in Rx (tx paused) in order for the MAC to be > aware of the acks being received (unless there is another way to do > that, see below) > - still ack the received frames automatically > > Unless we decide that we must only ack the expected frames manually? > We can't handle ack frames on mac802154 in my opinion. Or what does manually mean? Is the ack frame required as a mac command operation or as a response to a transmitted frame because the other side will do retransmissions if they don't see an ack back? The second case is not possible to implement on mac802154, it must be offloaded. > > > While looking at the history of the drivers, I realized that the > > > TX_ARET mode was not supported by the firmware in 2015 (that's what you > > > > There exists ARET and AACK, both are mac mechanisms which must be > > offloaded on the hardware. Note that those only do "something" if the > > ack request bit in the frame is set. > > Absolutely (for the record, that's also an issue I had with Zephyr, I > had to use the shell to explicitly ask the AR bit to be set in the > outgoing frames, even though this in most MAC frames this is not a user > choice, it's expected by the spec). > fyi: we have also a default_ackreq behaviour if we set the ack frame on all data frames or not. However it's currently set to not set the ackreq bit because most hardware outside can't handle it (even if required by the spec). If you have a requirement to set ack request bit then do it, if there is hardware outside which cannot handle it, it's their problem. However the dataframes which are sent via user space socket depending on the use case if they want to set it or not but if they set it you need to know your network. > > ARET will retransmit if no ack is received after some while, etc. > > mostly coupled with CSMA/CA handling. We cannot guarantee such timings > > on the Linux layer. btw: mac80211 can also not handle acks on the > > software layer, it must be offloaded. > > On the Tx side, when sending eg. an association request or an > association response, I must expect and wait for an ack. This is > what I am struggling to do. How can I know that a frame which I just > transmitted has been acked? Bonus points, how can I do that in such a > way that it will work with other devices? (hints below) > You can't do this in mac802154 if there is a timing critical requirement here. Is there a timing critical requirement here? > > AACK will send a back if a frame with ack request bit was received. > > > > > say in a commit) I have seen no further updates about it so I guess > > > it's still not available. I don't see any other way to know if a > > > frame's ack has been received or not reliably. > > > > You implemented it for the at86rf230 driver (the spi one which is what > > also atusb uses). You implemented the > > > > ctx->trac = IEEE802154_NO_ACK; > > > > which signals the upper layer that if the ack request bit is set, that > > there was no ack. > > > > But yea, there is a missing feature for atusb yet which requires > > firmware changes as well. > > :'( > > Let's say I don't have the time to update the firmware ;). I also assume > that other transceivers (or even the drivers) might be limited on this > regard as well. How should I handle those "I should wait for the ack to > be received" situation while trying to associate? > If other transceivers cannot handle giving us feedback if ack was received or not and we have the mandatory requirement to know it, it is poor hardware/driver. As I said if the spec requires to check on an ack or not we need to get his information, if the hardware/driver can't deliver this... then just assume an ACK was received as it returns TX_SUCCESS (or whatever the return value was). I said before that some hardware will act weird if they don't support it. > The tricky case is the device receiving the ASSOC_REQ: > - the request is received > - an ack must be sent (this is okay in most cases I guess) > - the device must send an association response (also ok) > - and wait for the response to be acked... > * either I use the promisc mode when sending the response > (because of possible race conditions) and I expect the ack to > be forwarded to the MAC > -> This does not work on atusb, enabling promiscuous > mode after the init does not turn the PHY into > promiscuous mode as expected (discussed above) > * or I don't turn the PHY in promiscuous mode and I expect it > to return a clear status about if the ACK was received > -> But this seem to be unsupported with the current > ATUSB firmware, I fear other devices could have similar > limitations > * or I just assume the acks are received blindly > -> Not sure this is robust enough? > Assume you always get an ack back until somebody implements this feature in their driver (It's already implemented so as they return TX_SUCCESS). We cannot do much more I think... it is not robust but then somebody needs to update the driver/firmware. It's more weird if the otherside does not support AACK, because ARET will send them 3 times (by default) the same frame. That's why we have the policy to not set the ackreq bit if it's not required. > What is your "less worse" choice? > > > Btw: I can imagine that hwsim "fakes" such > > offload behaviours. > > My current implementation actually did handle all the acks (waiting for > them and sending them) from the MAC. I'm currently migrating the ack > sending part to the hw. For the reception, that's the big question. > In my opinion we should never deal with ack frames on mac802154 level, neither on hwsim, this is an offloaded functionality. What I have in mind is to fake a "TX_NO_ACK" return value as a probability parameter to return it sometimes. E.g. as netem and drop rate, etc. Then we could do some testing with it. > > > Do you think I can just ignore the acks during an association in > > > mac802154? > > > > No, even we should WARN_ON ack frames in states we don't expect them > > because they must be offloaded on hardware. > > > > I am not sure if I am following what is wrong with the trac register > > and NO_ACK, this is the information if we got an ack or not. Do you > > need to turn off address filters while "an association"? > > If we have access to the TRAC register, I believe we no longer need to > turn off address filters. > That sounds good. - Alex