diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2008-01-24 04:56:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:05:07 -0500 |
commit | 08992f7fb139c7dbaf593402312ee5a055352f05 (patch) | |
tree | cfa1459e4940cf493438a3db950b5339dae4ca88 /drivers | |
parent | 22c96c28b47ce74d78aad1afbed88b26f43ce24b (diff) |
rt2x00: Add skb descriptor
Use the skb->cb field to add a frame description that can be used
to transfer information passed each rt2x00 layer. This reduces the
required arguments for rt2x00lib_write_tx_desc().
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 47 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 54 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00ring.h | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 27 |
8 files changed, 174 insertions, 73 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 15ab4b20d067..2a38388a79e1 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1686,8 +1686,8 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1686 | struct rt2x00_dev *rt2x00dev = hw->priv; | 1686 | struct rt2x00_dev *rt2x00dev = hw->priv; |
1687 | struct usb_device *usb_dev = | 1687 | struct usb_device *usb_dev = |
1688 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | 1688 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); |
1689 | struct data_ring *ring = | 1689 | struct skb_desc *desc; |
1690 | rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); | 1690 | struct data_ring *ring; |
1691 | struct data_entry *beacon; | 1691 | struct data_entry *beacon; |
1692 | struct data_entry *guardian; | 1692 | struct data_entry *guardian; |
1693 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 1693 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
@@ -1699,6 +1699,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1699 | * initialization. | 1699 | * initialization. |
1700 | */ | 1700 | */ |
1701 | control->queue = IEEE80211_TX_QUEUE_BEACON; | 1701 | control->queue = IEEE80211_TX_QUEUE_BEACON; |
1702 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | ||
1702 | 1703 | ||
1703 | /* | 1704 | /* |
1704 | * Obtain 2 entries, one for the guardian byte, | 1705 | * Obtain 2 entries, one for the guardian byte, |
@@ -1709,23 +1710,34 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1709 | beacon = rt2x00_get_data_entry(ring); | 1710 | beacon = rt2x00_get_data_entry(ring); |
1710 | 1711 | ||
1711 | /* | 1712 | /* |
1712 | * First we create the beacon. | 1713 | * Add the descriptor in front of the skb. |
1713 | */ | 1714 | */ |
1714 | skb_push(skb, ring->desc_size); | 1715 | skb_push(skb, ring->desc_size); |
1715 | memset(skb->data, 0, ring->desc_size); | 1716 | memset(skb->data, 0, ring->desc_size); |
1716 | 1717 | ||
1717 | rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data, | 1718 | /* |
1718 | (struct ieee80211_hdr *)(skb->data + | 1719 | * Fill in skb descriptor |
1719 | ring->desc_size), | 1720 | */ |
1720 | skb->len - ring->desc_size, control); | 1721 | desc = get_skb_desc(skb); |
1722 | desc->desc_len = ring->desc_size; | ||
1723 | desc->data_len = skb->len - ring->desc_size; | ||
1724 | desc->desc = skb->data; | ||
1725 | desc->data = skb->data + ring->desc_size; | ||
1726 | desc->ring = ring; | ||
1727 | desc->entry = beacon; | ||
1728 | |||
1729 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); | ||
1721 | 1730 | ||
1731 | /* | ||
1732 | * USB devices cannot blindly pass the skb->len as the | ||
1733 | * length of the data to usb_fill_bulk_urb. Pass the skb | ||
1734 | * to the driver to determine what the length should be. | ||
1735 | */ | ||
1722 | length = rt2500usb_get_tx_data_len(rt2x00dev, skb); | 1736 | length = rt2500usb_get_tx_data_len(rt2x00dev, skb); |
1723 | 1737 | ||
1724 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, | 1738 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, |
1725 | skb->data, length, rt2500usb_beacondone, beacon); | 1739 | skb->data, length, rt2500usb_beacondone, beacon); |
1726 | 1740 | ||
1727 | beacon->skb = skb; | ||
1728 | |||
1729 | /* | 1741 | /* |
1730 | * Second we need to create the guardian byte. | 1742 | * Second we need to create the guardian byte. |
1731 | * We only need a single byte, so lets recycle | 1743 | * We only need a single byte, so lets recycle |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index b2283cebfab9..31e48c25a692 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -901,9 +901,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb, | |||
901 | * TX descriptor initializer | 901 | * TX descriptor initializer |
902 | */ | 902 | */ |
903 | void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 903 | void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, |
904 | __le32 *txd, | 904 | struct sk_buff *skb, |
905 | struct ieee80211_hdr *ieee80211hdr, | ||
906 | unsigned int length, | ||
907 | struct ieee80211_tx_control *control); | 905 | struct ieee80211_tx_control *control); |
908 | 906 | ||
909 | /* | 907 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index e8949785c662..4f32ee8f4cb7 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -573,36 +573,26 @@ EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); | |||
573 | * TX descriptor initializer | 573 | * TX descriptor initializer |
574 | */ | 574 | */ |
575 | void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 575 | void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, |
576 | __le32 *txd, | 576 | struct sk_buff *skb, |
577 | struct ieee80211_hdr *ieee80211hdr, | ||
578 | unsigned int length, | ||
579 | struct ieee80211_tx_control *control) | 577 | struct ieee80211_tx_control *control) |
580 | { | 578 | { |
581 | struct txdata_entry_desc desc; | 579 | struct txdata_entry_desc desc; |
582 | struct data_ring *ring; | 580 | struct skb_desc *skbdesc = get_skb_desc(skb); |
581 | struct ieee80211_hdr *ieee80211hdr = skbdesc->data; | ||
582 | __le32 *txd = skbdesc->desc; | ||
583 | int tx_rate; | 583 | int tx_rate; |
584 | int bitrate; | 584 | int bitrate; |
585 | int length; | ||
585 | int duration; | 586 | int duration; |
586 | int residual; | 587 | int residual; |
587 | u16 frame_control; | 588 | u16 frame_control; |
588 | u16 seq_ctrl; | 589 | u16 seq_ctrl; |
589 | 590 | ||
590 | /* | 591 | memset(&desc, 0, sizeof(desc)); |
591 | * Make sure the descriptor is properly cleared. | ||
592 | */ | ||
593 | memset(&desc, 0x00, sizeof(desc)); | ||
594 | 592 | ||
595 | /* | 593 | desc.cw_min = skbdesc->ring->tx_params.cw_min; |
596 | * Get ring pointer, if we fail to obtain the | 594 | desc.cw_max = skbdesc->ring->tx_params.cw_max; |
597 | * correct ring, then use the first TX ring. | 595 | desc.aifs = skbdesc->ring->tx_params.aifs; |
598 | */ | ||
599 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | ||
600 | if (!ring) | ||
601 | ring = rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_DATA0); | ||
602 | |||
603 | desc.cw_min = ring->tx_params.cw_min; | ||
604 | desc.cw_max = ring->tx_params.cw_max; | ||
605 | desc.aifs = ring->tx_params.aifs; | ||
606 | 596 | ||
607 | /* | 597 | /* |
608 | * Identify queue | 598 | * Identify queue |
@@ -683,17 +673,18 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
683 | desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP); | 673 | desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP); |
684 | desc.service = 0x04; | 674 | desc.service = 0x04; |
685 | 675 | ||
676 | length = skbdesc->data_len + FCS_LEN; | ||
686 | if (test_bit(ENTRY_TXD_OFDM_RATE, &desc.flags)) { | 677 | if (test_bit(ENTRY_TXD_OFDM_RATE, &desc.flags)) { |
687 | desc.length_high = ((length + FCS_LEN) >> 6) & 0x3f; | 678 | desc.length_high = (length >> 6) & 0x3f; |
688 | desc.length_low = ((length + FCS_LEN) & 0x3f); | 679 | desc.length_low = length & 0x3f; |
689 | } else { | 680 | } else { |
690 | bitrate = DEVICE_GET_RATE_FIELD(tx_rate, RATE); | 681 | bitrate = DEVICE_GET_RATE_FIELD(tx_rate, RATE); |
691 | 682 | ||
692 | /* | 683 | /* |
693 | * Convert length to microseconds. | 684 | * Convert length to microseconds. |
694 | */ | 685 | */ |
695 | residual = get_duration_res(length + FCS_LEN, bitrate); | 686 | residual = get_duration_res(length, bitrate); |
696 | duration = get_duration(length + FCS_LEN, bitrate); | 687 | duration = get_duration(length, bitrate); |
697 | 688 | ||
698 | if (residual != 0) { | 689 | if (residual != 0) { |
699 | duration++; | 690 | duration++; |
@@ -716,8 +707,14 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
716 | desc.signal |= 0x08; | 707 | desc.signal |= 0x08; |
717 | } | 708 | } |
718 | 709 | ||
719 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, txd, &desc, | 710 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, txd, &desc, ieee80211hdr, |
720 | ieee80211hdr, length, control); | 711 | skbdesc->data_len, control); |
712 | |||
713 | /* | ||
714 | * Update ring entry. | ||
715 | */ | ||
716 | skbdesc->entry->skb = skb; | ||
717 | memcpy(&skbdesc->entry->tx_status.control, control, sizeof(*control)); | ||
721 | } | 718 | } |
722 | EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc); | 719 | EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc); |
723 | 720 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index cf0bb5d9d847..c1d7c10e58fe 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -38,9 +38,9 @@ int rt2x00pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
38 | struct ieee80211_tx_control *control) | 38 | struct ieee80211_tx_control *control) |
39 | { | 39 | { |
40 | struct rt2x00_dev *rt2x00dev = hw->priv; | 40 | struct rt2x00_dev *rt2x00dev = hw->priv; |
41 | struct data_ring *ring = | 41 | struct skb_desc *desc; |
42 | rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); | 42 | struct data_ring *ring; |
43 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 43 | struct data_entry *entry; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Just in case mac80211 doesn't set this correctly, | 46 | * Just in case mac80211 doesn't set this correctly, |
@@ -48,14 +48,22 @@ int rt2x00pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
48 | * initialization. | 48 | * initialization. |
49 | */ | 49 | */ |
50 | control->queue = IEEE80211_TX_QUEUE_BEACON; | 50 | control->queue = IEEE80211_TX_QUEUE_BEACON; |
51 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | ||
52 | entry = rt2x00_get_data_entry(ring); | ||
51 | 53 | ||
52 | /* | 54 | /* |
53 | * Update the beacon entry. | 55 | * Fill in skb descriptor |
54 | */ | 56 | */ |
57 | desc = get_skb_desc(skb); | ||
58 | desc->desc_len = ring->desc_size; | ||
59 | desc->data_len = skb->len; | ||
60 | desc->desc = entry->priv; | ||
61 | desc->data = skb->data; | ||
62 | desc->ring = ring; | ||
63 | desc->entry = entry; | ||
64 | |||
55 | memcpy(entry->data_addr, skb->data, skb->len); | 65 | memcpy(entry->data_addr, skb->data, skb->len); |
56 | rt2x00lib_write_tx_desc(rt2x00dev, entry->priv, | 66 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); |
57 | (struct ieee80211_hdr *)skb->data, | ||
58 | skb->len, control); | ||
59 | 67 | ||
60 | /* | 68 | /* |
61 | * Enable beacon generation. | 69 | * Enable beacon generation. |
@@ -73,9 +81,9 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
73 | struct data_ring *ring, struct sk_buff *skb, | 81 | struct data_ring *ring, struct sk_buff *skb, |
74 | struct ieee80211_tx_control *control) | 82 | struct ieee80211_tx_control *control) |
75 | { | 83 | { |
76 | struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; | ||
77 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 84 | struct data_entry *entry = rt2x00_get_data_entry(ring); |
78 | __le32 *txd = entry->priv; | 85 | __le32 *txd = entry->priv; |
86 | struct skb_desc *desc; | ||
79 | u32 word; | 87 | u32 word; |
80 | 88 | ||
81 | if (rt2x00_ring_full(ring)) { | 89 | if (rt2x00_ring_full(ring)) { |
@@ -95,11 +103,19 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
95 | return -EINVAL; | 103 | return -EINVAL; |
96 | } | 104 | } |
97 | 105 | ||
98 | entry->skb = skb; | 106 | /* |
99 | memcpy(&entry->tx_status.control, control, sizeof(*control)); | 107 | * Fill in skb descriptor |
108 | */ | ||
109 | desc = get_skb_desc(skb); | ||
110 | desc->desc_len = ring->desc_size; | ||
111 | desc->data_len = skb->len; | ||
112 | desc->desc = entry->priv; | ||
113 | desc->data = skb->data; | ||
114 | desc->ring = ring; | ||
115 | desc->entry = entry; | ||
116 | |||
100 | memcpy(entry->data_addr, skb->data, skb->len); | 117 | memcpy(entry->data_addr, skb->data, skb->len); |
101 | rt2x00lib_write_tx_desc(rt2x00dev, txd, ieee80211hdr, | 118 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); |
102 | skb->len, control); | ||
103 | 119 | ||
104 | rt2x00_ring_index_inc(ring); | 120 | rt2x00_ring_index_inc(ring); |
105 | 121 | ||
@@ -119,6 +135,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
119 | struct data_entry *entry; | 135 | struct data_entry *entry; |
120 | struct sk_buff *skb; | 136 | struct sk_buff *skb; |
121 | struct ieee80211_hdr *hdr; | 137 | struct ieee80211_hdr *hdr; |
138 | struct skb_desc *skbdesc; | ||
122 | struct rxdata_entry_desc desc; | 139 | struct rxdata_entry_desc desc; |
123 | int header_size; | 140 | int header_size; |
124 | __le32 *rxd; | 141 | __le32 *rxd; |
@@ -133,7 +150,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
133 | if (rt2x00_get_field32(word, RXD_ENTRY_OWNER_NIC)) | 150 | if (rt2x00_get_field32(word, RXD_ENTRY_OWNER_NIC)) |
134 | break; | 151 | break; |
135 | 152 | ||
136 | memset(&desc, 0x00, sizeof(desc)); | 153 | memset(&desc, 0, sizeof(desc)); |
137 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); | 154 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); |
138 | 155 | ||
139 | hdr = (struct ieee80211_hdr *)entry->data_addr; | 156 | hdr = (struct ieee80211_hdr *)entry->data_addr; |
@@ -158,6 +175,17 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
158 | memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size); | 175 | memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size); |
159 | 176 | ||
160 | /* | 177 | /* |
178 | * Fill in skb descriptor | ||
179 | */ | ||
180 | skbdesc = get_skb_desc(skb); | ||
181 | skbdesc->desc_len = desc.size; | ||
182 | skbdesc->data_len = entry->ring->desc_size; | ||
183 | skbdesc->desc = entry->priv; | ||
184 | skbdesc->data = skb->data; | ||
185 | skbdesc->ring = ring; | ||
186 | skbdesc->entry = entry; | ||
187 | |||
188 | /* | ||
161 | * Send the frame to rt2x00lib for further processing. | 189 | * Send the frame to rt2x00lib for further processing. |
162 | */ | 190 | */ |
163 | rt2x00lib_rxdone(entry, skb, &desc); | 191 | rt2x00lib_rxdone(entry, skb, &desc); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00ring.h b/drivers/net/wireless/rt2x00/rt2x00ring.h index 5b871adfa22a..5b32f3ef2a73 100644 --- a/drivers/net/wireless/rt2x00/rt2x00ring.h +++ b/drivers/net/wireless/rt2x00/rt2x00ring.h | |||
@@ -27,6 +27,28 @@ | |||
27 | #define RT2X00RING_H | 27 | #define RT2X00RING_H |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * skb_desc | ||
31 | * Descriptor information for the skb buffer | ||
32 | */ | ||
33 | struct skb_desc { | ||
34 | unsigned int frame_type; | ||
35 | |||
36 | unsigned int desc_len; | ||
37 | unsigned int data_len; | ||
38 | |||
39 | void *desc; | ||
40 | void *data; | ||
41 | |||
42 | struct data_ring *ring; | ||
43 | struct data_entry *entry; | ||
44 | }; | ||
45 | |||
46 | static inline struct skb_desc* get_skb_desc(struct sk_buff *skb) | ||
47 | { | ||
48 | return (struct skb_desc*)&skb->cb[0]; | ||
49 | } | ||
50 | |||
51 | /* | ||
30 | * rxdata_entry_desc | 52 | * rxdata_entry_desc |
31 | * Summary of information that has been read from the | 53 | * Summary of information that has been read from the |
32 | * RX frame descriptor. | 54 | * RX frame descriptor. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 9b55f7997ca2..fd6b61c97619 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -176,7 +176,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
176 | struct usb_device *usb_dev = | 176 | struct usb_device *usb_dev = |
177 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | 177 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); |
178 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 178 | struct data_entry *entry = rt2x00_get_data_entry(ring); |
179 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 179 | struct skb_desc *desc; |
180 | u32 length; | 180 | u32 length; |
181 | 181 | ||
182 | if (rt2x00_ring_full(ring)) { | 182 | if (rt2x00_ring_full(ring)) { |
@@ -199,12 +199,18 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
199 | skb_push(skb, ring->desc_size); | 199 | skb_push(skb, ring->desc_size); |
200 | memset(skb->data, 0, ring->desc_size); | 200 | memset(skb->data, 0, ring->desc_size); |
201 | 201 | ||
202 | rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data, | 202 | /* |
203 | (struct ieee80211_hdr *)(skb->data + | 203 | * Fill in skb descriptor |
204 | ring->desc_size), | 204 | */ |
205 | skb->len - ring->desc_size, control); | 205 | desc = get_skb_desc(skb); |
206 | memcpy(&entry->tx_status.control, control, sizeof(*control)); | 206 | desc->desc_len = ring->desc_size; |
207 | entry->skb = skb; | 207 | desc->data_len = skb->len - ring->desc_size; |
208 | desc->desc = skb->data; | ||
209 | desc->data = skb->data + ring->desc_size; | ||
210 | desc->ring = ring; | ||
211 | desc->entry = entry; | ||
212 | |||
213 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); | ||
208 | 214 | ||
209 | /* | 215 | /* |
210 | * USB devices cannot blindly pass the skb->len as the | 216 | * USB devices cannot blindly pass the skb->len as the |
@@ -217,7 +223,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
217 | * Initialize URB and send the frame to the device. | 223 | * Initialize URB and send the frame to the device. |
218 | */ | 224 | */ |
219 | __set_bit(ENTRY_OWNER_NIC, &entry->flags); | 225 | __set_bit(ENTRY_OWNER_NIC, &entry->flags); |
220 | usb_fill_bulk_urb(entry->priv, usb_dev, pipe, | 226 | usb_fill_bulk_urb(entry->priv, usb_dev, usb_sndbulkpipe(usb_dev, 1), |
221 | skb->data, length, rt2x00usb_interrupt_txdone, entry); | 227 | skb->data, length, rt2x00usb_interrupt_txdone, entry); |
222 | usb_submit_urb(entry->priv, GFP_ATOMIC); | 228 | usb_submit_urb(entry->priv, GFP_ATOMIC); |
223 | 229 | ||
@@ -240,6 +246,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
240 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; | 246 | struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; |
241 | struct sk_buff *skb; | 247 | struct sk_buff *skb; |
242 | struct ieee80211_hdr *hdr; | 248 | struct ieee80211_hdr *hdr; |
249 | struct skb_desc *skbdesc; | ||
243 | struct rxdata_entry_desc desc; | 250 | struct rxdata_entry_desc desc; |
244 | int header_size; | 251 | int header_size; |
245 | int frame_size; | 252 | int frame_size; |
@@ -256,7 +263,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
256 | if (urb->actual_length < entry->ring->desc_size || urb->status) | 263 | if (urb->actual_length < entry->ring->desc_size || urb->status) |
257 | goto skip_entry; | 264 | goto skip_entry; |
258 | 265 | ||
259 | memset(&desc, 0x00, sizeof(desc)); | 266 | memset(&desc, 0, sizeof(desc)); |
260 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); | 267 | rt2x00dev->ops->lib->fill_rxdone(entry, &desc); |
261 | 268 | ||
262 | /* | 269 | /* |
@@ -297,6 +304,17 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
297 | skb_trim(entry->skb, desc.size); | 304 | skb_trim(entry->skb, desc.size); |
298 | 305 | ||
299 | /* | 306 | /* |
307 | * Fill in skb descriptor | ||
308 | */ | ||
309 | skbdesc = get_skb_desc(entry->skb); | ||
310 | skbdesc->desc_len = desc.size; | ||
311 | skbdesc->data_len = entry->ring->desc_size; | ||
312 | skbdesc->desc = entry->skb->data + desc.size; | ||
313 | skbdesc->data = entry->skb->data; | ||
314 | skbdesc->ring = ring; | ||
315 | skbdesc->entry = entry; | ||
316 | |||
317 | /* | ||
300 | * Send the frame to rt2x00lib for further processing. | 318 | * Send the frame to rt2x00lib for further processing. |
301 | */ | 319 | */ |
302 | rt2x00lib_rxdone(entry, entry->skb, &desc); | 320 | rt2x00lib_rxdone(entry, entry->skb, &desc); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 52622d32ea4c..0693b3920e68 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2408,6 +2408,9 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2408 | struct ieee80211_tx_control *control) | 2408 | struct ieee80211_tx_control *control) |
2409 | { | 2409 | { |
2410 | struct rt2x00_dev *rt2x00dev = hw->priv; | 2410 | struct rt2x00_dev *rt2x00dev = hw->priv; |
2411 | struct skb_desc *desc; | ||
2412 | struct data_ring *ring; | ||
2413 | struct data_entry *entry; | ||
2411 | 2414 | ||
2412 | /* | 2415 | /* |
2413 | * Just in case the ieee80211 doesn't set this, | 2416 | * Just in case the ieee80211 doesn't set this, |
@@ -2415,6 +2418,8 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2415 | * initialization. | 2418 | * initialization. |
2416 | */ | 2419 | */ |
2417 | control->queue = IEEE80211_TX_QUEUE_BEACON; | 2420 | control->queue = IEEE80211_TX_QUEUE_BEACON; |
2421 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | ||
2422 | entry = rt2x00_get_data_entry(ring); | ||
2418 | 2423 | ||
2419 | /* | 2424 | /* |
2420 | * We need to append the descriptor in front of the | 2425 | * We need to append the descriptor in front of the |
@@ -2428,15 +2433,23 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2428 | } | 2433 | } |
2429 | 2434 | ||
2430 | /* | 2435 | /* |
2431 | * First we create the beacon. | 2436 | * Add the descriptor in front of the skb. |
2437 | */ | ||
2438 | skb_push(skb, ring->desc_size); | ||
2439 | memset(skb->data, 0, ring->desc_size); | ||
2440 | |||
2441 | /* | ||
2442 | * Fill in skb descriptor | ||
2432 | */ | 2443 | */ |
2433 | skb_push(skb, TXD_DESC_SIZE); | 2444 | desc = get_skb_desc(skb); |
2434 | memset(skb->data, 0, TXD_DESC_SIZE); | 2445 | desc->desc_len = ring->desc_size; |
2446 | desc->data_len = skb->len - ring->desc_size; | ||
2447 | desc->desc = skb->data; | ||
2448 | desc->data = skb->data + ring->desc_size; | ||
2449 | desc->ring = ring; | ||
2450 | desc->entry = entry; | ||
2435 | 2451 | ||
2436 | rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data, | 2452 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); |
2437 | (struct ieee80211_hdr *)(skb->data + | ||
2438 | TXD_DESC_SIZE), | ||
2439 | skb->len - TXD_DESC_SIZE, control); | ||
2440 | 2453 | ||
2441 | /* | 2454 | /* |
2442 | * Write entire beacon with descriptor to register, | 2455 | * Write entire beacon with descriptor to register, |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 49180de321e4..8093a4d49335 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1965,6 +1965,9 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1965 | struct ieee80211_tx_control *control) | 1965 | struct ieee80211_tx_control *control) |
1966 | { | 1966 | { |
1967 | struct rt2x00_dev *rt2x00dev = hw->priv; | 1967 | struct rt2x00_dev *rt2x00dev = hw->priv; |
1968 | struct skb_desc *desc; | ||
1969 | struct data_ring *ring; | ||
1970 | struct data_entry *entry; | ||
1968 | int timeout; | 1971 | int timeout; |
1969 | 1972 | ||
1970 | /* | 1973 | /* |
@@ -1973,17 +1976,27 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1973 | * initialization. | 1976 | * initialization. |
1974 | */ | 1977 | */ |
1975 | control->queue = IEEE80211_TX_QUEUE_BEACON; | 1978 | control->queue = IEEE80211_TX_QUEUE_BEACON; |
1979 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | ||
1980 | entry = rt2x00_get_data_entry(ring); | ||
1976 | 1981 | ||
1977 | /* | 1982 | /* |
1978 | * First we create the beacon. | 1983 | * Add the descriptor in front of the skb. |
1979 | */ | 1984 | */ |
1980 | skb_push(skb, TXD_DESC_SIZE); | 1985 | skb_push(skb, ring->desc_size); |
1981 | memset(skb->data, 0, TXD_DESC_SIZE); | 1986 | memset(skb->data, 0, ring->desc_size); |
1982 | 1987 | ||
1983 | rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data, | 1988 | /* |
1984 | (struct ieee80211_hdr *)(skb->data + | 1989 | * Fill in skb descriptor |
1985 | TXD_DESC_SIZE), | 1990 | */ |
1986 | skb->len - TXD_DESC_SIZE, control); | 1991 | desc = get_skb_desc(skb); |
1992 | desc->desc_len = ring->desc_size; | ||
1993 | desc->data_len = skb->len - ring->desc_size; | ||
1994 | desc->desc = skb->data; | ||
1995 | desc->data = skb->data + ring->desc_size; | ||
1996 | desc->ring = ring; | ||
1997 | desc->entry = entry; | ||
1998 | |||
1999 | rt2x00lib_write_tx_desc(rt2x00dev, skb, control); | ||
1987 | 2000 | ||
1988 | /* | 2001 | /* |
1989 | * Write entire beacon with descriptor to register, | 2002 | * Write entire beacon with descriptor to register, |