aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-05-05 11:23:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-12 21:22:17 -0400
commit78720897459a0ed3843c80e9bd9ef1b2f7ae5c8f (patch)
tree7ae55076399b4f58ff12e4bb8ca32a4e1738b83d /drivers/net/wireless/rt2x00/rt61pci.c
parent6243065d308ab566aa318a8adef853bc0418896d (diff)
rt2x00: Don't use pskb_expand_head()
rt2x00pci allocates DMA for descriptor and data, rt61pci doesn't use this for the beacon, but it can use the descriptor part as temporary buffer instead of using pskb_expand_head(). Using this temporary buffer is obviously much better then reallocating the skb buffer... At the same time we can set the data length for the beacon queue at 0, to make sure no DMA is allocated for data (but just for the descriptor). 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/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index ae12dcdd3c24..14bc7b281659 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2366,6 +2366,7 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2366{ 2366{
2367 struct rt2x00_dev *rt2x00dev = hw->priv; 2367 struct rt2x00_dev *rt2x00dev = hw->priv;
2368 struct rt2x00_intf *intf = vif_to_intf(control->vif); 2368 struct rt2x00_intf *intf = vif_to_intf(control->vif);
2369 struct queue_entry_priv_pci_tx *priv_tx;
2369 struct skb_frame_desc *skbdesc; 2370 struct skb_frame_desc *skbdesc;
2370 unsigned int beacon_base; 2371 unsigned int beacon_base;
2371 u32 reg; 2372 u32 reg;
@@ -2373,21 +2374,8 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2373 if (unlikely(!intf->beacon)) 2374 if (unlikely(!intf->beacon))
2374 return -ENOBUFS; 2375 return -ENOBUFS;
2375 2376
2376 /* 2377 priv_tx = intf->beacon->priv_data;
2377 * We need to append the descriptor in front of the 2378 memset(priv_tx->desc, 0, intf->beacon->queue->desc_size);
2378 * beacon frame.
2379 */
2380 if (skb_headroom(skb) < intf->beacon->queue->desc_size) {
2381 if (pskb_expand_head(skb, intf->beacon->queue->desc_size,
2382 0, GFP_ATOMIC))
2383 return -ENOMEM;
2384 }
2385
2386 /*
2387 * Add the descriptor in front of the skb.
2388 */
2389 skb_push(skb, intf->beacon->queue->desc_size);
2390 memset(skb->data, 0, intf->beacon->queue->desc_size);
2391 2379
2392 /* 2380 /*
2393 * Fill in skb descriptor 2381 * Fill in skb descriptor
@@ -2395,9 +2383,9 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2395 skbdesc = get_skb_frame_desc(skb); 2383 skbdesc = get_skb_frame_desc(skb);
2396 memset(skbdesc, 0, sizeof(*skbdesc)); 2384 memset(skbdesc, 0, sizeof(*skbdesc));
2397 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED; 2385 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED;
2398 skbdesc->data = skb->data + intf->beacon->queue->desc_size; 2386 skbdesc->data = skb->data;
2399 skbdesc->data_len = skb->len - intf->beacon->queue->desc_size; 2387 skbdesc->data_len = skb->len;
2400 skbdesc->desc = skb->data; 2388 skbdesc->desc = priv_tx->desc;
2401 skbdesc->desc_len = intf->beacon->queue->desc_size; 2389 skbdesc->desc_len = intf->beacon->queue->desc_size;
2402 skbdesc->entry = intf->beacon; 2390 skbdesc->entry = intf->beacon;
2403 2391
@@ -2425,7 +2413,10 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2425 */ 2413 */
2426 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); 2414 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
2427 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, 2415 rt2x00pci_register_multiwrite(rt2x00dev, beacon_base,
2428 skb->data, skb->len); 2416 skbdesc->desc, skbdesc->desc_len);
2417 rt2x00pci_register_multiwrite(rt2x00dev,
2418 beacon_base + skbdesc->desc_len,
2419 skbdesc->data, skbdesc->data_len);
2429 rt61pci_kick_tx_queue(rt2x00dev, control->queue); 2420 rt61pci_kick_tx_queue(rt2x00dev, control->queue);
2430 2421
2431 return 0; 2422 return 0;
@@ -2490,7 +2481,7 @@ static const struct data_queue_desc rt61pci_queue_tx = {
2490 2481
2491static const struct data_queue_desc rt61pci_queue_bcn = { 2482static const struct data_queue_desc rt61pci_queue_bcn = {
2492 .entry_num = 4 * BEACON_ENTRIES, 2483 .entry_num = 4 * BEACON_ENTRIES,
2493 .data_size = MGMT_FRAME_SIZE, 2484 .data_size = 0, /* No DMA required for beacons */
2494 .desc_size = TXINFO_SIZE, 2485 .desc_size = TXINFO_SIZE,
2495 .priv_size = sizeof(struct queue_entry_priv_pci_tx), 2486 .priv_size = sizeof(struct queue_entry_priv_pci_tx),
2496}; 2487};