diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 204 |
1 files changed, 117 insertions, 87 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 763af7f19b8e..fc161084a8d3 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -498,13 +498,13 @@ static void rt2400pci_config(struct rt2x00_dev *rt2x00dev, | |||
498 | } | 498 | } |
499 | 499 | ||
500 | static void rt2400pci_config_cw(struct rt2x00_dev *rt2x00dev, | 500 | static void rt2400pci_config_cw(struct rt2x00_dev *rt2x00dev, |
501 | struct ieee80211_tx_queue_params *params) | 501 | const int cw_min, const int cw_max) |
502 | { | 502 | { |
503 | u32 reg; | 503 | u32 reg; |
504 | 504 | ||
505 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); | 505 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); |
506 | rt2x00_set_field32(®, CSR11_CWMIN, params->cw_min); | 506 | rt2x00_set_field32(®, CSR11_CWMIN, cw_min); |
507 | rt2x00_set_field32(®, CSR11_CWMAX, params->cw_max); | 507 | rt2x00_set_field32(®, CSR11_CWMAX, cw_max); |
508 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); | 508 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); |
509 | } | 509 | } |
510 | 510 | ||
@@ -593,90 +593,89 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
593 | * Initialization functions. | 593 | * Initialization functions. |
594 | */ | 594 | */ |
595 | static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, | 595 | static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, |
596 | struct data_entry *entry) | 596 | struct queue_entry *entry) |
597 | { | 597 | { |
598 | __le32 *rxd = entry->priv; | 598 | struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data; |
599 | u32 word; | 599 | u32 word; |
600 | 600 | ||
601 | rt2x00_desc_read(rxd, 2, &word); | 601 | rt2x00_desc_read(priv_rx->desc, 2, &word); |
602 | rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->ring->data_size); | 602 | rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->queue->data_size); |
603 | rt2x00_desc_write(rxd, 2, word); | 603 | rt2x00_desc_write(priv_rx->desc, 2, word); |
604 | 604 | ||
605 | rt2x00_desc_read(rxd, 1, &word); | 605 | rt2x00_desc_read(priv_rx->desc, 1, &word); |
606 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry->data_dma); | 606 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, priv_rx->dma); |
607 | rt2x00_desc_write(rxd, 1, word); | 607 | rt2x00_desc_write(priv_rx->desc, 1, word); |
608 | 608 | ||
609 | rt2x00_desc_read(rxd, 0, &word); | 609 | rt2x00_desc_read(priv_rx->desc, 0, &word); |
610 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); | 610 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); |
611 | rt2x00_desc_write(rxd, 0, word); | 611 | rt2x00_desc_write(priv_rx->desc, 0, word); |
612 | } | 612 | } |
613 | 613 | ||
614 | static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev, | 614 | static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev, |
615 | struct data_entry *entry) | 615 | struct queue_entry *entry) |
616 | { | 616 | { |
617 | __le32 *txd = entry->priv; | 617 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; |
618 | u32 word; | 618 | u32 word; |
619 | 619 | ||
620 | rt2x00_desc_read(txd, 1, &word); | 620 | rt2x00_desc_read(priv_tx->desc, 1, &word); |
621 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry->data_dma); | 621 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, priv_tx->dma); |
622 | rt2x00_desc_write(txd, 1, word); | 622 | rt2x00_desc_write(priv_tx->desc, 1, word); |
623 | 623 | ||
624 | rt2x00_desc_read(txd, 2, &word); | 624 | rt2x00_desc_read(priv_tx->desc, 2, &word); |
625 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, entry->ring->data_size); | 625 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, |
626 | rt2x00_desc_write(txd, 2, word); | 626 | entry->queue->data_size); |
627 | rt2x00_desc_write(priv_tx->desc, 2, word); | ||
627 | 628 | ||
628 | rt2x00_desc_read(txd, 0, &word); | 629 | rt2x00_desc_read(priv_tx->desc, 0, &word); |
629 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | 630 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); |
630 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | 631 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); |
631 | rt2x00_desc_write(txd, 0, word); | 632 | rt2x00_desc_write(priv_tx->desc, 0, word); |
632 | } | 633 | } |
633 | 634 | ||
634 | static int rt2400pci_init_rings(struct rt2x00_dev *rt2x00dev) | 635 | static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) |
635 | { | 636 | { |
637 | struct queue_entry_priv_pci_rx *priv_rx; | ||
638 | struct queue_entry_priv_pci_tx *priv_tx; | ||
636 | u32 reg; | 639 | u32 reg; |
637 | 640 | ||
638 | /* | 641 | /* |
639 | * Initialize registers. | 642 | * Initialize registers. |
640 | */ | 643 | */ |
641 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); | 644 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); |
642 | rt2x00_set_field32(®, TXCSR2_TXD_SIZE, | 645 | rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); |
643 | rt2x00dev->tx[IEEE80211_TX_QUEUE_DATA0].desc_size); | 646 | rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); |
644 | rt2x00_set_field32(®, TXCSR2_NUM_TXD, | 647 | rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->bcn[1].limit); |
645 | rt2x00dev->tx[IEEE80211_TX_QUEUE_DATA1].stats.limit); | 648 | rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); |
646 | rt2x00_set_field32(®, TXCSR2_NUM_ATIM, | ||
647 | rt2x00dev->bcn[1].stats.limit); | ||
648 | rt2x00_set_field32(®, TXCSR2_NUM_PRIO, | ||
649 | rt2x00dev->tx[IEEE80211_TX_QUEUE_DATA0].stats.limit); | ||
650 | rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); | 649 | rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); |
651 | 650 | ||
651 | priv_tx = rt2x00dev->tx[1].entries[0].priv_data; | ||
652 | rt2x00pci_register_read(rt2x00dev, TXCSR3, ®); | 652 | rt2x00pci_register_read(rt2x00dev, TXCSR3, ®); |
653 | rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER, | 653 | rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER, priv_tx->dma); |
654 | rt2x00dev->tx[IEEE80211_TX_QUEUE_DATA1].data_dma); | ||
655 | rt2x00pci_register_write(rt2x00dev, TXCSR3, reg); | 654 | rt2x00pci_register_write(rt2x00dev, TXCSR3, reg); |
656 | 655 | ||
656 | priv_tx = rt2x00dev->tx[0].entries[0].priv_data; | ||
657 | rt2x00pci_register_read(rt2x00dev, TXCSR5, ®); | 657 | rt2x00pci_register_read(rt2x00dev, TXCSR5, ®); |
658 | rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER, | 658 | rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER, priv_tx->dma); |
659 | rt2x00dev->tx[IEEE80211_TX_QUEUE_DATA0].data_dma); | ||
660 | rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); | 659 | rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); |
661 | 660 | ||
661 | priv_tx = rt2x00dev->bcn[1].entries[0].priv_data; | ||
662 | rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); | 662 | rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); |
663 | rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, | 663 | rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, priv_tx->dma); |
664 | rt2x00dev->bcn[1].data_dma); | ||
665 | rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); | 664 | rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); |
666 | 665 | ||
666 | priv_tx = rt2x00dev->bcn[0].entries[0].priv_data; | ||
667 | rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); | 667 | rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); |
668 | rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, | 668 | rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, priv_tx->dma); |
669 | rt2x00dev->bcn[0].data_dma); | ||
670 | rt2x00pci_register_write(rt2x00dev, TXCSR6, reg); | 669 | rt2x00pci_register_write(rt2x00dev, TXCSR6, reg); |
671 | 670 | ||
672 | rt2x00pci_register_read(rt2x00dev, RXCSR1, ®); | 671 | rt2x00pci_register_read(rt2x00dev, RXCSR1, ®); |
673 | rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size); | 672 | rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size); |
674 | rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->stats.limit); | 673 | rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); |
675 | rt2x00pci_register_write(rt2x00dev, RXCSR1, reg); | 674 | rt2x00pci_register_write(rt2x00dev, RXCSR1, reg); |
676 | 675 | ||
676 | priv_rx = rt2x00dev->rx->entries[0].priv_data; | ||
677 | rt2x00pci_register_read(rt2x00dev, RXCSR2, ®); | 677 | rt2x00pci_register_read(rt2x00dev, RXCSR2, ®); |
678 | rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER, | 678 | rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER, priv_tx->dma); |
679 | rt2x00dev->rx->data_dma); | ||
680 | rt2x00pci_register_write(rt2x00dev, RXCSR2, reg); | 679 | rt2x00pci_register_write(rt2x00dev, RXCSR2, reg); |
681 | 680 | ||
682 | return 0; | 681 | return 0; |
@@ -859,7 +858,7 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
859 | /* | 858 | /* |
860 | * Initialize all registers. | 859 | * Initialize all registers. |
861 | */ | 860 | */ |
862 | if (rt2400pci_init_rings(rt2x00dev) || | 861 | if (rt2400pci_init_queues(rt2x00dev) || |
863 | rt2400pci_init_registers(rt2x00dev) || | 862 | rt2400pci_init_registers(rt2x00dev) || |
864 | rt2400pci_init_bbp(rt2x00dev)) { | 863 | rt2400pci_init_bbp(rt2x00dev)) { |
865 | ERROR(rt2x00dev, "Register initialization failed.\n"); | 864 | ERROR(rt2x00dev, "Register initialization failed.\n"); |
@@ -986,10 +985,10 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
986 | */ | 985 | */ |
987 | static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 986 | static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, |
988 | struct sk_buff *skb, | 987 | struct sk_buff *skb, |
989 | struct txdata_entry_desc *desc, | 988 | struct txentry_desc *txdesc, |
990 | struct ieee80211_tx_control *control) | 989 | struct ieee80211_tx_control *control) |
991 | { | 990 | { |
992 | struct skb_desc *skbdesc = get_skb_desc(skb); | 991 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
993 | __le32 *txd = skbdesc->desc; | 992 | __le32 *txd = skbdesc->desc; |
994 | u32 word; | 993 | u32 word; |
995 | 994 | ||
@@ -1001,19 +1000,19 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1001 | rt2x00_desc_write(txd, 2, word); | 1000 | rt2x00_desc_write(txd, 2, word); |
1002 | 1001 | ||
1003 | rt2x00_desc_read(txd, 3, &word); | 1002 | rt2x00_desc_read(txd, 3, &word); |
1004 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, desc->signal); | 1003 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, txdesc->signal); |
1005 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_REGNUM, 5); | 1004 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_REGNUM, 5); |
1006 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_BUSY, 1); | 1005 | rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_BUSY, 1); |
1007 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, desc->service); | 1006 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, txdesc->service); |
1008 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_REGNUM, 6); | 1007 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_REGNUM, 6); |
1009 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_BUSY, 1); | 1008 | rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_BUSY, 1); |
1010 | rt2x00_desc_write(txd, 3, word); | 1009 | rt2x00_desc_write(txd, 3, word); |
1011 | 1010 | ||
1012 | rt2x00_desc_read(txd, 4, &word); | 1011 | rt2x00_desc_read(txd, 4, &word); |
1013 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_LOW, desc->length_low); | 1012 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_LOW, txdesc->length_low); |
1014 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_REGNUM, 8); | 1013 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_REGNUM, 8); |
1015 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_BUSY, 1); | 1014 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_BUSY, 1); |
1016 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_HIGH, desc->length_high); | 1015 | rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_HIGH, txdesc->length_high); |
1017 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_REGNUM, 7); | 1016 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_REGNUM, 7); |
1018 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); | 1017 | rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); |
1019 | rt2x00_desc_write(txd, 4, word); | 1018 | rt2x00_desc_write(txd, 4, word); |
@@ -1022,14 +1021,14 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1022 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); | 1021 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); |
1023 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); | 1022 | rt2x00_set_field32(&word, TXD_W0_VALID, 1); |
1024 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, | 1023 | rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, |
1025 | test_bit(ENTRY_TXD_MORE_FRAG, &desc->flags)); | 1024 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); |
1026 | rt2x00_set_field32(&word, TXD_W0_ACK, | 1025 | rt2x00_set_field32(&word, TXD_W0_ACK, |
1027 | test_bit(ENTRY_TXD_ACK, &desc->flags)); | 1026 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); |
1028 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, | 1027 | rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, |
1029 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &desc->flags)); | 1028 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); |
1030 | rt2x00_set_field32(&word, TXD_W0_RTS, | 1029 | rt2x00_set_field32(&word, TXD_W0_RTS, |
1031 | test_bit(ENTRY_TXD_RTS_FRAME, &desc->flags)); | 1030 | test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); |
1032 | rt2x00_set_field32(&word, TXD_W0_IFS, desc->ifs); | 1031 | rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs); |
1033 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, | 1032 | rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, |
1034 | !!(control->flags & | 1033 | !!(control->flags & |
1035 | IEEE80211_TXCTL_LONG_RETRY_LIMIT)); | 1034 | IEEE80211_TXCTL_LONG_RETRY_LIMIT)); |
@@ -1066,49 +1065,49 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1066 | /* | 1065 | /* |
1067 | * RX control handlers | 1066 | * RX control handlers |
1068 | */ | 1067 | */ |
1069 | static void rt2400pci_fill_rxdone(struct data_entry *entry, | 1068 | static void rt2400pci_fill_rxdone(struct queue_entry *entry, |
1070 | struct rxdata_entry_desc *desc) | 1069 | struct rxdone_entry_desc *rxdesc) |
1071 | { | 1070 | { |
1072 | __le32 *rxd = entry->priv; | 1071 | struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data; |
1073 | u32 word0; | 1072 | u32 word0; |
1074 | u32 word2; | 1073 | u32 word2; |
1075 | 1074 | ||
1076 | rt2x00_desc_read(rxd, 0, &word0); | 1075 | rt2x00_desc_read(priv_rx->desc, 0, &word0); |
1077 | rt2x00_desc_read(rxd, 2, &word2); | 1076 | rt2x00_desc_read(priv_rx->desc, 2, &word2); |
1078 | 1077 | ||
1079 | desc->flags = 0; | 1078 | rxdesc->flags = 0; |
1080 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) | 1079 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) |
1081 | desc->flags |= RX_FLAG_FAILED_FCS_CRC; | 1080 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
1082 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) | 1081 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) |
1083 | desc->flags |= RX_FLAG_FAILED_PLCP_CRC; | 1082 | rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; |
1084 | 1083 | ||
1085 | /* | 1084 | /* |
1086 | * Obtain the status about this packet. | 1085 | * Obtain the status about this packet. |
1087 | */ | 1086 | */ |
1088 | desc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL); | 1087 | rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL); |
1089 | desc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) - | 1088 | rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) - |
1090 | entry->ring->rt2x00dev->rssi_offset; | 1089 | entry->queue->rt2x00dev->rssi_offset; |
1091 | desc->ofdm = 0; | 1090 | rxdesc->ofdm = 0; |
1092 | desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); | 1091 | rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); |
1093 | desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); | 1092 | rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); |
1094 | } | 1093 | } |
1095 | 1094 | ||
1096 | /* | 1095 | /* |
1097 | * Interrupt functions. | 1096 | * Interrupt functions. |
1098 | */ | 1097 | */ |
1099 | static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue) | 1098 | static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, |
1099 | const enum ieee80211_tx_queue queue_idx) | ||
1100 | { | 1100 | { |
1101 | struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue); | 1101 | struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); |
1102 | struct data_entry *entry; | 1102 | struct queue_entry_priv_pci_tx *priv_tx; |
1103 | __le32 *txd; | 1103 | struct queue_entry *entry; |
1104 | struct txdone_entry_desc txdesc; | ||
1104 | u32 word; | 1105 | u32 word; |
1105 | int tx_status; | ||
1106 | int retry; | ||
1107 | 1106 | ||
1108 | while (!rt2x00_ring_empty(ring)) { | 1107 | while (!rt2x00queue_empty(queue)) { |
1109 | entry = rt2x00_get_data_entry_done(ring); | 1108 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); |
1110 | txd = entry->priv; | 1109 | priv_tx = entry->priv_data; |
1111 | rt2x00_desc_read(txd, 0, &word); | 1110 | rt2x00_desc_read(priv_tx->desc, 0, &word); |
1112 | 1111 | ||
1113 | if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || | 1112 | if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || |
1114 | !rt2x00_get_field32(word, TXD_W0_VALID)) | 1113 | !rt2x00_get_field32(word, TXD_W0_VALID)) |
@@ -1117,10 +1116,10 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue) | |||
1117 | /* | 1116 | /* |
1118 | * Obtain the status about this packet. | 1117 | * Obtain the status about this packet. |
1119 | */ | 1118 | */ |
1120 | tx_status = rt2x00_get_field32(word, TXD_W0_RESULT); | 1119 | txdesc.status = rt2x00_get_field32(word, TXD_W0_RESULT); |
1121 | retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); | 1120 | txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); |
1122 | 1121 | ||
1123 | rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry); | 1122 | rt2x00pci_txdone(rt2x00dev, entry, &txdesc); |
1124 | } | 1123 | } |
1125 | } | 1124 | } |
1126 | 1125 | ||
@@ -1374,9 +1373,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1374 | rt2400pci_probe_hw_mode(rt2x00dev); | 1373 | rt2400pci_probe_hw_mode(rt2x00dev); |
1375 | 1374 | ||
1376 | /* | 1375 | /* |
1377 | * This device requires the beacon ring | 1376 | * This device requires the atim queue |
1378 | */ | 1377 | */ |
1379 | __set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags); | 1378 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
1380 | 1379 | ||
1381 | /* | 1380 | /* |
1382 | * Set the rssi offset. | 1381 | * Set the rssi offset. |
@@ -1481,7 +1480,8 @@ static int rt2400pci_conf_tx(struct ieee80211_hw *hw, | |||
1481 | /* | 1480 | /* |
1482 | * Write configuration to register. | 1481 | * Write configuration to register. |
1483 | */ | 1482 | */ |
1484 | rt2400pci_config_cw(rt2x00dev, &rt2x00dev->tx->tx_params); | 1483 | rt2400pci_config_cw(rt2x00dev, |
1484 | rt2x00dev->tx->cw_min, rt2x00dev->tx->cw_max); | ||
1485 | 1485 | ||
1486 | return 0; | 1486 | return 0; |
1487 | } | 1487 | } |
@@ -1560,12 +1560,42 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | |||
1560 | .config = rt2400pci_config, | 1560 | .config = rt2400pci_config, |
1561 | }; | 1561 | }; |
1562 | 1562 | ||
1563 | static const struct data_queue_desc rt2400pci_queue_rx = { | ||
1564 | .entry_num = RX_ENTRIES, | ||
1565 | .data_size = DATA_FRAME_SIZE, | ||
1566 | .desc_size = RXD_DESC_SIZE, | ||
1567 | .priv_size = sizeof(struct queue_entry_priv_pci_rx), | ||
1568 | }; | ||
1569 | |||
1570 | static const struct data_queue_desc rt2400pci_queue_tx = { | ||
1571 | .entry_num = TX_ENTRIES, | ||
1572 | .data_size = DATA_FRAME_SIZE, | ||
1573 | .desc_size = TXD_DESC_SIZE, | ||
1574 | .priv_size = sizeof(struct queue_entry_priv_pci_tx), | ||
1575 | }; | ||
1576 | |||
1577 | static const struct data_queue_desc rt2400pci_queue_bcn = { | ||
1578 | .entry_num = BEACON_ENTRIES, | ||
1579 | .data_size = MGMT_FRAME_SIZE, | ||
1580 | .desc_size = TXD_DESC_SIZE, | ||
1581 | .priv_size = sizeof(struct queue_entry_priv_pci_tx), | ||
1582 | }; | ||
1583 | |||
1584 | static const struct data_queue_desc rt2400pci_queue_atim = { | ||
1585 | .entry_num = ATIM_ENTRIES, | ||
1586 | .data_size = DATA_FRAME_SIZE, | ||
1587 | .desc_size = TXD_DESC_SIZE, | ||
1588 | .priv_size = sizeof(struct queue_entry_priv_pci_tx), | ||
1589 | }; | ||
1590 | |||
1563 | static const struct rt2x00_ops rt2400pci_ops = { | 1591 | static const struct rt2x00_ops rt2400pci_ops = { |
1564 | .name = KBUILD_MODNAME, | 1592 | .name = KBUILD_MODNAME, |
1565 | .rxd_size = RXD_DESC_SIZE, | ||
1566 | .txd_size = TXD_DESC_SIZE, | ||
1567 | .eeprom_size = EEPROM_SIZE, | 1593 | .eeprom_size = EEPROM_SIZE, |
1568 | .rf_size = RF_SIZE, | 1594 | .rf_size = RF_SIZE, |
1595 | .rx = &rt2400pci_queue_rx, | ||
1596 | .tx = &rt2400pci_queue_tx, | ||
1597 | .bcn = &rt2400pci_queue_bcn, | ||
1598 | .atim = &rt2400pci_queue_atim, | ||
1569 | .lib = &rt2400pci_rt2x00_ops, | 1599 | .lib = &rt2400pci_rt2x00_ops, |
1570 | .hw = &rt2400pci_mac80211_ops, | 1600 | .hw = &rt2400pci_mac80211_ops, |
1571 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 1601 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |