From patchwork Thu Mar 10 18:14:02 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: 8559291 Return-Path: X-Original-To: patchwork-linux-wpan@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A153D9F38C for ; Thu, 10 Mar 2016 18:15:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF5592011D for ; Thu, 10 Mar 2016 18:15:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C0132014A for ; Thu, 10 Mar 2016 18:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754323AbcCJSPA (ORCPT ); Thu, 10 Mar 2016 13:15:00 -0500 Received: from r0.smtpout1.alwaysdata.com ([176.31.58.0]:36729 "EHLO r0.smtpout1.alwaysdata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753676AbcCJSO7 (ORCPT ); Thu, 10 Mar 2016 13:14:59 -0500 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=X7EPaSikCP1ITSj/DeUWqVMxXUcLpcx9Nys8nwOdnKg=; b=egKpU+x2fzGtYK3fH2tvRAJ1m9uZSQ73WV03j95pbxxEbyVRacEXIwx3l6fzhrR0srM92I83XIYJA0hvGdTOxrs96UQxu8m2nIJrj3UBroBIhocd0Ra49etl9dkF6jeXUv4Tg3bqMe5ntL//lnkB+bKFGZpaZB1ERGEz4xBmloE=; Received: from agrenoble-651-1-452-143.w82-122.abo.wanadoo.fr ([82.122.156.143] 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 1ae56u-0001jE-0J; Thu, 10 Mar 2016 19:14:56 +0100 From: web+oss@zopieux.com To: linux-wpan@vger.kernel.org Cc: Alexandre Macabies , Alexander Aring Subject: [PATCH 2/3] mrf24j40: fix security-enabled processing on inbound frames Date: Thu, 10 Mar 2016 19:14:02 +0100 Message-Id: <1457633643-12535-2-git-send-email-web+oss@zopieux.com> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1457633643-12535-1-git-send-email-web+oss@zopieux.com> References: <1457633643-12535-1-git-send-email-web+oss@zopieux.com> X-alwaysdata-ID: 132090411 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Spam-Status: No, score=-6.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 From: Alexandre Macabies 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 Reported-by: Alexandre Macabies Tested-by: Alexandre Macabies Reviewed-by: Stefan Schmidt --- drivers/net/ieee802154/mrf24j40.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 764a2bd..96814cf 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c @@ -85,10 +85,12 @@ #define REG_INTSTAT 0x31 /* Interrupt Status */ #define BIT_TXNIF BIT(0) #define BIT_RXIF BIT(3) +#define BIT_SECIF BIT(4) #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 +618,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 +1027,9 @@ static void mrf24j40_intstat_complete(void *context) enable_irq(devrec->spi->irq); + if (intstat & BIT_SECIF) + regmap_write_async(devrec->regmap_short, REG_SECCON0, 0x80); + /* Check for TX complete */ if (intstat & BIT_TXNIF) ieee802154_xmit_complete(devrec->hw, devrec->tx_skb, false);