Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183283
b: refs/heads/master
c: 77e73d1
h: refs/heads/master
i:
  183281: b38e08f
  183279: 837451c
v: v3
  • Loading branch information
Gertjan van Wingerde authored and John W. Linville committed Dec 21, 2009
1 parent 7d6a832 commit f80b92c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1398d4580eff2656f3a808ec24744ce5a842db35
refs/heads/master: 77e73d1849c860d22ebba8826ad162ccfda4c535
6 changes: 6 additions & 0 deletions trunk/drivers/net/wireless/rt2x00/rt2x00.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@
#define GET_DURATION(__size, __rate) (((__size) * 8 * 10) / (__rate))
#define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate))

/*
* Determine the number of L2 padding bytes required between the header and
* the payload.
*/
#define L2PAD_SIZE(__hdrlen) (-(__hdrlen) & 3)

/*
* Determine the alignment requirement,
* to make sure the 802.11 payload is padded to a 4-byte boundrary
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/net/wireless/rt2x00/rt2x00queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
unsigned int frame_length = skb->len;
unsigned int header_align = ALIGN_SIZE(skb, 0);
unsigned int payload_align = ALIGN_SIZE(skb, header_length);
unsigned int l2pad = 4 - (payload_align - header_align);
unsigned int l2pad = L2PAD_SIZE(header_length);

if (header_align == payload_align) {
/*
Expand Down Expand Up @@ -216,14 +216,15 @@ void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
memmove(skb->data + header_length + l2pad,
skb->data + header_length + l2pad + payload_align,
frame_length - header_length);
skb_trim(skb, frame_length + l2pad);
skbdesc->flags |= SKBDESC_L2_PADDED;
}
}

void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length)
{
struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
unsigned int l2pad = 4 - (header_length & 3);
unsigned int l2pad = L2PAD_SIZE(header_length);

if (!l2pad || (skbdesc->flags & SKBDESC_L2_PADDED))
return;
Expand Down Expand Up @@ -346,7 +347,8 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
* Header and alignment information.
*/
txdesc->header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
txdesc->l2pad = ALIGN_SIZE(entry->skb, txdesc->header_length);
if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
txdesc->l2pad = L2PAD_SIZE(txdesc->header_length);

/*
* Check whether this frame is to be acked.
Expand Down

0 comments on commit f80b92c

Please sign in to comment.