aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-01-24 04:56:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:07 -0500
commit08992f7fb139c7dbaf593402312ee5a055352f05 (patch)
treecfa1459e4940cf493438a3db950b5339dae4ca88 /drivers/net/wireless/rt2x00/rt2x00pci.c
parent22c96c28b47ce74d78aad1afbed88b26f43ce24b (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/net/wireless/rt2x00/rt2x00pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c54
1 files changed, 41 insertions, 13 deletions
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);