From patchwork Thu Mar 3 18:24:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767903 X-Patchwork-Delegate: kuba@kernel.org 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 A0E1DC433FE for ; Thu, 3 Mar 2022 18:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235723AbiCCS0C (ORCPT ); Thu, 3 Mar 2022 13:26:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235702AbiCCS0A (ORCPT ); Thu, 3 Mar 2022 13:26:00 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E48E1A41D0; Thu, 3 Mar 2022 10:25:14 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2871220003; Thu, 3 Mar 2022 18:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331912; 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=Kj+PvFp1ksz07D636STHaz1vWj2YLBhvGeYDeYxJsEk=; b=h7X0bQoz0wSt2JQ+6FehPdXhyoT1fqTG79YqAnePJaFFMtO7t0p/g1TL4fMPyw60NOie7p CSELBhDBLds8samfKjFsx2pQSoLM/hwK21ZgWKD87+/cGn9GlSn1mPi+qrCQjBdDDqHHVi VVki3hb6dhWkrNS12D6K1yuUxFHRw8lk3r8ErpW3YzvA0ACnyX3em4aaAtOS4m9Q8fajxL RilwrhWxQtgryOJX/5sjo82u3fDDnLqHDkP5cVu9VWJM/7Ss+26juEyVjrg26vKm+FgnpQ AiaRsV7GE9jo9PVj7MTE8bYHI5qGDu7M9w2gi+spsDBsbl5d5cxxvH3loOLHZA== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 01/11] net: ieee802154: Enhance/fix the names of the MLME return codes Date: Thu, 3 Mar 2022 19:24:58 +0100 Message-Id: <20220303182508.288136-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Let's keep these definitions as close to the specification as possible while they are not yet in use. The names get slightly longer, but we gain the minor cost of being able to search the spec more easily. Signed-off-by: Miquel Raynal --- include/linux/ieee802154.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h index 95c831162212..01d945c8b2e1 100644 --- a/include/linux/ieee802154.h +++ b/include/linux/ieee802154.h @@ -136,16 +136,16 @@ enum { IEEE802154_SUCCESS = 0x0, /* The beacon was lost following a synchronization request. */ - IEEE802154_BEACON_LOSS = 0xe0, + IEEE802154_BEACON_LOST = 0xe0, /* * A transmission could not take place due to activity on the * channel, i.e., the CSMA-CA mechanism has failed. */ - IEEE802154_CHNL_ACCESS_FAIL = 0xe1, + IEEE802154_CHANNEL_ACCESS_FAILURE = 0xe1, /* The GTS request has been denied by the PAN coordinator. */ - IEEE802154_DENINED = 0xe2, + IEEE802154_DENIED = 0xe2, /* The attempt to disable the transceiver has failed. */ - IEEE802154_DISABLE_TRX_FAIL = 0xe3, + IEEE802154_DISABLE_TRX_FAILURE = 0xe3, /* * The received frame induces a failed security check according to * the security suite. @@ -185,9 +185,9 @@ enum { * A PAN identifier conflict has been detected and communicated to the * PAN coordinator. */ - IEEE802154_PANID_CONFLICT = 0xee, + IEEE802154_PAN_ID_CONFLICT = 0xee, /* A coordinator realignment command has been received. */ - IEEE802154_REALIGMENT = 0xef, + IEEE802154_REALIGNMENT = 0xef, /* The transaction has expired and its information discarded. */ IEEE802154_TRANSACTION_EXPIRED = 0xf0, /* There is no capacity to store the transaction. */ @@ -203,7 +203,7 @@ enum { * A SET/GET request was issued with the identifier of a PIB attribute * that is not supported. */ - IEEE802154_UNSUPPORTED_ATTR = 0xf4, + IEEE802154_UNSUPPORTED_ATTRIBUTE = 0xf4, /* * A request to perform a scan operation failed because the MLME was * in the process of performing a previously initiated scan operation. From patchwork Thu Mar 3 18:24:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767905 X-Patchwork-Delegate: kuba@kernel.org 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 B4BF9C433F5 for ; Thu, 3 Mar 2022 18:25:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235728AbiCCS0D (ORCPT ); Thu, 3 Mar 2022 13:26:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbiCCS0B (ORCPT ); Thu, 3 Mar 2022 13:26:01 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9361D1A41DF; Thu, 3 Mar 2022 10:25:15 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DF48520007; Thu, 3 Mar 2022 18:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331914; 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=hzRFgzM4CKz3QS8PYg7wgueEZihoX1rywNOkCigJb0c=; b=G47oq8jBXeX2cCXSHseKTTzju0VIlOmJzjEvXVY+oJG2v61bvThChGBYRUfMJqq3AtQNmO bDUAjn/4s1gjEKinKncd37r5cMMFTgmKMJKggT0Xlodu40bkK8SoOS2Ydldv+qL+MZ6Vx8 TBo6Ykfs37ncBSpw6oz0QR9Yn6N5vZ5dSVRaEfewAK5M0b35ZysUrFZAKrDtUb19xWOr6u nn+OItQ4n4yyn3H2ozYiO76z1C2CKhgn9kKImYhlg3VQVxe1DWxi5u1J/rmkavNYmHn0FW 63O8LplWM6Ah+/vlP0s3/SkDGuZOYJolQgOU0hnBguhGrynFq/g1+QW4qCfHuw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 02/11] net: ieee802154: Fill the list of MLME return codes Date: Thu, 3 Mar 2022 19:24:59 +0100 Message-Id: <20220303182508.288136-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There are more codes than already listed, let's be a bit more exhaustive. This will allow to drop device drivers local definitions of these codes. Signed-off-by: Miquel Raynal --- include/linux/ieee802154.h | 67 +++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h index 01d945c8b2e1..f1f9412b6ac6 100644 --- a/include/linux/ieee802154.h +++ b/include/linux/ieee802154.h @@ -134,7 +134,35 @@ enum { * a successful transmission. */ IEEE802154_SUCCESS = 0x0, - + /* The requested operation failed. */ + IEEE802154_MAC_ERROR = 0x1, + /* The requested operation has been cancelled. */ + IEEE802154_CANCELLED = 0x2, + /* + * Device is ready to poll the coordinator for data in a non beacon + * enabled PAN. + */ + IEEE802154_READY_FOR_POLL = 0x3, + /* Wrong frame counter. */ + IEEE802154_COUNTER_ERROR = 0xdb, + /* + * The frame does not conforms to the incoming key usage policy checking + * procedure. + */ + IEEE802154_IMPROPER_KEY_TYPE = 0xdc, + /* + * The frame does not conforms to the incoming security level usage + * policy checking procedure. + */ + IEEE802154_IMPROPER_SECURITY_LEVEL = 0xdd, + /* Secured frame received with an empty Frame Version field. */ + IEEE802154_UNSUPPORTED_LEGACY = 0xde, + /* + * A secured frame is received or must be sent but security is not + * enabled in the device. Or, the Auxiliary Security Header has security + * level of zero in it. + */ + IEEE802154_UNSUPPORTED_SECURITY = 0xdf, /* The beacon was lost following a synchronization request. */ IEEE802154_BEACON_LOST = 0xe0, /* @@ -204,11 +232,48 @@ enum { * that is not supported. */ IEEE802154_UNSUPPORTED_ATTRIBUTE = 0xf4, + /* Missing source or destination address or address mode. */ + IEEE802154_INVALID_ADDRESS = 0xf5, + /* + * MLME asked to turn the receiver on, but the on time duration is too + * big compared to the macBeaconOrder. + */ + IEEE802154_ON_TIME_TOO_LONG = 0xf6, + /* + * MLME asaked to turn the receiver on, but the request was delayed for + * too long before getting processed. + */ + IEEE802154_PAST_TIME = 0xf7, + /* + * The StartTime parameter is nonzero, and the MLME is not currently + * tracking the beacon of the coordinator through which it is + * associated. + */ + IEEE802154_TRACKING_OFF = 0xf8, + /* + * The index inside the hierarchical values in PIBAttribute is out of + * range. + */ + IEEE802154_INVALID_INDEX = 0xf9, + /* + * The number of PAN descriptors discovered during a scan has been + * reached. + */ + IEEE802154_LIMIT_REACHED = 0xfa, + /* + * The PIBAttribute parameter specifies an attribute that is a read-only + * attribute. + */ + IEEE802154_READ_ONLY = 0xfb, /* * A request to perform a scan operation failed because the MLME was * in the process of performing a previously initiated scan operation. */ IEEE802154_SCAN_IN_PROGRESS = 0xfc, + /* The outgoing superframe overlaps the incoming superframe. */ + IEEE802154_SUPERFRAME_OVERLAP = 0xfd, + /* Any other error situation. */ + IEEE802154_SYSTEM_ERROR = 0xff, }; /* frame control handling */ From patchwork Thu Mar 3 18:25:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767907 X-Patchwork-Delegate: kuba@kernel.org 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 1392BC4332F for ; Thu, 3 Mar 2022 18:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbiCCS0M (ORCPT ); Thu, 3 Mar 2022 13:26:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbiCCS0J (ORCPT ); Thu, 3 Mar 2022 13:26:09 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E821A41EB; Thu, 3 Mar 2022 10:25:18 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 35F2F2000B; Thu, 3 Mar 2022 18:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331915; 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=gc9GvEmcqPdgjbsstrsAlcUKY3OGmYysVOqtCmZ0Ffc=; b=G2C2kWpZ8MCW9Vi1ORpk0GsXh2KYOqsRaIyJiL/DajnjKR/C5Tvsg+2EmFiUfjadFIFtpT LtjtrC5Tic8FPTxQY6gJRhc/d4KJp5qJM3YqdLtuqOK6M4vn9huphze2YwxBTC3QFCqQ37 RX1u2SAe957HegMx736MrUpfszjwQ3efn+Hw8LxK2C8v1RLUTstG1yPFh0LHiIRor4rlCV srrn7Q0K1k+xXekfibTSvvQqFOxjgu9DJbgJcjLhbbcw6NCZESVwG3QDQpOTipOgnErcYx H7/hD9ztHz4l6Rb7cL1sFUVydE0UBuE02BGivt4HOYRZ2E0uGAAZn+W0LlYBSw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 03/11] net: mac802154: Create a transmit error helper Date: Thu, 3 Mar 2022 19:25:00 +0100 Message-Id: <20220303182508.288136-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 and take this opportunity to fill the new device-global field storing Tx statuses. Signed-off-by: Miquel Raynal --- include/net/mac802154.h | 10 ++++++++++ net/mac802154/util.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/net/mac802154.h b/include/net/mac802154.h index 2c3bbc6645ba..abbe88dc9df5 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 + * @reason: error code + */ +void ieee802154_xmit_error(struct ieee802154_hw *hw, struct sk_buff *skb, + int reason); + #endif /* NET_MAC802154_H */ diff --git a/net/mac802154/util.c b/net/mac802154/util.c index f2078238718b..37d2520804e3 100644 --- a/net/mac802154/util.c +++ b/net/mac802154/util.c @@ -88,6 +88,17 @@ 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, + int reason) +{ + struct ieee802154_local *local = hw_to_local(hw); + + local->tx_result = reason; + ieee802154_wake_queue(hw); + dev_kfree_skb_any(skb); +} +EXPORT_SYMBOL(ieee802154_xmit_error); + void ieee802154_stop_device(struct ieee802154_local *local) { flush_workqueue(local->workqueue); From patchwork Thu Mar 3 18:25:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767906 X-Patchwork-Delegate: kuba@kernel.org 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 5B338C433F5 for ; Thu, 3 Mar 2022 18:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235759AbiCCS0K (ORCPT ); Thu, 3 Mar 2022 13:26:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235731AbiCCS0E (ORCPT ); Thu, 3 Mar 2022 13:26:04 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363C31A41E2; Thu, 3 Mar 2022 10:25:18 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 8115D2000D; Thu, 3 Mar 2022 18:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331916; 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=Rizhsl0RIirMTOdpmsfneZgvqvSRouzexSJ2mPB9mRo=; b=oOMZtKx9QTkYahLs2z5MyMoE1mDdqOtWs5Dl4CECi97Qm6f8YYmG0lcVF44O2RjY6DC51N 8uH0OhR+R45LRxfC7BZCzwfVzzwWwEgoCYZQXMhQKWgAdbCYYeyvpIgHnyuNa5cprh0gIa GYj/zOXEYJLKPAdCPV1Eb8j3Q37zdosrbQq72Qla3xqz8x8cuifYvHHD4lPJe7plCSvbGd g1iAkEA11i+QjMAW/8N46Z0zWfr41Pn5RmLZyKk/EfZYdhfyH8ho1yZM98bttzOSX58glG GZwlcXsu+jpmTFtP83BQ2TMmgEUdOv9LqffKxwBT99YkwcpydqA9fFMs5tTTiw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 04/11] net: mac802154: Save a global error code on transmissions Date: Thu, 3 Mar 2022 19:25:01 +0100 Message-Id: <20220303182508.288136-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org So far no error is returned from a failing transmission. However it might sometimes be useful, and particularly easy to use during sync transfers (for certain MLME commands). Let's create an internal variable for that, global to the device. Right now only success are registered, which is rather useless, but soon we will have more situations filling this field. Signed-off-by: Miquel Raynal --- net/mac802154/ieee802154_i.h | 2 ++ net/mac802154/util.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h index 702560acc8ce..1381e6a5e180 100644 --- a/net/mac802154/ieee802154_i.h +++ b/net/mac802154/ieee802154_i.h @@ -56,6 +56,8 @@ struct ieee802154_local { struct sk_buff *tx_skb; struct work_struct tx_work; + /* A negative Linux error code or a null/positive MLME error status */ + int tx_result; }; enum { diff --git a/net/mac802154/util.c b/net/mac802154/util.c index 37d2520804e3..ec523335336c 100644 --- a/net/mac802154/util.c +++ b/net/mac802154/util.c @@ -58,8 +58,11 @@ enum hrtimer_restart ieee802154_xmit_ifs_timer(struct hrtimer *timer) void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, bool ifs_handling) { + struct ieee802154_local *local = hw_to_local(hw); + + local->tx_result = IEEE802154_SUCCESS; + if (ifs_handling) { - struct ieee802154_local *local = hw_to_local(hw); u8 max_sifs_size; /* If transceiver sets CRC on his own we need to use lifs From patchwork Thu Mar 3 18:25:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767909 X-Patchwork-Delegate: kuba@kernel.org 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 90EFCC4332F for ; Thu, 3 Mar 2022 18:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235750AbiCCS0Q (ORCPT ); Thu, 3 Mar 2022 13:26:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235735AbiCCS0K (ORCPT ); Thu, 3 Mar 2022 13:26:10 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8927B1A58C5; Thu, 3 Mar 2022 10:25:21 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DCF612000A; Thu, 3 Mar 2022 18:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331918; 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=u5GsCepptVoX2JZ38pEAvAndTHAQRn+3mkA9ZcZ09z8=; b=pE3kKY2aAAIb0XR6e6tbtfmo6AyXrOq8LvqMx8ItDi6dVB7jisEwYSB0urqnd/lhccmNXT wCN7bGsaRvt6xDLp6Iz/UTmPwfV2ZjH7o/veJ4O+8pVcDgSdIl5Yb/FVtPV2waFzMbQmln d7bHQjjEMh5eqxO2cQ6SPIWgKuWBJ9z7MPlsMhQML0LkLdVZs+RpODQJal2HlzP6N+MR9o +c0GcjMx0dykphRREwXF+qJU9aVh0q1I8SdH2tAf/5Is5CCFVBg6a7ZfZE9X7A3OxPBgsy EYtFrwRsoZrzzZc/NR/JbDw07ImNHdEGVIoI24aGJdLEtteeJrrxcJ+fggLiFA== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 05/11] net: ieee802154: at86rf230: Assume invalid TRAC if not recognized Date: Thu, 3 Mar 2022 19:25:02 +0100 Message-Id: <20220303182508.288136-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The TRAC register gives the MAC error codes if any. If the TRAC register reports a value that is unknown, we should probably assume that it is invalid. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/at86rf230.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 563031ce76f0..616acfa8cd28 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -694,6 +694,7 @@ at86rf230_tx_trac_check(void *context) break; default: WARN_ONCE(1, "received tx trac status %d\n", trac); + lp->trac.invalid++; break; } } From patchwork Thu Mar 3 18:25:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767910 X-Patchwork-Delegate: kuba@kernel.org 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 D45ABC433EF for ; Thu, 3 Mar 2022 18:25:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235766AbiCCS0S (ORCPT ); Thu, 3 Mar 2022 13:26:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235755AbiCCS0K (ORCPT ); Thu, 3 Mar 2022 13:26:10 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE96E1A58E4; Thu, 3 Mar 2022 10:25:22 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3246D2000E; Thu, 3 Mar 2022 18:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331919; 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=YJXbl6AYQi16uRc3GrKH3BgZvJvVjapvU0fhtBE7LcY=; b=WF+7s/bSIFt9w8pGKpgjBN708I8BeoCChdW1hmuA8ejyKgKpaqUH/p50acY0ljrkaMlhHq A7V4Cq2DaxP24WkDGAxBb93n/OEp1eKfotCaEv4ng5v7ogkgNS+WOpg5+XXlc4/7ZI8k/G 47+Tk6Q2APocd3y3RCe+/DNRj83iA9q6Ak0lMPmc7NVrYUNvymu3Faytl0+8ne7qUlEbTk XPH59tbXmUIZL9YzS+gpZBQE58g0em6naIpyJI3RQQEbVwxr2wVbMtficWzp1Yh6dhqLX5 22I2+MTqfkCRHA8d7q+SOYPKpuLM8WIcICjN+9IScX8mn4kMAqwMIwFMk9J85A== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 06/11] net: ieee802154: at86rf230: Return early in case of error Date: Thu, 3 Mar 2022 19:25:03 +0100 Message-Id: <20220303182508.288136-7-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The TRAC register is only parsed in the Tx path if the debugfs entry is enabled. This does not look like a good idea because this register gives us the actual status of the transmitted packet. Let's always check the content of this register and error out when appropriate. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/at86rf230.c | 49 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 616acfa8cd28..12ee071057d2 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -673,33 +673,36 @@ at86rf230_tx_trac_check(void *context) struct at86rf230_state_change *ctx = context; struct at86rf230_local *lp = ctx->lp; - if (IS_ENABLED(CONFIG_IEEE802154_AT86RF230_DEBUGFS)) { - u8 trac = TRAC_MASK(ctx->buf[1]); + u8 trac = TRAC_MASK(ctx->buf[1]); - switch (trac) { - case TRAC_SUCCESS: - lp->trac.success++; - break; - case TRAC_SUCCESS_DATA_PENDING: - lp->trac.success_data_pending++; - break; - case TRAC_CHANNEL_ACCESS_FAILURE: - lp->trac.channel_access_failure++; - break; - case TRAC_NO_ACK: - lp->trac.no_ack++; - break; - case TRAC_INVALID: - lp->trac.invalid++; - break; - default: - WARN_ONCE(1, "received tx trac status %d\n", trac); - lp->trac.invalid++; - break; - } + switch (trac) { + case TRAC_SUCCESS: + lp->trac.success++; + break; + case TRAC_SUCCESS_DATA_PENDING: + lp->trac.success_data_pending++; + break; + case TRAC_CHANNEL_ACCESS_FAILURE: + lp->trac.channel_access_failure++; + goto failure; + case TRAC_NO_ACK: + lp->trac.no_ack++; + goto failure; + case TRAC_INVALID: + lp->trac.invalid++; + goto failure; + default: + WARN_ONCE(1, "received tx trac status %d\n", trac); + lp->trac.invalid++; + goto failure; } at86rf230_async_state_change(lp, ctx, STATE_TX_ON, at86rf230_tx_on); + + return; + +failure: + at86rf230_async_error(lp, ctx, -EIO); } static void From patchwork Thu Mar 3 18:25:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767911 X-Patchwork-Delegate: kuba@kernel.org 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 CE22AC4332F for ; Thu, 3 Mar 2022 18:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235778AbiCCS0T (ORCPT ); Thu, 3 Mar 2022 13:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235760AbiCCS0K (ORCPT ); Thu, 3 Mar 2022 13:26:10 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BCD71A58E9; Thu, 3 Mar 2022 10:25:24 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 737132000F; Thu, 3 Mar 2022 18:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331920; 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=WPv/8Ot5ykbhlNZhcY2g7IR2LHAZfOxJORZgNi+HzlY=; b=Vyp+ldFqelPevxlLvIltLkMYDubuDE+/jwHK95FaRfCzwJCfsMzrpgICCqiSkn3BeCFnlp SKlH88HVpY0BGVeEFd/XxYMv/ocbYMkbnxYp8i/4GIiuqPSlQACn9AG56MkxrZftGZ//GD X62uE5wG5yhGHr7fkAWbVL1eriG6cVfBg1gg1wjBkyNr/8Wcv4AlN37l8SwELC2OZZ7U0M oj4A56fztryjh1DFfl40kAEcK8KZuYCPJ+hawFYPteEXK/p20mNPVbO66xm3zo5n/9Bqsq mInF3WIzRwtWerjdQUsks9i110amsG1Ez/yDyd9552PwlPCNeYyufo/kGajSlw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 07/11] net: ieee802154: at86rf230: Provide meaningful error codes when possible Date: Thu, 3 Mar 2022 19:25:04 +0100 Message-Id: <20220303182508.288136-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Either the spi operation failed, or the device encountered an error. In both case, we know more or less what happened thanks to the spi call return code or the content of the TRAC register otherwise. Use them in order to propagate one step above the error. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/at86rf230.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 12ee071057d2..5f19266b3045 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -370,7 +370,27 @@ static inline void at86rf230_async_error(struct at86rf230_local *lp, struct at86rf230_state_change *ctx, int rc) { - dev_err(&lp->spi->dev, "spi_async error %d\n", rc); + int reason; + + switch (rc) { + case TRAC_CHANNEL_ACCESS_FAILURE: + reason = IEEE802154_CHANNEL_ACCESS_FAILURE; + break; + case TRAC_NO_ACK: + reason = IEEE802154_NO_ACK; + break; + case TRAC_INVALID: + reason = IEEE802154_SYSTEM_ERROR; + break; + default: + reason = rc; + } + + if (reason < 0) + dev_err(&lp->spi->dev, "spi_async error %d\n", reason); + else + dev_err(&lp->spi->dev, "xceiver error %d\n", reason); + at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF, at86rf230_async_error_recover); @@ -693,6 +713,7 @@ at86rf230_tx_trac_check(void *context) goto failure; default: WARN_ONCE(1, "received tx trac status %d\n", trac); + trac = TRAC_INVALID; lp->trac.invalid++; goto failure; } @@ -702,7 +723,7 @@ at86rf230_tx_trac_check(void *context) return; failure: - at86rf230_async_error(lp, ctx, -EIO); + at86rf230_async_error(lp, ctx, trac); } static void From patchwork Thu Mar 3 18:25:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767908 X-Patchwork-Delegate: kuba@kernel.org 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 F148DC43217 for ; Thu, 3 Mar 2022 18:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235757AbiCCS0O (ORCPT ); Thu, 3 Mar 2022 13:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235762AbiCCS0L (ORCPT ); Thu, 3 Mar 2022 13:26:11 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A571A58EA; Thu, 3 Mar 2022 10:25:25 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id BB76F20011; Thu, 3 Mar 2022 18:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331922; 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=regqtWdmmr7YwP29eVg+fqSTAspcC6y2WbxEFTy5muw=; b=mdKlb9kgwh3LLXPCZJ/K2YDn63AOlIxD1hlzJh34PEY0fa2IS0IHSUwXMHCJDb82bLJVPn x4rdaE6/TXvqGJKFKTL+48BvgiL1M7XazEYnhIUHx/XvFrfHjucy9dTZDvbhYKjvHdd2hU 7q4NczKx/FVZ59KZRmBLy0KDI2K6RkcxZBzqO2j4nlA1Zt9EJZDrhwmAttX50EcyyquIwF EXVOy67vo/RULj6S2YGhok9T1FPH1wavvwtymwb6pvXT1AIC+0r2zFWV1IFWglmO+1pvBv MbzZYf06Kv+7IIq44YxVWmr8KkbqIskqSPuL9V+kb+sHFzhskrxTOsS5rGBMUw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 08/11] net: ieee802154: at86rf230: Call _xmit_error() when a transmission fails Date: Thu, 3 Mar 2022 19:25:05 +0100 Message-Id: <20220303182508.288136-9-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ieee802154_xmit_error() is the right helper to call when a transmission has failed. Let's use it instead of open-coding it. As the error helper also requires an error code, save the error from the previous helper in order to give this value to the core when opportunate. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/at86rf230.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 5f19266b3045..9cc272e3460a 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -74,6 +74,7 @@ struct at86rf230_state_change { u8 to_state; bool free; + int reason; }; struct at86rf230_trac { @@ -340,14 +341,14 @@ at86rf230_async_error_recover_complete(void *context) { struct at86rf230_state_change *ctx = context; struct at86rf230_local *lp = ctx->lp; + int reason = ctx->reason; if (ctx->free) kfree(ctx); if (lp->was_tx) { lp->was_tx = 0; - dev_kfree_skb_any(lp->tx_skb); - ieee802154_wake_queue(lp->hw); + ieee802154_xmit_error(lp->hw, lp->tx_skb, reason); } } @@ -370,27 +371,24 @@ static inline void at86rf230_async_error(struct at86rf230_local *lp, struct at86rf230_state_change *ctx, int rc) { - int reason; - switch (rc) { case TRAC_CHANNEL_ACCESS_FAILURE: - reason = IEEE802154_CHANNEL_ACCESS_FAILURE; + ctx->reason = IEEE802154_CHANNEL_ACCESS_FAILURE; break; case TRAC_NO_ACK: - reason = IEEE802154_NO_ACK; + ctx->reason = IEEE802154_NO_ACK; break; case TRAC_INVALID: - reason = IEEE802154_SYSTEM_ERROR; + ctx->reason = IEEE802154_SYSTEM_ERROR; break; default: - reason = rc; + ctx->reason = rc; } - if (reason < 0) - dev_err(&lp->spi->dev, "spi_async error %d\n", reason); + if (ctx->reason < 0) + dev_err(&lp->spi->dev, "spi_async error %d\n", ctx->reason); else - dev_err(&lp->spi->dev, "xceiver error %d\n", reason); - + dev_err(&lp->spi->dev, "xceiver error %d\n", ctx->reason); at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF, at86rf230_async_error_recover); From patchwork Thu Mar 3 18:25:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767912 X-Patchwork-Delegate: kuba@kernel.org 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 6F407C433FE for ; Thu, 3 Mar 2022 18:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235761AbiCCS0V (ORCPT ); Thu, 3 Mar 2022 13:26:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235747AbiCCS0M (ORCPT ); Thu, 3 Mar 2022 13:26:12 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBC541A41CA; Thu, 3 Mar 2022 10:25:26 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 4EF2A20002; Thu, 3 Mar 2022 18:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331923; 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=ZZHfvpHNrn5AeNwFEm3pndYVL8rb2nvfYZUF4mirQIA=; b=HCPKDm0O1M1ADILQMwiLrWO1NziQiklluLGtCebJ6Iveu+kbxvDqEBP5uGflz0khA0KhfU 4RhC54Lo5Yv9s7tmbdZnvmNermBmKRsbhkY9HHzdJsTxbhm8jDge4dctrmUSTFccddfyBi TJOVhjJZNNrXVD5PZIneRYGtER69/YEl96zi7E20kvNWZ1qt28d2QcF4/Ou7nW477UuR6I Z84Z81YZJ0KN41DEm7zuuCEFuNxQ1/8QaBa505XI4ph4RGLZKLOsuOfBz7zot4AOHAocc2 lL/iEJBwe1B+asl9NdKR2nliCrZHjmVyu1QLsfHzJsrGRKZ3tJY5bCmXY7n/7Q== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 09/11] net: ieee802154: atusb: Call _xmit_error() when a transmission fails Date: Thu, 3 Mar 2022 19:25:06 +0100 Message-Id: <20220303182508.288136-10-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ieee802154_xmit_error() is the right helper to call when a transmission has failed. Let's use it instead of open-coding it. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/atusb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index f27a5f535808..9fa7febddff2 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -271,9 +271,8 @@ static void atusb_tx_done(struct atusb *atusb, u8 seq) * unlikely case now that seq == expect is then true, but can * happen and fail with a tx_skb = NULL; */ - ieee802154_wake_queue(atusb->hw); - if (atusb->tx_skb) - dev_kfree_skb_irq(atusb->tx_skb); + ieee802154_xmit_error(atusb->hw, atusb->tx_skb, + IEEE802154_MAC_ERROR); } } From patchwork Thu Mar 3 18:25:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767913 X-Patchwork-Delegate: kuba@kernel.org 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 2A52EC433EF for ; Thu, 3 Mar 2022 18:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235760AbiCCS0U (ORCPT ); Thu, 3 Mar 2022 13:26:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235746AbiCCS0M (ORCPT ); Thu, 3 Mar 2022 13:26:12 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26A681A39E0; Thu, 3 Mar 2022 10:25:26 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9898F20003; Thu, 3 Mar 2022 18:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331924; 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=UFZnOBz8aMFd1WbMsX/Uc7Fh6yQaXNfh+zd09Zt00t4=; b=REM/dcX6cORTCoPW75osM2hpa46DFXWoip+5cbUlTiyQKncJezkP6jz8rLUbS9K4KgWj/G FIrVuU2D1ckt3LXEhjhln0v1A6gyII+XOymoXG63vEyLPntuReB5Ja372XXV4yuvpsO9ea ClpOJjFTpOa6ThyGEX3R23tLW7DNWuWNzBnaZ75DCt3sdBqt2qgzBhvvYEXLGnGw2I2jey 4dcWy1wf225YCG6zZTA2i9ioJi+O9Q3fD9kXzf6G9GqIfh3p2hh7xoVZHb6ZRLb2DdiA/b 9VgeTqVL/wExAWKiU/xHaYxmI5krBSebOd6s/RWfEKnf69oKdkCDnKvswdbEXQ== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 10/11] net: ieee802154: ca8210: Use core return codes instead of hardcoding them Date: Thu, 3 Mar 2022 19:25:07 +0100 Message-Id: <20220303182508.288136-11-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org All the error codes defined in this driver are generic and already defined in the ieee802154 main header. Let's just get rid of these extra definition and switch to the core's values. There is no functional change. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/ca8210.c | 178 ++++++++++++-------------------- 1 file changed, 68 insertions(+), 110 deletions(-) diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index fc74fa0f1ddd..116aece191cd 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -89,48 +89,6 @@ #define CA8210_TEST_INT_FILE_NAME "ca8210_test" #define CA8210_TEST_INT_FIFO_SIZE 256 -/* MAC status enumerations */ -#define MAC_SUCCESS (0x00) -#define MAC_ERROR (0x01) -#define MAC_CANCELLED (0x02) -#define MAC_READY_FOR_POLL (0x03) -#define MAC_COUNTER_ERROR (0xDB) -#define MAC_IMPROPER_KEY_TYPE (0xDC) -#define MAC_IMPROPER_SECURITY_LEVEL (0xDD) -#define MAC_UNSUPPORTED_LEGACY (0xDE) -#define MAC_UNSUPPORTED_SECURITY (0xDF) -#define MAC_BEACON_LOST (0xE0) -#define MAC_CHANNEL_ACCESS_FAILURE (0xE1) -#define MAC_DENIED (0xE2) -#define MAC_DISABLE_TRX_FAILURE (0xE3) -#define MAC_SECURITY_ERROR (0xE4) -#define MAC_FRAME_TOO_LONG (0xE5) -#define MAC_INVALID_GTS (0xE6) -#define MAC_INVALID_HANDLE (0xE7) -#define MAC_INVALID_PARAMETER (0xE8) -#define MAC_NO_ACK (0xE9) -#define MAC_NO_BEACON (0xEA) -#define MAC_NO_DATA (0xEB) -#define MAC_NO_SHORT_ADDRESS (0xEC) -#define MAC_OUT_OF_CAP (0xED) -#define MAC_PAN_ID_CONFLICT (0xEE) -#define MAC_REALIGNMENT (0xEF) -#define MAC_TRANSACTION_EXPIRED (0xF0) -#define MAC_TRANSACTION_OVERFLOW (0xF1) -#define MAC_TX_ACTIVE (0xF2) -#define MAC_UNAVAILABLE_KEY (0xF3) -#define MAC_UNSUPPORTED_ATTRIBUTE (0xF4) -#define MAC_INVALID_ADDRESS (0xF5) -#define MAC_ON_TIME_TOO_LONG (0xF6) -#define MAC_PAST_TIME (0xF7) -#define MAC_TRACKING_OFF (0xF8) -#define MAC_INVALID_INDEX (0xF9) -#define MAC_LIMIT_REACHED (0xFA) -#define MAC_READ_ONLY (0xFB) -#define MAC_SCAN_IN_PROGRESS (0xFC) -#define MAC_SUPERFRAME_OVERLAP (0xFD) -#define MAC_SYSTEM_ERROR (0xFF) - /* HWME attribute IDs */ #define HWME_EDTHRESHOLD (0x04) #define HWME_EDVALUE (0x06) @@ -551,58 +509,58 @@ static int link_to_linux_err(int link_status) return link_status; } switch (link_status) { - case MAC_SUCCESS: - case MAC_REALIGNMENT: + case IEEE802154_SUCCESS: + case IEEE802154_REALIGNMENT: return 0; - case MAC_IMPROPER_KEY_TYPE: + case IEEE802154_IMPROPER_KEY_TYPE: return -EKEYREJECTED; - case MAC_IMPROPER_SECURITY_LEVEL: - case MAC_UNSUPPORTED_LEGACY: - case MAC_DENIED: + case IEEE802154_IMPROPER_SECURITY_LEVEL: + case IEEE802154_UNSUPPORTED_LEGACY: + case IEEE802154_DENIED: return -EACCES; - case MAC_BEACON_LOST: - case MAC_NO_ACK: - case MAC_NO_BEACON: + case IEEE802154_BEACON_LOST: + case IEEE802154_NO_ACK: + case IEEE802154_NO_BEACON: return -ENETUNREACH; - case MAC_CHANNEL_ACCESS_FAILURE: - case MAC_TX_ACTIVE: - case MAC_SCAN_IN_PROGRESS: + case IEEE802154_CHANNEL_ACCESS_FAILURE: + case IEEE802154_TX_ACTIVE: + case IEEE802154_SCAN_IN_PROGRESS: return -EBUSY; - case MAC_DISABLE_TRX_FAILURE: - case MAC_OUT_OF_CAP: + case IEEE802154_DISABLE_TRX_FAILURE: + case IEEE802154_OUT_OF_CAP: return -EAGAIN; - case MAC_FRAME_TOO_LONG: + case IEEE802154_FRAME_TOO_LONG: return -EMSGSIZE; - case MAC_INVALID_GTS: - case MAC_PAST_TIME: + case IEEE802154_INVALID_GTS: + case IEEE802154_PAST_TIME: return -EBADSLT; - case MAC_INVALID_HANDLE: + case IEEE802154_INVALID_HANDLE: return -EBADMSG; - case MAC_INVALID_PARAMETER: - case MAC_UNSUPPORTED_ATTRIBUTE: - case MAC_ON_TIME_TOO_LONG: - case MAC_INVALID_INDEX: + case IEEE802154_INVALID_PARAMETER: + case IEEE802154_UNSUPPORTED_ATTRIBUTE: + case IEEE802154_ON_TIME_TOO_LONG: + case IEEE802154_INVALID_INDEX: return -EINVAL; - case MAC_NO_DATA: + case IEEE802154_NO_DATA: return -ENODATA; - case MAC_NO_SHORT_ADDRESS: + case IEEE802154_NO_SHORT_ADDRESS: return -EFAULT; - case MAC_PAN_ID_CONFLICT: + case IEEE802154_PAN_ID_CONFLICT: return -EADDRINUSE; - case MAC_TRANSACTION_EXPIRED: + case IEEE802154_TRANSACTION_EXPIRED: return -ETIME; - case MAC_TRANSACTION_OVERFLOW: + case IEEE802154_TRANSACTION_OVERFLOW: return -ENOBUFS; - case MAC_UNAVAILABLE_KEY: + case IEEE802154_UNAVAILABLE_KEY: return -ENOKEY; - case MAC_INVALID_ADDRESS: + case IEEE802154_INVALID_ADDRESS: return -ENXIO; - case MAC_TRACKING_OFF: - case MAC_SUPERFRAME_OVERLAP: + case IEEE802154_TRACKING_OFF: + case IEEE802154_SUPERFRAME_OVERLAP: return -EREMOTEIO; - case MAC_LIMIT_REACHED: + case IEEE802154_LIMIT_REACHED: return -EDQUOT; - case MAC_READ_ONLY: + case IEEE802154_READ_ONLY: return -EROFS; default: return -EPROTO; @@ -754,7 +712,7 @@ static void ca8210_rx_done(struct cas_control *cas_ctl) ca8210_net_rx(priv->hw, buf, len); if (buf[0] == SPI_MCPS_DATA_CONFIRM) { - if (buf[3] == MAC_TRANSACTION_OVERFLOW) { + if (buf[3] == IEEE802154_TRANSACTION_OVERFLOW) { dev_info( &priv->spi->dev, "Waiting for transaction overflow to stabilise...\n"); @@ -1128,7 +1086,7 @@ static u8 tdme_setsfr_request_sync( ); if (ret) { dev_crit(&spi->dev, "cascoda_api_downstream returned %d", ret); - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } if (response.command_id != SPI_TDME_SETSFR_CONFIRM) { @@ -1137,7 +1095,7 @@ static u8 tdme_setsfr_request_sync( "sync response to SPI_TDME_SETSFR_REQUEST was not SPI_TDME_SETSFR_CONFIRM, it was %d\n", response.command_id ); - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } return response.pdata.tdme_set_sfr_cnf.status; @@ -1151,7 +1109,7 @@ static u8 tdme_setsfr_request_sync( */ static u8 tdme_chipinit(void *device_ref) { - u8 status = MAC_SUCCESS; + u8 status = IEEE802154_SUCCESS; u8 sfr_address; struct spi_device *spi = device_ref; struct preamble_cfg_sfr pre_cfg_value = { @@ -1220,7 +1178,7 @@ static u8 tdme_chipinit(void *device_ref) goto finish; finish: - if (status != MAC_SUCCESS) { + if (status != IEEE802154_SUCCESS) { dev_err( &spi->dev, "failed to set sfr at %#03x, status = %#03x\n", @@ -1287,7 +1245,7 @@ static u8 tdme_checkpibattribute( const void *pib_attribute_value ) { - u8 status = MAC_SUCCESS; + u8 status = IEEE802154_SUCCESS; u8 value; value = *((u8 *)pib_attribute_value); @@ -1296,52 +1254,52 @@ static u8 tdme_checkpibattribute( /* PHY */ case PHY_TRANSMIT_POWER: if (value > 0x3F) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case PHY_CCA_MODE: if (value > 0x03) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; /* MAC */ case MAC_BATT_LIFE_EXT_PERIODS: if (value < 6 || value > 41) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_BEACON_PAYLOAD: if (pib_attribute_length > MAX_BEACON_PAYLOAD_LENGTH) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_BEACON_PAYLOAD_LENGTH: if (value > MAX_BEACON_PAYLOAD_LENGTH) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_BEACON_ORDER: if (value > 15) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_MAX_BE: if (value < 3 || value > 8) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_MAX_CSMA_BACKOFFS: if (value > 5) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_MAX_FRAME_RETRIES: if (value > 7) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_MIN_BE: if (value > 8) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_RESPONSE_WAIT_TIME: if (value < 2 || value > 64) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_SUPERFRAME_ORDER: if (value > 15) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; /* boolean */ case MAC_ASSOCIATED_PAN_COORD: @@ -1353,16 +1311,16 @@ static u8 tdme_checkpibattribute( case MAC_RX_ON_WHEN_IDLE: case MAC_SECURITY_ENABLED: if (value > 1) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; /* MAC SEC */ case MAC_AUTO_REQUEST_SECURITY_LEVEL: if (value > 7) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; case MAC_AUTO_REQUEST_KEY_ID_MODE: if (value > 3) - status = MAC_INVALID_PARAMETER; + status = IEEE802154_INVALID_PARAMETER; break; default: break; @@ -1522,9 +1480,9 @@ static u8 mcps_data_request( if (ca8210_spi_transfer(device_ref, &command.command_id, command.length + 2)) - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; - return MAC_SUCCESS; + return IEEE802154_SUCCESS; } /** @@ -1553,11 +1511,11 @@ static u8 mlme_reset_request_sync( &response.command_id, device_ref)) { dev_err(&spi->dev, "cascoda_api_downstream failed\n"); - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } if (response.command_id != SPI_MLME_RESET_CONFIRM) - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; status = response.pdata.status; @@ -1600,7 +1558,7 @@ static u8 mlme_set_request_sync( */ if (tdme_checkpibattribute( pib_attribute, pib_attribute_length, pib_attribute_value)) { - return MAC_INVALID_PARAMETER; + return IEEE802154_INVALID_PARAMETER; } if (pib_attribute == PHY_CURRENT_CHANNEL) { @@ -1636,11 +1594,11 @@ static u8 mlme_set_request_sync( command.length + 2, &response.command_id, device_ref)) { - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } if (response.command_id != SPI_MLME_SET_CONFIRM) - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; return response.pdata.status; } @@ -1678,11 +1636,11 @@ static u8 hwme_set_request_sync( command.length + 2, &response.command_id, device_ref)) { - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } if (response.command_id != SPI_HWME_SET_CONFIRM) - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; return response.pdata.hwme_set_cnf.status; } @@ -1714,13 +1672,13 @@ static u8 hwme_get_request_sync( command.length + 2, &response.command_id, device_ref)) { - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; } if (response.command_id != SPI_HWME_GET_CONFIRM) - return MAC_SYSTEM_ERROR; + return IEEE802154_SYSTEM_ERROR; - if (response.pdata.hwme_get_cnf.status == MAC_SUCCESS) { + if (response.pdata.hwme_get_cnf.status == IEEE802154_SUCCESS) { *hw_attribute_length = response.pdata.hwme_get_cnf.hw_attribute_length; memcpy( @@ -1770,7 +1728,7 @@ static int ca8210_async_xmit_complete( "Link transmission unsuccessful, status = %d\n", status ); - if (status != MAC_TRANSACTION_OVERFLOW) { + if (status != IEEE802154_TRANSACTION_OVERFLOW) { dev_kfree_skb_any(priv->tx_skb); ieee802154_wake_queue(priv->hw); return 0; @@ -2436,7 +2394,7 @@ static int ca8210_test_check_upstream(u8 *buf, void *device_ref) if (ret) { response[0] = SPI_MLME_SET_CONFIRM; response[1] = 3; - response[2] = MAC_INVALID_PARAMETER; + response[2] = IEEE802154_INVALID_PARAMETER; response[3] = buf[2]; response[4] = buf[3]; if (cascoda_api_upstream) From patchwork Thu Mar 3 18:25:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12767914 X-Patchwork-Delegate: kuba@kernel.org 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 988A0C433F5 for ; Thu, 3 Mar 2022 18:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235780AbiCCS0X (ORCPT ); Thu, 3 Mar 2022 13:26:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235752AbiCCS0N (ORCPT ); Thu, 3 Mar 2022 13:26:13 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB981A41E8; Thu, 3 Mar 2022 10:25:27 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id EEB7020007; Thu, 3 Mar 2022 18:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646331926; 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=7uhKeSJ5TdvqQx9rBcypmjG7Wuhjj3YD9ai0d1ExtG4=; b=mO3TVnTqxWTtGVsoBlWkZLBmRY3e0T8rjRSNAT7fdbjNgGGP/7Z2CxBNMJcPG67NkVtXSr ESmP9IATnJ4brMd6HA+Lmn2L7HdeNUFJ16UveDpglJPN4wRA4MhXHL/8W0id0Wyz/r/4Ay fZCo/Ada6ym8RI0N70PmwwpYF2UREAnGJqHzCPH62jc2n8S+bODqR6MN21O/bXk76eGt/1 TkDAvf+UPtzQlhGNXuMmgq8uA+cxW8z6PBkGvH8GFaRZNuvP1ve245ZChTr2n9b0O0Rov7 MDOSzQV402M4qLIIorpLDVYajSRom0Jzz9bLvhSRRiJ3Hycrj3PHZMevWYrOEg== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 11/11] net: ieee802154: ca8210: Call _xmit_error() when a transmission fails Date: Thu, 3 Mar 2022 19:25:08 +0100 Message-Id: <20220303182508.288136-12-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220303182508.288136-1-miquel.raynal@bootlin.com> References: <20220303182508.288136-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ieee802154_xmit_error() is the right helper to call when a transmission has failed. Let's use it instead of open-coding it. Signed-off-by: Miquel Raynal --- drivers/net/ieee802154/ca8210.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index 116aece191cd..b1eb74200f23 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -1729,11 +1729,11 @@ static int ca8210_async_xmit_complete( status ); if (status != IEEE802154_TRANSACTION_OVERFLOW) { - dev_kfree_skb_any(priv->tx_skb); - ieee802154_wake_queue(priv->hw); + ieee802154_xmit_error(priv->hw, priv->tx_skb, status); return 0; } } + ieee802154_xmit_complete(priv->hw, priv->tx_skb, true); return 0;