diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 661cf3d7212a..3be4c7ea8dd1 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1129,20 +1129,22 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
1129 | __le32 *rxd = | 1129 | __le32 *rxd = |
1130 | (__le32 *)(entry->skb->data + | 1130 | (__le32 *)(entry->skb->data + |
1131 | (priv_rx->urb->actual_length - entry->queue->desc_size)); | 1131 | (priv_rx->urb->actual_length - entry->queue->desc_size)); |
1132 | unsigned int offset = entry->queue->desc_size + 2; | ||
1133 | u32 word0; | 1132 | u32 word0; |
1134 | u32 word1; | 1133 | u32 word1; |
1135 | 1134 | ||
1136 | /* | 1135 | /* |
1137 | * Copy descriptor to the available headroom inside the skbuffer. | 1136 | * Copy descriptor to the skb->cb array, this has 2 benefits: |
1137 | * 1) Each descriptor word is 4 byte aligned. | ||
1138 | * 2) Descriptor is safe from moving of frame data in rt2x00usb. | ||
1138 | */ | 1139 | */ |
1139 | skb_push(entry->skb, offset); | 1140 | skbdesc->desc_len = |
1140 | memcpy(entry->skb->data, rxd, entry->queue->desc_size); | 1141 | min_t(u16, entry->queue->desc_size, sizeof(entry->skb->cb)); |
1141 | rxd = (__le32 *)entry->skb->data; | 1142 | memcpy(entry->skb->cb, rxd, skbdesc->desc_len); |
1143 | skbdesc->desc = entry->skb->cb; | ||
1144 | rxd = (__le32 *)skbdesc->desc; | ||
1142 | 1145 | ||
1143 | /* | 1146 | /* |
1144 | * The descriptor is now aligned to 4 bytes and thus it is | 1147 | * It is now safe to read the descriptor on all architectures. |
1145 | * now safe to read it on all architectures. | ||
1146 | */ | 1148 | */ |
1147 | rt2x00_desc_read(rxd, 0, &word0); | 1149 | rt2x00_desc_read(rxd, 0, &word0); |
1148 | rt2x00_desc_read(rxd, 1, &word1); | 1150 | rt2x00_desc_read(rxd, 1, &word1); |
@@ -1173,16 +1175,9 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
1173 | /* | 1175 | /* |
1174 | * Adjust the skb memory window to the frame boundaries. | 1176 | * Adjust the skb memory window to the frame boundaries. |
1175 | */ | 1177 | */ |
1176 | skb_pull(entry->skb, offset); | ||
1177 | skb_trim(entry->skb, rxdesc->size); | 1178 | skb_trim(entry->skb, rxdesc->size); |
1178 | |||
1179 | /* | ||
1180 | * Set descriptor and data pointer. | ||
1181 | */ | ||
1182 | skbdesc->data = entry->skb->data; | 1179 | skbdesc->data = entry->skb->data; |
1183 | skbdesc->data_len = rxdesc->size; | 1180 | skbdesc->data_len = rxdesc->size; |
1184 | skbdesc->desc = rxd; | ||
1185 | skbdesc->desc_len = entry->queue->desc_size; | ||
1186 | } | 1181 | } |
1187 | 1182 | ||
1188 | /* | 1183 | /* |