Return-path: Received: from an-out-0708.google.com ([209.85.132.241]:14627 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755345AbYLPPmr (ORCPT ); Tue, 16 Dec 2008 10:42:47 -0500 Received: by an-out-0708.google.com with SMTP id d40so1319123and.1 for ; Tue, 16 Dec 2008 07:42:46 -0800 (PST) Message-ID: (sfid-20081216_164257_290756_C2F2F726) Date: Tue, 16 Dec 2008 10:42:45 -0500 From: "Bob Copeland" To: "Benoit PAPILLAULT" Subject: Re: [PATCH] ath5k: Updated padding stuff for the RX and TX side. TX side has been 100% Cc: "Jouni Malinen" , linville@tuxdriver.com, linux-wireless@vger.kernel.org, ath5k-devel@venema.h4ckr.net In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2790_10307841.1229442165517" References: <1229351698-21116-1-git-send-email-benoit.papillault@free.fr> <20081215170613.GA22627@jm.kir.nu> <4946C6D9.1060101@free.fr> Sender: linux-wireless-owner@vger.kernel.org List-ID: ------=_Part_2790_10307841.1229442165517 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Dec 16, 2008 at 10:22 AM, Bob Copeland wrote: > On Mon, Dec 15, 2008 at 4:06 PM, Benoit PAPILLAULT > wrote: > Well, anyway John already picked up your earlier (better, IMHO) patch. > Now we just need to fix the tx descriptors :) i.e. something like the following (attached as well because gmail will destroy it). I only compile-tested it. diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h index 13df119..183ffc8 100644 --- a/drivers/net/wireless/ath5k/ath5k.h +++ b/drivers/net/wireless/ath5k/ath5k.h @@ -1350,4 +1350,9 @@ static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) return retval; } +static inline int ath5k_pad_size(int hdrlen) +{ + return (hdrlen < 24) ? 0 : hdrlen & 3; +} + #endif diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index f222b4a..0c3e186 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c @@ -1754,8 +1754,8 @@ accept: * not try to remove padding from short control frames that do * not have payload. */ hdrlen = ieee80211_get_hdrlen_from_skb(skb); - padsize = hdrlen & 3; - if (padsize && hdrlen >= 24) { + padsize = ath5k_pad_size(hdrlen); + if (padsize) { memmove(skb->data + padsize, skb->data, hdrlen); skb_pull(skb, padsize); } @@ -2620,8 +2620,8 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) * if this is not the case we add the padding after the header */ hdrlen = ieee80211_get_hdrlen_from_skb(skb); - padsize = hdrlen & 3; - if (padsize && hdrlen >= 24) { + padsize = ath5k_pad_size(hdrlen); + if (padsize) { if (skb_headroom(skb) < padsize) { ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough" diff --git a/drivers/net/wireless/ath5k/desc.c b/drivers/net/wireless/ath5k/desc.c index 5e362a7..b40a928 100644 --- a/drivers/net/wireless/ath5k/desc.c +++ b/drivers/net/wireless/ath5k/desc.c @@ -71,7 +71,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, /* Verify and set frame length */ /* remove padding we might have added before */ - frame_len = pkt_len - (hdr_len & 3) + FCS_LEN; + frame_len = pkt_len - ath5k_pad_size(hdr_len) + FCS_LEN; if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN) return -EINVAL; @@ -202,7 +202,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah, /* Verify and set frame length */ /* remove padding we might have added before */ - frame_len = pkt_len - (hdr_len & 3) + FCS_LEN; + frame_len = pkt_len - ath5k_pad_size(hdr_len) + FCS_LEN; if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN) return -EINVAL; -- Bob Copeland %% www.bobcopeland.com ------=_Part_2790_10307841.1229442165517 Content-Type: text/x-diff; name=fix_pad.patch Content-Transfer-Encoding: base64 X-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