From patchwork Tue Apr 12 16:53:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: web+oss@zopieux.com X-Patchwork-Id: 8812751 Return-Path: X-Original-To: patchwork-linux-wpan@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19D45C0554 for ; Tue, 12 Apr 2016 16:53:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3781F2035B for ; Tue, 12 Apr 2016 16:53:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BFF92034F for ; Tue, 12 Apr 2016 16:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933074AbcDLQxm (ORCPT ); Tue, 12 Apr 2016 12:53:42 -0400 Received: from r0.smtpout1.alwaysdata.com ([176.31.58.0]:60163 "EHLO r0.smtpout1.alwaysdata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933090AbcDLQxl (ORCPT ); Tue, 12 Apr 2016 12:53:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alwaysdata.net; s=zopieux; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=VNgSWiyNzcCEACMyvJQR89n5HGBg5WoS9mLudfHmFKw=; b=QN6yY+PVTPvVqzSrslOq/9rfTw/adXL2g4tvrL1iMXCUHxMVlbJxn+64DB2AaMMUkn6mH9w4cx8++afy94XNukC2NI6luesZ+41sfqpdJLjiE/aUShJGHjOAi9YhJsrSB2/a/PMuQaU/t+DqUe+xPi6kTWlMSSi2OJouu7qRp14=; Received: from [2a01:cb15:82ab:3a00:290:f5ff:fecd:4ad7] (helo=alex-arch-laptop.localdomain) by smtpout1.roubaix1.alwaysdata.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84) (envelope-from ) id 1aq1ZH-0002qA-3B; Tue, 12 Apr 2016 18:53:35 +0200 From: Alexandre Macabies To: linux-wpan@vger.kernel.org Cc: marcel@holtmann.org, Alexandre Macabies , Alexander Aring Subject: [PATCH v3 2/3] mrf24j40: fix security-enabled processing on inbound frames Date: Tue, 12 Apr 2016 18:53:01 +0200 Message-Id: <1460479982-4955-2-git-send-email-web+oss@zopieux.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1460479982-4955-1-git-send-email-web+oss@zopieux.com> References: <1457988374-31220-1-git-send-email-web+oss@zopieux.com> <1460479982-4955-1-git-send-email-web+oss@zopieux.com> X-alwaysdata-ID: 138702652 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When receiving a security-enabled IEEE 802.15.4 frame, the MRF24J40 triggers a SECIF interrupt that needs to be handled for RX processing to keep functioning properly. This patch enables the SECIF interrupt and makes the MRF ignores all hardware processing of security-enabled frames, that is handled by the ieee802154 stack instead. Signed-off-by: Alexander Aring Signed-off-by: Alexandre Macabies Reviewed-by: Stefan Schmidt Acked-by: Alan Ott --- drivers/net/ieee802154/mrf24j40.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 764a2bd..adc67be 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c @@ -85,10 +85,13 @@ #define REG_INTSTAT 0x31 /* Interrupt Status */ #define BIT_TXNIF BIT(0) #define BIT_RXIF BIT(3) +#define BIT_SECIF BIT(4) +#define BIT_SECIGNORE BIT(7) #define REG_INTCON 0x32 /* Interrupt Control */ #define BIT_TXNIE BIT(0) #define BIT_RXIE BIT(3) +#define BIT_SECIE BIT(4) #define REG_GPIO 0x33 /* GPIO */ #define REG_TRISGPIO 0x34 /* GPIO direction */ @@ -616,7 +619,7 @@ static int mrf24j40_start(struct ieee802154_hw *hw) /* Clear TXNIE and RXIE. Enable interrupts */ return regmap_update_bits(devrec->regmap_short, REG_INTCON, - BIT_TXNIE | BIT_RXIE, 0); + BIT_TXNIE | BIT_RXIE | BIT_SECIE, 0); } static void mrf24j40_stop(struct ieee802154_hw *hw) @@ -1025,6 +1028,11 @@ static void mrf24j40_intstat_complete(void *context) enable_irq(devrec->spi->irq); + /* Ignore Rx security decryption */ + if (intstat & BIT_SECIF) + regmap_write_async(devrec->regmap_short, REG_SECCON0, + BIT_SECIGNORE); + /* Check for TX complete */ if (intstat & BIT_TXNIF) ieee802154_xmit_complete(devrec->hw, devrec->tx_skb, false);