aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 42bd38ac7a1d..861577ece713 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -626,36 +626,47 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
626/* 626/*
627 * Initialization functions. 627 * Initialization functions.
628 */ 628 */
629static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, 629static bool rt2400pci_get_entry_state(struct queue_entry *entry)
630 struct queue_entry *entry)
631{ 630{
632 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 631 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
633 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
634 u32 word; 632 u32 word;
635 633
636 rt2x00_desc_read(entry_priv->desc, 2, &word); 634 if (entry->queue->qid == QID_RX) {
637 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->skb->len); 635 rt2x00_desc_read(entry_priv->desc, 0, &word);
638 rt2x00_desc_write(entry_priv->desc, 2, word);
639 636
640 rt2x00_desc_read(entry_priv->desc, 1, &word); 637 return rt2x00_get_field32(word, RXD_W0_OWNER_NIC);
641 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); 638 } else {
642 rt2x00_desc_write(entry_priv->desc, 1, word); 639 rt2x00_desc_read(entry_priv->desc, 0, &word);
643 640
644 rt2x00_desc_read(entry_priv->desc, 0, &word); 641 return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) ||
645 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); 642 rt2x00_get_field32(word, TXD_W0_VALID));
646 rt2x00_desc_write(entry_priv->desc, 0, word); 643 }
647} 644}
648 645
649static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev, 646static void rt2400pci_clear_entry(struct queue_entry *entry)
650 struct queue_entry *entry)
651{ 647{
652 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 648 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
649 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
653 u32 word; 650 u32 word;
654 651
655 rt2x00_desc_read(entry_priv->desc, 0, &word); 652 if (entry->queue->qid == QID_RX) {
656 rt2x00_set_field32(&word, TXD_W0_VALID, 0); 653 rt2x00_desc_read(entry_priv->desc, 2, &word);
657 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); 654 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->skb->len);
658 rt2x00_desc_write(entry_priv->desc, 0, word); 655 rt2x00_desc_write(entry_priv->desc, 2, word);
656
657 rt2x00_desc_read(entry_priv->desc, 1, &word);
658 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
659 rt2x00_desc_write(entry_priv->desc, 1, word);
660
661 rt2x00_desc_read(entry_priv->desc, 0, &word);
662 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
663 rt2x00_desc_write(entry_priv->desc, 0, word);
664 } else {
665 rt2x00_desc_read(entry_priv->desc, 0, &word);
666 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
667 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
668 rt2x00_desc_write(entry_priv->desc, 0, word);
669 }
659} 670}
660 671
661static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) 672static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
@@ -1570,8 +1581,8 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1570 .probe_hw = rt2400pci_probe_hw, 1581 .probe_hw = rt2400pci_probe_hw,
1571 .initialize = rt2x00pci_initialize, 1582 .initialize = rt2x00pci_initialize,
1572 .uninitialize = rt2x00pci_uninitialize, 1583 .uninitialize = rt2x00pci_uninitialize,
1573 .init_rxentry = rt2400pci_init_rxentry, 1584 .get_entry_state = rt2400pci_get_entry_state,
1574 .init_txentry = rt2400pci_init_txentry, 1585 .clear_entry = rt2400pci_clear_entry,
1575 .set_device_state = rt2400pci_set_device_state, 1586 .set_device_state = rt2400pci_set_device_state,
1576 .rfkill_poll = rt2400pci_rfkill_poll, 1587 .rfkill_poll = rt2400pci_rfkill_poll,
1577 .link_stats = rt2400pci_link_stats, 1588 .link_stats = rt2400pci_link_stats,