From patchwork Tue Nov 24 14:49:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit PAPILLAULT X-Patchwork-Id: 62461 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAOEnaiP009894 for ; Tue, 24 Nov 2009 14:49:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933133AbZKXOt2 (ORCPT ); Tue, 24 Nov 2009 09:49:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933069AbZKXOt2 (ORCPT ); Tue, 24 Nov 2009 09:49:28 -0500 Received: from smtp2e.orange.fr ([80.12.242.113]:22997 "EHLO smtp2e.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933126AbZKXOt1 (ORCPT ); Tue, 24 Nov 2009 09:49:27 -0500 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2e23.orange.fr (SMTP Server) with ESMTP id EC7F88000CFE; Tue, 24 Nov 2009 15:49:32 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2e23.orange.fr (SMTP Server) with ESMTP id DB0DC80013FC; Tue, 24 Nov 2009 15:49:32 +0100 (CET) Received: from benoit-laptop (LNeuilly-152-21-11-6.w193-253.abo.wanadoo.fr [193.253.42.6]) by mwinf2e23.orange.fr (SMTP Server) with ESMTP id B99858000CFE; Tue, 24 Nov 2009 15:49:32 +0100 (CET) X-ME-UUID: 20091124144932760.B99858000CFE@mwinf2e23.orange.fr Received: by benoit-laptop (Postfix, from userid 1000) id 46DDA1DE051; Tue, 24 Nov 2009 15:49:32 +0100 (CET) From: Benoit Papillault To: lrodriguez@atheros.com Cc: jmalinen@atheros.com, linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net Subject: [PATCH] ath9k: This patch fix RX unpadding for any received frame. Date: Tue, 24 Nov 2009 15:49:17 +0100 Message-Id: <1259074158-2101-1-git-send-email-benoit.papillault@free.fr> X-Mailer: git-send-email 1.6.3.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 2f1e161..4a13632 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c @@ -231,26 +231,35 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common, { struct ath_hw *ah = common->ah; struct ieee80211_hdr *hdr; - int hdrlen, padsize; + int hdrlen, padpos, padsize; u8 keyix; __le16 fc; /* see if any padding is done by the hw and remove it */ hdr = (struct ieee80211_hdr *) skb->data; hdrlen = ieee80211_get_hdrlen_from_skb(skb); + padpos = 24; fc = hdr->frame_control; + if ((fc & cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) == + cpu_to_le16(IEEE80211_FCTL_FROMDS|IEEE80211_FCTL_TODS)) { + padpos += 6; /* ETH_ALEN */ + } + if ((fc & cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FCTL_FTYPE)) == + cpu_to_le16(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) { + padpos += 2; + } /* The MAC header is padded to have 32-bit boundary if the * packet payload is non-zero. The general calculation for * padsize would take into account odd header lengths: - * padsize = (4 - hdrlen % 4) % 4; However, since only + * padsize = (4 - padpos % 4) % 4; However, since only * even-length headers are used, padding can only be 0 or 2 * bytes and we can optimize this a bit. In addition, we must * not try to remove padding from short control frames that do * not have payload. */ - padsize = hdrlen & 3; - if (padsize && hdrlen >= 24) { - memmove(skb->data + padsize, skb->data, hdrlen); + padsize = padpos & 3; + if (padsize && skb->len>=padpos+padsize+FCS_LEN) { + memmove(skb->data + padsize, skb->data, padpos); skb_pull(skb, padsize); }