From patchwork Fri Jan 11 19:33:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 1967151 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 590F83FE37 for ; Fri, 11 Jan 2013 19:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032Ab3AKTd0 (ORCPT ); Fri, 11 Jan 2013 14:33:26 -0500 Received: from mail-bk0-f53.google.com ([209.85.214.53]:64823 "EHLO mail-bk0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347Ab3AKTdZ (ORCPT ); Fri, 11 Jan 2013 14:33:25 -0500 Received: by mail-bk0-f53.google.com with SMTP id j5so1130414bkw.26 for ; Fri, 11 Jan 2013 11:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:to:cc:date:mime-version:x-length:x-uid :content-type:content-transfer-encoding:message-id; bh=Fo/kJxbqp6jot2Z2uRsTTfKchcV9n2G8OCNfDCWpumo=; b=Y97YWOYSsf4sCsuVwFpuN2oT5dtmnEkNnvxmGzNYC2woPLN+o17twsyybeVjj5bhDG JHTQ9kAXWuf00H3f9NBP5uj1gRvk7Mkic7ZUO1UKq14KYmKD4EFFkbDVBZrKqhGijDaF T/MT9R8Lb5Y3wGYmQx2YVIps+dNo+ChLa7yVgW+tbDNQDmUoq95z0GUsMkJte8sQa4Gx v6bF9eAcJxMQuKouzxJjN5nULBTCQGQFH6j1Pzjd72grn5UdXtR6LlKVIJCStW/ptUec 4nKov+5Ea520jGiCWrO8fEYKbLiO7wf3C/TpZeMP5042FVK0TAixk+lSqsaowo7rxgAd dEgw== X-Received: by 10.204.5.135 with SMTP id 7mr36385964bkv.48.1357932804583; Fri, 11 Jan 2013 11:33:24 -0800 (PST) Received: from debian64.localnet (pD9F89F0D.dip.t-dialin.net. [217.248.159.13]) by mx.google.com with ESMTPS id u3sm5357859bkw.9.2013.01.11.11.33.22 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 11 Jan 2013 11:33:23 -0800 (PST) Received: from localhost ([127.0.0.1] helo=debian64.localnet ident=chuck) by debian64.localnet with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1TtkLx-00048W-3x; Fri, 11 Jan 2013 20:33:21 +0100 Subject: [RFC] ath9k: report A-MPDU status From: Christian Lamparter To: linux-wireless@vger.kernel.org Cc: Felix Fietkau , senthilb@qca.qualcomm.com, vthiagar@qca.qualcomm.com, Adrian Chadd Date: Fri, 11 Jan 2013 20:33:18 +0100 MIME-Version: 1.0 X-Length: 3558 X-UID: 98 Message-Id: <201301112033.19437.chunkeey@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The ath9k hardware reports whenever an frame was part of an A-MPDU. MAC80211 already provides the necessary API to pass this additional information along to whomever needs it. --- Knowing whenever a received frame was part of an A-MPDU allows mac80211 to react to A-MPDUs which have no valid BA agreement in place. This patch (together with the mac80211 part in: ) helps to improve network stability. The new code implements parts of the recommendations from 802.11-2012 10.5.4 "Error recovery upon a peer failure". While this patch works OK, I think it still needs be improved further: - ath9k_apply_ampdu_details is a separate subroutine and it is called a bit 'late'. However, I'm not sure if moving it to a different place like ath9k_rx_skb_preprocess would be any better. it's because we need to have access to ampdu_ref, which is currently stored in ath_softc.rx. - What about the MPDU delimiter crc? Is it possible to retrieve it from the rx header, or is it lost? - (How to handle zero length subframes? This would be a nice to have feature [i.e.: if someone wants to check if a HT peer really cares about the ampdu density]. However it should be disabled unless we have a running monitor interface.) BTW: Support for the AMPDU_DETAILS radiotap extension has already been added to wireshark. Just make sure you get the latest svn/git source (1.9.0). Regards, Chr --- drivers/net/wireless/ath/ath9k/ath9k.h | 2 ++ drivers/net/wireless/ath/ath9k/recv.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 094a932..262fb71 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h @@ -320,6 +320,8 @@ struct ath_rx { struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; struct sk_buff *frag; + + u32 ampdu_ref; }; int ath_startrecv(struct ath_softc *sc); diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 45f2d47..775cafd 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -1128,6 +1128,24 @@ static void ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, #endif } +static void ath9k_apply_ampdu_details(struct ath_softc *sc, + struct ath_rx_status *rs, struct ieee80211_rx_status *rxs) +{ + if (rs->rs_isaggr) { + rxs->flag |= RX_FLAG_AMPDU_DETAILS | RX_FLAG_AMPDU_LAST_KNOWN; + + rxs->ampdu_reference = sc->rx.ampdu_ref; + + if (!rs->rs_moreaggr) { + rxs->flag |= RX_FLAG_AMPDU_IS_LAST; + sc->rx.ampdu_ref++; + } + + if (rs->rs_flags & ATH9K_RX_DELIM_CRC_PRE) + rxs->flag |= RX_FLAG_AMPDU_DELIM_CRC_ERROR; + } +} + int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) { struct ath_buf *bf; @@ -1343,6 +1362,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx == 3) ath_ant_comb_scan(sc, &rs); + ath9k_apply_ampdu_details(sc, &rs, rxs); + ieee80211_rx(hw, skb); requeue_drop_frag: