2008-01-11 11:39:27

by Johannes Berg

[permalink] [raw]
Subject: A-MSDU reception vs. IP alignment

Hi Ron,

Even when we align the packet as indicated in the patch I just sent, we
can still copy the payload of an A-MSDU packet to a badly aligned place.

Could you maybe look into fixing that? Basically, I think all we need is
change

skb_reserve(frame, local->hw.extra_tx_headroom +
sizeof(struct ethhdr));

to something like

resv = ETH_HLEN + extra_tx_headroom;
if (resv % 4 != 2)
resv += 2 + (resv % 2);
skb_reserve(frame, resv);

(allocating an appropriately sized skb of course)

On the other hand, I also wrote in a note with that warn-on patch that
we can probably save the copying completely by simply doing a clone and
adjusting the length/offset properly. We already make a copy of the
frame in ieee80211_deliver_skb() when we pass it back for sending to the
wireless medium so that should be safe. And it'd be much more efficient
than copying all frames. I'd appreciate if you could look into it.

Thanks,
johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2008-01-12 12:44:56

by Ron Rindjunsky

[permalink] [raw]
Subject: Re: A-MSDU reception vs. IP alignment

agree, this fix will put the payload as 4 aligned in A-MSDU,
yet i also saw your thread with netdev, so i'll examine the issue once more

> Hi Ron,
>
> Even when we align the packet as indicated in the patch I just sent, we
> can still copy the payload of an A-MSDU packet to a badly aligned place.
>
> Could you maybe look into fixing that? Basically, I think all we need is
> change
>
> skb_reserve(frame, local->hw.extra_tx_headroom +
> sizeof(struct ethhdr));
>
> to something like
>
> resv = ETH_HLEN + extra_tx_headroom;
> if (resv % 4 != 2)
> resv += 2 + (resv % 2);
> skb_reserve(frame, resv);
>
> (allocating an appropriately sized skb of course)
>
> On the other hand, I also wrote in a note with that warn-on patch that
> we can probably save the copying completely by simply doing a clone and
> adjusting the length/offset properly. We already make a copy of the
> frame in ieee80211_deliver_skb() when we pass it back for sending to the
> wireless medium so that should be safe. And it'd be much more efficient
> than copying all frames. I'd appreciate if you could look into it.
>
> Thanks,
> johannes
>
>