aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-11-08 09:25:33 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:08:16 -0500
commit798b7adb4ed3533ab1282f51d16892034cfd8aae (patch)
treeef328809a04c1072e9b1ce765d01f470283d4842 /drivers/net/wireless/rt2x00/rt61pci.c
parent0ed94eaaed618634f68197161203aac9f849471e (diff)
rt2x00: Cleanup TX/RX entry handling
Merge the callback functions init_txentry() and init_rxentry(). This makes life in rt2x00lib a lot simpler and we can cleanup several functions. rt2x00pci contained "fake" FIELD definitions for descriptor words. This is not flexible since it assumes the driver will always have the same field to indicate if a driver is available or not. This should be dependent on the driver, and we should add a callback function for this. 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.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 3f272793412a..abfe33b5712a 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1261,33 +1261,44 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
1261/* 1261/*
1262 * Initialization functions. 1262 * Initialization functions.
1263 */ 1263 */
1264static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev, 1264static bool rt61pci_get_entry_state(struct queue_entry *entry)
1265 struct queue_entry *entry)
1266{ 1265{
1267 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 1266 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1268 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1269 u32 word; 1267 u32 word;
1270 1268
1271 rt2x00_desc_read(entry_priv->desc, 5, &word); 1269 if (entry->queue->qid == QID_RX) {
1272 rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, 1270 rt2x00_desc_read(entry_priv->desc, 0, &word);
1273 skbdesc->skb_dma);
1274 rt2x00_desc_write(entry_priv->desc, 5, word);
1275 1271
1276 rt2x00_desc_read(entry_priv->desc, 0, &word); 1272 return rt2x00_get_field32(word, RXD_W0_OWNER_NIC);
1277 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); 1273 } else {
1278 rt2x00_desc_write(entry_priv->desc, 0, word); 1274 rt2x00_desc_read(entry_priv->desc, 0, &word);
1275
1276 return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) ||
1277 rt2x00_get_field32(word, TXD_W0_VALID));
1278 }
1279} 1279}
1280 1280
1281static void rt61pci_init_txentry(struct rt2x00_dev *rt2x00dev, 1281static void rt61pci_clear_entry(struct queue_entry *entry)
1282 struct queue_entry *entry)
1283{ 1282{
1284 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 1283 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1284 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1285 u32 word; 1285 u32 word;
1286 1286
1287 rt2x00_desc_read(entry_priv->desc, 0, &word); 1287 if (entry->queue->qid == QID_RX) {
1288 rt2x00_set_field32(&word, TXD_W0_VALID, 0); 1288 rt2x00_desc_read(entry_priv->desc, 5, &word);
1289 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); 1289 rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS,
1290 rt2x00_desc_write(entry_priv->desc, 0, word); 1290 skbdesc->skb_dma);
1291 rt2x00_desc_write(entry_priv->desc, 5, word);
1292
1293 rt2x00_desc_read(entry_priv->desc, 0, &word);
1294 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
1295 rt2x00_desc_write(entry_priv->desc, 0, word);
1296 } else {
1297 rt2x00_desc_read(entry_priv->desc, 0, &word);
1298 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
1299 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
1300 rt2x00_desc_write(entry_priv->desc, 0, word);
1301 }
1291} 1302}
1292 1303
1293static int rt61pci_init_queues(struct rt2x00_dev *rt2x00dev) 1304static int rt61pci_init_queues(struct rt2x00_dev *rt2x00dev)
@@ -2722,8 +2733,8 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
2722 .load_firmware = rt61pci_load_firmware, 2733 .load_firmware = rt61pci_load_firmware,
2723 .initialize = rt2x00pci_initialize, 2734 .initialize = rt2x00pci_initialize,
2724 .uninitialize = rt2x00pci_uninitialize, 2735 .uninitialize = rt2x00pci_uninitialize,
2725 .init_rxentry = rt61pci_init_rxentry, 2736 .get_entry_state = rt61pci_get_entry_state,
2726 .init_txentry = rt61pci_init_txentry, 2737 .clear_entry = rt61pci_clear_entry,
2727 .set_device_state = rt61pci_set_device_state, 2738 .set_device_state = rt61pci_set_device_state,
2728 .rfkill_poll = rt61pci_rfkill_poll, 2739 .rfkill_poll = rt61pci_rfkill_poll,
2729 .link_stats = rt61pci_link_stats, 2740 .link_stats = rt61pci_link_stats,