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 C794DC433EF for ; Wed, 18 May 2022 08:44:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbiERIoq (ORCPT ); Wed, 18 May 2022 04:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233374AbiERIop (ORCPT ); Wed, 18 May 2022 04:44:45 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875495AA72; Wed, 18 May 2022 01:44:40 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3743AE000C; Wed, 18 May 2022 08:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652863479; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D7N0a8WlPyH5fUAPOA9fiwW1d7yjlVNaA/MdpICq2w4=; b=ImapXB86pOCCQb7z9pmiLBvyhgJdFuyUqfoxN480CFyLv1mm4jdFW8qr+ki/KXp39FGWFa 9AUaYQzSPKtMHh8JFrmNBS4x4DBwwfCRSRyam/rZb+/ybuKceA8pGy58x7zUEOlS2YN4cE Z+vgfHSqpWpLHkKk+5p+AoKQORXcPhs3hPfwG13jvRJC8fyYLcnReVZnve/jJzU/oGANZF WS7kXgZl9Oi/DkYei7+9WxyyczyLQxiiCpZnljTc1HeV5t8dIeqNlKA0c4Yb5EsNdhFipZ An30T3rEE+LzKj6Gaam2mFohNUfqeLRSHRzPy5iGaIp5eaqctH3PfuIa4/6n7A== Date: Wed, 18 May 2022 10:44:35 +0200 From: Miquel Raynal To: Alexander Aring Cc: Alexander Aring , Stefan Schmidt , linux-wpan - ML , David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Network Development Subject: Re: [PATCH wpan-next v3 09/11] net: mac802154: Introduce a synchronous API for MLME commands Message-ID: <20220518104435.76f5c0d5@xps-13> In-Reply-To: References: <20220517163450.240299-1-miquel.raynal@bootlin.com> <20220517163450.240299-10-miquel.raynal@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org Hi Alexander, aahringo@redhat.com wrote on Tue, 17 May 2022 20:41:41 -0400: > Hi, >=20 > On Tue, May 17, 2022 at 12:35 PM Miquel Raynal > wrote: > > > > This is the slow path, we need to wait for each command to be processed > > before continuing so let's introduce an helper which does the > > transmission and blocks until it gets notified of its asynchronous > > completion. This helper is going to be used when introducing scan > > support. > > > > Signed-off-by: Miquel Raynal > > --- > > net/mac802154/ieee802154_i.h | 1 + > > net/mac802154/tx.c | 46 ++++++++++++++++++++++++++++++++++++ > > 2 files changed, 47 insertions(+) > > > > diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h > > index a057827fc48a..b42c6ac789f5 100644 > > --- a/net/mac802154/ieee802154_i.h > > +++ b/net/mac802154/ieee802154_i.h > > @@ -125,6 +125,7 @@ extern struct ieee802154_mlme_ops mac802154_mlme_wp= an; > > void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb= ); > > void ieee802154_xmit_sync_worker(struct work_struct *work); > > int ieee802154_sync_and_hold_queue(struct ieee802154_local *local); > > +int ieee802154_mlme_tx_one(struct ieee802154_local *local, struct sk_b= uff *skb); > > netdev_tx_t > > ieee802154_monitor_start_xmit(struct sk_buff *skb, struct net_device *= dev); > > netdev_tx_t > > diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c > > index 38f74b8b6740..6cc4e5c7ba94 100644 > > --- a/net/mac802154/tx.c > > +++ b/net/mac802154/tx.c > > @@ -128,6 +128,52 @@ int ieee802154_sync_and_hold_queue(struct ieee8021= 54_local *local) > > return ieee802154_sync_queue(local); > > } > > > > +static int ieee802154_mlme_op_pre(struct ieee802154_local *local) > > +{ > > + return ieee802154_sync_and_hold_queue(local); > > +} > > + > > +static int ieee802154_mlme_tx(struct ieee802154_local *local, struct s= k_buff *skb) > > +{ > > + int ret; > > + > > + /* Avoid possible calls to ->ndo_stop() when we asynchronously = perform > > + * MLME transmissions. > > + */ > > + rtnl_lock(); > > + > > + /* Ensure the device was not stopped, otherwise error out */ > > + if (!local->open_count) > > + return -EBUSY; > > + =20 >=20 > No -EBUSY here, use ?-ENETDOWN?. Isn't it strange to return "Network is down" while we try to stop the device but fail to do so because, actually, it is still being used? > You forgot rtnl_unlock() here. I've blindly added those rtnl calls, I need to go through all of them once again and ensure all the error path release the lock. Thanks, Miqu=C3=A8l