aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2010-05-11 17:51:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-12 16:50:52 -0400
commitfd76f148ebc67d662f71f00128c8ddb0538168c0 (patch)
tree24abb0f0cdcd1ff1961324b32ce0a2602548ee7e
parent185e5f77f891d5bc7a0d8c8eb2b1edf6c317edab (diff)
rt2x00: In debugfs frame dumping allow the TX descriptor to be part of the skb.
Preparation for futher cleanups in the area of properly maintaining the skb data without fiddling with the skb->data pointer. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h3
2 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index 9e2eed51e167..1e81eef9ca1a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -159,6 +159,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
159 struct sk_buff *skbcopy; 159 struct sk_buff *skbcopy;
160 struct rt2x00dump_hdr *dump_hdr; 160 struct rt2x00dump_hdr *dump_hdr;
161 struct timeval timestamp; 161 struct timeval timestamp;
162 u32 data_len;
162 163
163 do_gettimeofday(&timestamp); 164 do_gettimeofday(&timestamp);
164 165
@@ -170,7 +171,11 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
170 return; 171 return;
171 } 172 }
172 173
173 skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + skb->len, 174 data_len = skb->len;
175 if (skbdesc->flags & SKBDESC_DESC_IN_SKB)
176 data_len -= skbdesc->desc_len;
177
178 skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + data_len,
174 GFP_ATOMIC); 179 GFP_ATOMIC);
175 if (!skbcopy) { 180 if (!skbcopy) {
176 DEBUG(rt2x00dev, "Failed to copy skb for dump.\n"); 181 DEBUG(rt2x00dev, "Failed to copy skb for dump.\n");
@@ -181,7 +186,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
181 dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION); 186 dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION);
182 dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr)); 187 dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr));
183 dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len); 188 dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len);
184 dump_hdr->data_length = cpu_to_le32(skb->len); 189 dump_hdr->data_length = cpu_to_le32(data_len);
185 dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); 190 dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt);
186 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); 191 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf);
187 dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); 192 dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev);
@@ -191,8 +196,9 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
191 dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); 196 dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec);
192 dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); 197 dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec);
193 198
194 memcpy(skb_put(skbcopy, skbdesc->desc_len), skbdesc->desc, 199 if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB))
195 skbdesc->desc_len); 200 memcpy(skb_put(skbcopy, skbdesc->desc_len), skbdesc->desc,
201 skbdesc->desc_len);
196 memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len); 202 memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len);
197 203
198 skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy); 204 skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy);
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 36a957adc1f9..f79170849add 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -94,12 +94,15 @@ enum data_queue_qid {
94 * mac80211 but was stripped for processing by the driver. 94 * mac80211 but was stripped for processing by the driver.
95 * @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211, 95 * @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211,
96 * don't try to pass it back. 96 * don't try to pass it back.
97 * @SKBDESC_DESC_IN_SKB: The descriptor is at the start of the
98 * skb, instead of in the desc field.
97 */ 99 */
98enum skb_frame_desc_flags { 100enum skb_frame_desc_flags {
99 SKBDESC_DMA_MAPPED_RX = 1 << 0, 101 SKBDESC_DMA_MAPPED_RX = 1 << 0,
100 SKBDESC_DMA_MAPPED_TX = 1 << 1, 102 SKBDESC_DMA_MAPPED_TX = 1 << 1,
101 SKBDESC_IV_STRIPPED = 1 << 2, 103 SKBDESC_IV_STRIPPED = 1 << 2,
102 SKBDESC_NOT_MAC80211 = 1 << 3, 104 SKBDESC_NOT_MAC80211 = 1 << 3,
105 SKBDESC_DESC_IN_SKB = 1 << 4,
103}; 106};
104 107
105/** 108/**