Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1229617pxb; Fri, 21 Jan 2022 12:51:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCZKcT5sr2NCbwavZXy3QnsjeIrMoJ556sLWzgceXWGguMfCrKq1fh4+8hTTdfYIbRE2a/ X-Received: by 2002:a17:903:1110:b0:149:a428:19f1 with SMTP id n16-20020a170903111000b00149a42819f1mr5686995plh.120.1642798285944; Fri, 21 Jan 2022 12:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642798285; cv=none; d=google.com; s=arc-20160816; b=RtjGQegauae+rFTmlIvZBLI2TQmOCFvmgeT4ctW7/Los9sZv+g/avdGVQCjXQYSPeQ ViUBGY/j/j+YFaUp3b1+PUUNLNAPzTuw1tVthL+4Igbe2w30detPpSkA0nbTE5Xn8Ho3 Q+ciXZaLXPntH5uJXu68WyMmyDPIzucj/mMUVVv4NunZTCwOspUaMtZ9/Nupq/arAfYj 01+HtXL+TDX7rnpPTLj1tLZlZ+K17+mnei1m6OX7tqi1weACMqFwGF/LIYnYQcOvkM9+ fbCymSlFR3VlFMmHLsdc4Fg7oPydnBO1wwd0LOuXlE66xn4wY1hcDw8em1JD3ywkFA1y HipA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=06pYn2Dd0Uu8y29x3d76BlvQIpoM1b/V9yTLmiZbAtU=; b=WwhixiHZxEooFj0OyjeikeBK832VHsz4BfAOvedCJvokUH5DA0BMrD4KR9C6oCy87e tWTzvisUbjCo7S42r/bAr0kXS6+/GCXC30Ck1HuqyNijcF6579MtBZLJF9g+mbOjuPqv 5dz7KEcfz5vMmpvvo7cgMV8H4CqGTZpl7cs/tlRBEu7C5m3Df8kYr/0H8aLTd6BcWB4y xl2E8uBiBQqaf6lVnkYLjfFc3YoNsP48XhL44J0X88Yi/oGukyVN7s9DUSgwde9/RfKm x+9b5Zrp5rtl0yrJ9+wk3VrafXF3COvH3LKp3AA4p/IZ95ij3eSnxMWbECJZd8Fhg7Q4 Isvg== 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 q34si7207229pgk.819.2022.01.21.12.51.17; Fri, 21 Jan 2022 12:51:25 -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 S1357962AbiATAvc (ORCPT + 70 others); Wed, 19 Jan 2022 19:51:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357947AbiATAva (ORCPT ); Wed, 19 Jan 2022 19:51:30 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E28C06161C; Wed, 19 Jan 2022 16:51:29 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 33876100006; Thu, 20 Jan 2022 00:51:27 +0000 (UTC) From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [wpan-next 02/14] net: mac802154: Create a transmit error helper Date: Thu, 20 Jan 2022 01:51:10 +0100 Message-Id: <20220120005122.309104-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220120005122.309104-1-miquel.raynal@bootlin.com> References: <20220120005122.309104-1-miquel.raynal@bootlin.com> 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 So far there is only a helper for successful transmission, which led device drivers to implement their own handling in case of error. Unfortunately, we really need all the drivers to give the hand back to the core once they are done in order to be able to build a proper synchronous API. So let's create a _xmit_error() helper. Signed-off-by: Miquel Raynal --- include/net/mac802154.h | 10 ++++++++++ net/mac802154/util.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/include/net/mac802154.h b/include/net/mac802154.h index 94b2e3008e77..e7443e1acde8 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h @@ -498,4 +498,14 @@ void ieee802154_stop_queue(struct ieee802154_hw *hw); void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, bool ifs_handling); +/** + * ieee802154_xmit_error - frame transmission failed + * + * @hw: pointer as obtained from ieee802154_alloc_hw(). + * @skb: buffer for transmission + * @ifs_handling: indicate interframe space handling + */ +void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb, + bool ifs_handling); + #endif /* NET_MAC802154_H */ diff --git a/net/mac802154/util.c b/net/mac802154/util.c index 4c06a6bd391a..8e7e4cf16fc3 100644 --- a/net/mac802154/util.c +++ b/net/mac802154/util.c @@ -94,6 +94,15 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, } EXPORT_SYMBOL(ieee802154_xmit_complete); + +void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb, + bool ifs_handling) +{ + ieee802154_wakeup_after_xmit_done(hw, skb, ifs_handling); + dev_kfree_skb_any(skb); +} +EXPORT_SYMBOL(ieee802154_xmit_error); + void ieee802154_stop_device(struct ieee802154_local *local) { flush_workqueue(local->workqueue); -- 2.27.0