aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.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/rt2500pci.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/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 928452f30c2..e43ff9c7906 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -722,32 +722,43 @@ dynamic_cca_tune:
722/* 722/*
723 * Initialization functions. 723 * Initialization functions.
724 */ 724 */
725static void rt2500pci_init_rxentry(struct rt2x00_dev *rt2x00dev, 725static bool rt2500pci_get_entry_state(struct queue_entry *entry)
726 struct queue_entry *entry)
727{ 726{
728 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 727 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
729 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
730 u32 word; 728 u32 word;
731 729
732 rt2x00_desc_read(entry_priv->desc, 1, &word); 730 if (entry->queue->qid == QID_RX) {
733 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); 731 rt2x00_desc_read(entry_priv->desc, 0, &word);
734 rt2x00_desc_write(entry_priv->desc, 1, word); 732
733 return rt2x00_get_field32(word, RXD_W0_OWNER_NIC);
734 } else {
735 rt2x00_desc_read(entry_priv->desc, 0, &word);
735 736
736 rt2x00_desc_read(entry_priv->desc, 0, &word); 737 return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) ||
737 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); 738 rt2x00_get_field32(word, TXD_W0_VALID));
738 rt2x00_desc_write(entry_priv->desc, 0, word); 739 }
739} 740}
740 741
741static void rt2500pci_init_txentry(struct rt2x00_dev *rt2x00dev, 742static void rt2500pci_clear_entry(struct queue_entry *entry)
742 struct queue_entry *entry)
743{ 743{
744 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 744 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
745 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
745 u32 word; 746 u32 word;
746 747
747 rt2x00_desc_read(entry_priv->desc, 0, &word); 748 if (entry->queue->qid == QID_RX) {
748 rt2x00_set_field32(&word, TXD_W0_VALID, 0); 749 rt2x00_desc_read(entry_priv->desc, 1, &word);
749 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); 750 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
750 rt2x00_desc_write(entry_priv->desc, 0, word); 751 rt2x00_desc_write(entry_priv->desc, 1, word);
752
753 rt2x00_desc_read(entry_priv->desc, 0, &word);
754 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
755 rt2x00_desc_write(entry_priv->desc, 0, word);
756 } else {
757 rt2x00_desc_read(entry_priv->desc, 0, &word);
758 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
759 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
760 rt2x00_desc_write(entry_priv->desc, 0, word);
761 }
751} 762}
752 763
753static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev) 764static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev)
@@ -1871,8 +1882,8 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1871 .probe_hw = rt2500pci_probe_hw, 1882 .probe_hw = rt2500pci_probe_hw,
1872 .initialize = rt2x00pci_initialize, 1883 .initialize = rt2x00pci_initialize,
1873 .uninitialize = rt2x00pci_uninitialize, 1884 .uninitialize = rt2x00pci_uninitialize,
1874 .init_rxentry = rt2500pci_init_rxentry, 1885 .get_entry_state = rt2500pci_get_entry_state,
1875 .init_txentry = rt2500pci_init_txentry, 1886 .clear_entry = rt2500pci_clear_entry,
1876 .set_device_state = rt2500pci_set_device_state, 1887 .set_device_state = rt2500pci_set_device_state,
1877 .rfkill_poll = rt2500pci_rfkill_poll, 1888 .rfkill_poll = rt2500pci_rfkill_poll,
1878 .link_stats = rt2500pci_link_stats, 1889 .link_stats = rt2500pci_link_stats,