Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/linville/wireless-next-2.6
  • Loading branch information
David S. Miller committed Dec 22, 2008
2 parents c94cb31 + 9cf7f24 commit c2da953
Show file tree
Hide file tree
Showing 50 changed files with 1,166 additions and 651 deletions.
5 changes: 5 additions & 0 deletions drivers/net/wireless/ath5k/ath5k.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 21 additions & 17 deletions drivers/net/wireless/ath5k/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ ath5k_tasklet_rx(unsigned long data)
struct ath5k_desc *ds;
int ret;
int hdrlen;
int pad;
int padsize;

spin_lock(&sc->rxbuflock);
if (list_empty(&sc->rxbuf)) {
Expand Down Expand Up @@ -1753,16 +1753,19 @@ ath5k_tasklet_rx(unsigned long data)

skb_put(skb, rs.rs_datalen);

/*
* the hardware adds a padding to 4 byte boundaries between
* the header and the payload data if the header length is
* not multiples of 4 - remove it
*/
/* 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
* 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. */
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
if (hdrlen & 3) {
pad = hdrlen % 4;
memmove(skb->data + pad, skb->data, hdrlen);
skb_pull(skb, pad);
padsize = ath5k_pad_size(hdrlen);
if (padsize) {
memmove(skb->data + padsize, skb->data, hdrlen);
skb_pull(skb, padsize);
}

/*
Expand Down Expand Up @@ -2623,7 +2626,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
struct ath5k_buf *bf;
unsigned long flags;
int hdrlen;
int pad;
int padsize;

ath5k_debug_dump_skb(sc, skb, "TX ", 1);

Expand All @@ -2635,15 +2638,16 @@ 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);
if (hdrlen & 3) {
pad = hdrlen % 4;
if (skb_headroom(skb) < pad) {
padsize = ath5k_pad_size(hdrlen);
if (padsize) {

if (skb_headroom(skb) < padsize) {
ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough"
" headroom to pad %d\n", hdrlen, pad);
" headroom to pad %d\n", hdrlen, padsize);
return -1;
}
skb_push(skb, pad);
memmove(skb->data, skb->data+pad, hdrlen);
skb_push(skb, padsize);
memmove(skb->data, skb->data+padsize, hdrlen);
}

spin_lock_irqsave(&sc->txbuflock, flags);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath5k/desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath9k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ struct ath_softc {
struct ath_hal *sc_ah;
void __iomem *mem;
spinlock_t sc_resetlock;
struct mutex mutex;

u8 sc_curbssid[ETH_ALEN];
u8 sc_myaddr[ETH_ALEN];
Expand Down
Loading

0 comments on commit c2da953

Please sign in to comment.