Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195143
b: refs/heads/master
c: 3f78d1f
h: refs/heads/master
i:
  195141: b2305e9
  195139: dd112f0
  195135: 2a1d4c3
v: v3
  • Loading branch information
Neil Jones authored and David S. Miller committed May 18, 2010
1 parent c19caea commit 8e43062
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 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: e7a3af5d8cd782b84e6ca4e4dcc8613be1a809f0
refs/heads/master: 3f78d1f210ff89af77f042ab7f4a8fee39feb1c9
34 changes: 33 additions & 1 deletion trunk/drivers/net/usb/asix.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,48 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
/* get the packet length */
size = (u16) (header & 0x0000ffff);

if ((skb->len) - ((size + 1) & 0xfffe) == 0)
if ((skb->len) - ((size + 1) & 0xfffe) == 0) {
u8 alignment = (u32)skb->data & 0x3;
if (alignment != 0x2) {
/*
* not 16bit aligned so use the room provided by
* the 32 bit header to align the data
*
* note we want 16bit alignment as MAC header is
* 14bytes thus ip header will be aligned on
* 32bit boundary so accessing ipheader elements
* using a cast to struct ip header wont cause
* an unaligned accesses.
*/
u8 realignment = (alignment + 2) & 0x3;
memmove(skb->data - realignment,
skb->data,
size);
skb->data -= realignment;
skb_set_tail_pointer(skb, size);
}
return 2;
}

if (size > ETH_FRAME_LEN) {
netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
size);
return 0;
}
ax_skb = skb_clone(skb, GFP_ATOMIC);
if (ax_skb) {
u8 alignment = (u32)packet & 0x3;
ax_skb->len = size;

if (alignment != 0x2) {
/*
* not 16bit aligned use the room provided by
* the 32 bit header to align the data
*/
u8 realignment = (alignment + 2) & 0x3;
memmove(packet - realignment, packet, size);
packet -= realignment;
}
ax_skb->data = packet;
skb_set_tail_pointer(ax_skb, size);
usbnet_skb_return(dev, ax_skb);
Expand Down

0 comments on commit 8e43062

Please sign in to comment.