aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00pci.c
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@kpnplanet.nl>2008-06-06 16:54:12 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:17:57 -0400
commit239c249d06b0c68ae06b10d9d6ad1f8e7f39452b (patch)
tree6d59d08b738406c525f084d043b9dfd91e711fb1 /drivers/net/wireless/rt2x00/rt2x00pci.c
parentd56d453a1dd85aff08fe6965f395049725fdb04e (diff)
rt2x00: Centralize RX packet alignment handling in rt2x00lib.
When rt2x00pci will be switched over to dynamically mapped skb's instead of statically allocated DMA buffers, it no longer can handle alignment of RX packets in a copy step, and needs to implement the same scheme as rt2x00usb does. In order to make the patch on dynamically mapped skb's smaller, already centralize the alignment handling into rt2x00lib. This allows us to move more code in rt2x00lib, and thus remove code duplication between rt2x00usb and rt2x00pci. Signed-off-by: Gertjan van Wingerde <gwingerde@kpnplanet.nl> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index a9819aad5e7d..82e80b69d0be 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -79,11 +79,8 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
79 struct data_queue *queue = rt2x00dev->rx; 79 struct data_queue *queue = rt2x00dev->rx;
80 struct queue_entry *entry; 80 struct queue_entry *entry;
81 struct queue_entry_priv_pci *entry_priv; 81 struct queue_entry_priv_pci *entry_priv;
82 struct ieee80211_hdr *hdr;
83 struct skb_frame_desc *skbdesc; 82 struct skb_frame_desc *skbdesc;
84 struct rxdone_entry_desc rxdesc; 83 struct rxdone_entry_desc rxdesc;
85 int header_size;
86 int align;
87 u32 word; 84 u32 word;
88 85
89 while (1) { 86 while (1) {
@@ -97,27 +94,15 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
97 memset(&rxdesc, 0, sizeof(rxdesc)); 94 memset(&rxdesc, 0, sizeof(rxdesc));
98 rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); 95 rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc);
99 96
100 hdr = (struct ieee80211_hdr *)entry_priv->data;
101 header_size =
102 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
103
104 /*
105 * The data behind the ieee80211 header must be
106 * aligned on a 4 byte boundary.
107 */
108 align = header_size % 4;
109
110 /* 97 /*
111 * Allocate the sk_buffer, initialize it and copy 98 * Allocate the sk_buffer and copy all data into it.
112 * all data into it.
113 */ 99 */
114 entry->skb = dev_alloc_skb(rxdesc.size + align); 100 entry->skb = rt2x00queue_alloc_rxskb(queue);
115 if (!entry->skb) 101 if (!entry->skb)
116 return; 102 return;
117 103
118 skb_reserve(entry->skb, align); 104 memcpy(entry->skb->data, entry_priv->data, rxdesc.size);
119 memcpy(skb_put(entry->skb, rxdesc.size), 105 skb_trim(entry->skb, rxdesc.size);
120 entry_priv->data, rxdesc.size);
121 106
122 /* 107 /*
123 * Fill in skb descriptor 108 * Fill in skb descriptor