From patchwork Fri Jun 13 21:40:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathy Vanhoef X-Patchwork-Id: 4351801 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 094B29F314 for ; Fri, 13 Jun 2014 21:40:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E204B2026D for ; Fri, 13 Jun 2014 21:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0046420268 for ; Fri, 13 Jun 2014 21:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbaFMVk0 (ORCPT ); Fri, 13 Jun 2014 17:40:26 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:58275 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751986AbaFMVk0 (ORCPT ); Fri, 13 Jun 2014 17:40:26 -0400 Received: by mail-wi0-f175.google.com with SMTP id r20so1568866wiv.14 for ; Fri, 13 Jun 2014 14:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=7Msk0li7zgiTX35vlCQvkuF3t7aOPxIYk+HpZ3n3ptc=; b=cSMDrN+gnOaARFxXkRORZHSTuewuS6pkzvGVkHGgosgtNhCsacVYK8yjzjpsOKnkhL JyZR1iW1vn0kfVjiRJZXxE066qrIvGS2SiLm/VBx6UghK9OTg1RGNIP7pjNtq7TvVh6V icK5oYMcW4SvvIHlHupNrLzYgW+ODA3rPuCo9NJpk48+5mG5RM7lCMfFa762BJaZmxr3 oWHjgz3nnAaCzWREcnyrMjIzYgOrxCZdeoXKQZfKFJ9/dPTEj5xWy1kr3jyn/7xIeY+Q OcajfmnWKHbNU7TwMXYw7LynB1JsIxxFcK7OrClMo72MnfjgZyIoU58VbGW++tK4iYuD oXjw== X-Received: by 10.194.200.65 with SMTP id jq1mr7747423wjc.33.1402695624878; Fri, 13 Jun 2014 14:40:24 -0700 (PDT) Received: from ?IPv6:2a02:2c40:100:a000:71d3:36df:1e48:f164? ([2a02:2c40:100:a000:71d3:36df:1e48:f164]) by mx.google.com with ESMTPSA id d6sm4600404wiz.4.2014.06.13.14.40.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Jun 2014 14:40:24 -0700 (PDT) Message-ID: <539B6FC6.8000803@gmail.com> Date: Fri, 13 Jun 2014 23:40:22 +0200 From: Mathy Vanhoef User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: "John W. Linville" CC: linux-wireless@vger.kernel.org, Jiri Slaby , Nick Kossifidis , "Luis R. Rodriguez" , ath5k-devel@lists.ath5k.org Subject: [PATCH 1/2] ath5k: support for FIF_FCSFAIL filter Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 Hi all, Currently ath5k can't report frames with CRC errors. In ath5k_configure_filter it actually sets the hardware filter properly when the FIF_FCSFAIL flag is set. However, in other functions the necessary checks weren't being done. This patch fixes that. --- From: "Mathy Vanhoef" When the FIF_FCSFAIL filter flag is set, pass frames with CRC errors. Signed-off-by: Mathy Vanhoef --- drivers/net/wireless/ath/ath5k/ath5k.h | 1 + drivers/net/wireless/ath/ath5k/base.c | 16 ++++++++++++++-- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index d03e4dd..1054f19 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h @@ -1285,6 +1285,7 @@ struct ath5k_hw { #define ATH_STAT_STARTED 3 /* opened & irqs enabled */ unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ + unsigned int fif_filter_flags; /* Current FIF_* filter flags */ struct ieee80211_channel *curchan; /* current h/w channel */ u16 nvifs; diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index e9aed98..39ba642 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -1382,6 +1382,9 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb, rxs->flag = 0; if (unlikely(rs->rs_status & AR5K_RXERR_MIC)) rxs->flag |= RX_FLAG_MMIC_ERROR; + if (unlikely(rs->rs_status & AR5K_RXERR_CRC)) + rxs->flag |= RX_FLAG_FAILED_FCS_CRC; + /* * always extend the mac timestamp, since this information is @@ -1449,6 +1452,8 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) ah->stats.rx_bytes_count += rs->rs_datalen; if (unlikely(rs->rs_status)) { + unsigned int filters; + if (rs->rs_status & AR5K_RXERR_CRC) ah->stats.rxerr_crc++; if (rs->rs_status & AR5K_RXERR_FIFO) @@ -1480,8 +1485,15 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) return true; } - /* reject any frames with non-crypto errors */ - if (rs->rs_status & ~(AR5K_RXERR_DECRYPT)) + /* + * Reject any frames with non-crypto errors, and take into account the + * current FIF_* filters. + */ + filters = AR5K_RXERR_DECRYPT; + if (ah->fif_filter_flags & FIF_FCSFAIL) + filters |= AR5K_RXERR_CRC; + + if (rs->rs_status & ~filters) return false; } diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index afb23b3..b65c38f 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c @@ -473,6 +473,8 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, /* Set the cached hw filter flags, this will later actually * be set in HW */ ah->filter_flags = rfilt; + /* Store current FIF filter flags */ + ah->fif_filter_flags = *new_flags; mutex_unlock(&ah->lock); }