aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-05-10 07:46:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:47:35 -0400
commitb8be63ffa5dc44324e7f507997870fa3e4b17619 (patch)
treead9ef1c3e4e09111ad93b003baaec325bd5e40e0 /drivers/net/wireless/rt2x00/rt2400pci.c
parentdec13b6bda600c7e7da993e634562873112af50b (diff)
rt2x00: Merge RX and TX entry private data
With the pending removal of the tx_control structure we can merge the RX and TX entry private data structure in advance. This will temporarily increase the required memory for the queue, but that overhead will only be limited. 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/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index a491ba5bb5c3..b11f445c7479 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -620,39 +620,38 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
620static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, 620static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev,
621 struct queue_entry *entry) 621 struct queue_entry *entry)
622{ 622{
623 struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data; 623 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
624 u32 word; 624 u32 word;
625 625
626 rt2x00_desc_read(priv_rx->desc, 2, &word); 626 rt2x00_desc_read(entry_priv->desc, 2, &word);
627 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, 627 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH,
628 entry->queue->data_size); 628 entry->queue->data_size);
629 rt2x00_desc_write(priv_rx->desc, 2, word); 629 rt2x00_desc_write(entry_priv->desc, 2, word);
630 630
631 rt2x00_desc_read(priv_rx->desc, 1, &word); 631 rt2x00_desc_read(entry_priv->desc, 1, &word);
632 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, priv_rx->data_dma); 632 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry_priv->data_dma);
633 rt2x00_desc_write(priv_rx->desc, 1, word); 633 rt2x00_desc_write(entry_priv->desc, 1, word);
634 634
635 rt2x00_desc_read(priv_rx->desc, 0, &word); 635 rt2x00_desc_read(entry_priv->desc, 0, &word);
636 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); 636 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
637 rt2x00_desc_write(priv_rx->desc, 0, word); 637 rt2x00_desc_write(entry_priv->desc, 0, word);
638} 638}
639 639
640static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev, 640static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev,
641 struct queue_entry *entry) 641 struct queue_entry *entry)
642{ 642{
643 struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; 643 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
644 u32 word; 644 u32 word;
645 645
646 rt2x00_desc_read(priv_tx->desc, 0, &word); 646 rt2x00_desc_read(entry_priv->desc, 0, &word);
647 rt2x00_set_field32(&word, TXD_W0_VALID, 0); 647 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
648 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); 648 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
649 rt2x00_desc_write(priv_tx->desc, 0, word); 649 rt2x00_desc_write(entry_priv->desc, 0, word);
650} 650}
651 651
652static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) 652static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
653{ 653{
654 struct queue_entry_priv_pci_rx *priv_rx; 654 struct queue_entry_priv_pci *entry_priv;
655 struct queue_entry_priv_pci_tx *priv_tx;
656 u32 reg; 655 u32 reg;
657 656
658 /* 657 /*
@@ -665,28 +664,28 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
665 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); 664 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit);
666 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); 665 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg);
667 666
668 priv_tx = rt2x00dev->tx[1].entries[0].priv_data; 667 entry_priv = rt2x00dev->tx[1].entries[0].priv_data;
669 rt2x00pci_register_read(rt2x00dev, TXCSR3, &reg); 668 rt2x00pci_register_read(rt2x00dev, TXCSR3, &reg);
670 rt2x00_set_field32(&reg, TXCSR3_TX_RING_REGISTER, 669 rt2x00_set_field32(&reg, TXCSR3_TX_RING_REGISTER,
671 priv_tx->desc_dma); 670 entry_priv->desc_dma);
672 rt2x00pci_register_write(rt2x00dev, TXCSR3, reg); 671 rt2x00pci_register_write(rt2x00dev, TXCSR3, reg);
673 672
674 priv_tx = rt2x00dev->tx[0].entries[0].priv_data; 673 entry_priv = rt2x00dev->tx[0].entries[0].priv_data;
675 rt2x00pci_register_read(rt2x00dev, TXCSR5, &reg); 674 rt2x00pci_register_read(rt2x00dev, TXCSR5, &reg);
676 rt2x00_set_field32(&reg, TXCSR5_PRIO_RING_REGISTER, 675 rt2x00_set_field32(&reg, TXCSR5_PRIO_RING_REGISTER,
677 priv_tx->desc_dma); 676 entry_priv->desc_dma);
678 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); 677 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg);
679 678
680 priv_tx = rt2x00dev->bcn[1].entries[0].priv_data; 679 entry_priv = rt2x00dev->bcn[1].entries[0].priv_data;
681 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg); 680 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg);
682 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER, 681 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER,
683 priv_tx->desc_dma); 682 entry_priv->desc_dma);
684 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); 683 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg);
685 684
686 priv_tx = rt2x00dev->bcn[0].entries[0].priv_data; 685 entry_priv = rt2x00dev->bcn[0].entries[0].priv_data;
687 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg); 686 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg);
688 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER, 687 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER,
689 priv_tx->desc_dma); 688 entry_priv->desc_dma);
690 rt2x00pci_register_write(rt2x00dev, TXCSR6, reg); 689 rt2x00pci_register_write(rt2x00dev, TXCSR6, reg);
691 690
692 rt2x00pci_register_read(rt2x00dev, RXCSR1, &reg); 691 rt2x00pci_register_read(rt2x00dev, RXCSR1, &reg);
@@ -694,9 +693,10 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
694 rt2x00_set_field32(&reg, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); 693 rt2x00_set_field32(&reg, RXCSR1_NUM_RXD, rt2x00dev->rx->limit);
695 rt2x00pci_register_write(rt2x00dev, RXCSR1, reg); 694 rt2x00pci_register_write(rt2x00dev, RXCSR1, reg);
696 695
697 priv_rx = rt2x00dev->rx->entries[0].priv_data; 696 entry_priv = rt2x00dev->rx->entries[0].priv_data;
698 rt2x00pci_register_read(rt2x00dev, RXCSR2, &reg); 697 rt2x00pci_register_read(rt2x00dev, RXCSR2, &reg);
699 rt2x00_set_field32(&reg, RXCSR2_RX_RING_REGISTER, priv_rx->desc_dma); 698 rt2x00_set_field32(&reg, RXCSR2_RX_RING_REGISTER,
699 entry_priv->desc_dma);
700 rt2x00pci_register_write(rt2x00dev, RXCSR2, reg); 700 rt2x00pci_register_write(rt2x00dev, RXCSR2, reg);
701 701
702 return 0; 702 return 0;
@@ -995,7 +995,7 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
995 struct txentry_desc *txdesc) 995 struct txentry_desc *txdesc)
996{ 996{
997 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); 997 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
998 struct queue_entry_priv_pci_tx *entry_priv = skbdesc->entry->priv_data; 998 struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data;
999 __le32 *txd = skbdesc->desc; 999 __le32 *txd = skbdesc->desc;
1000 u32 word; 1000 u32 word;
1001 1001
@@ -1078,14 +1078,14 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1078static void rt2400pci_fill_rxdone(struct queue_entry *entry, 1078static void rt2400pci_fill_rxdone(struct queue_entry *entry,
1079 struct rxdone_entry_desc *rxdesc) 1079 struct rxdone_entry_desc *rxdesc)
1080{ 1080{
1081 struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data; 1081 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1082 u32 word0; 1082 u32 word0;
1083 u32 word2; 1083 u32 word2;
1084 u32 word3; 1084 u32 word3;
1085 1085
1086 rt2x00_desc_read(priv_rx->desc, 0, &word0); 1086 rt2x00_desc_read(entry_priv->desc, 0, &word0);
1087 rt2x00_desc_read(priv_rx->desc, 2, &word2); 1087 rt2x00_desc_read(entry_priv->desc, 2, &word2);
1088 rt2x00_desc_read(priv_rx->desc, 3, &word3); 1088 rt2x00_desc_read(entry_priv->desc, 3, &word3);
1089 1089
1090 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) 1090 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR))
1091 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; 1091 rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
@@ -1114,15 +1114,15 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev,
1114 const enum data_queue_qid queue_idx) 1114 const enum data_queue_qid queue_idx)
1115{ 1115{
1116 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); 1116 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
1117 struct queue_entry_priv_pci_tx *priv_tx; 1117 struct queue_entry_priv_pci *entry_priv;
1118 struct queue_entry *entry; 1118 struct queue_entry *entry;
1119 struct txdone_entry_desc txdesc; 1119 struct txdone_entry_desc txdesc;
1120 u32 word; 1120 u32 word;
1121 1121
1122 while (!rt2x00queue_empty(queue)) { 1122 while (!rt2x00queue_empty(queue)) {
1123 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); 1123 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
1124 priv_tx = entry->priv_data; 1124 entry_priv = entry->priv_data;
1125 rt2x00_desc_read(priv_tx->desc, 0, &word); 1125 rt2x00_desc_read(entry_priv->desc, 0, &word);
1126 1126
1127 if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || 1127 if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) ||
1128 !rt2x00_get_field32(word, TXD_W0_VALID)) 1128 !rt2x00_get_field32(word, TXD_W0_VALID))
@@ -1489,14 +1489,14 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1489{ 1489{
1490 struct rt2x00_dev *rt2x00dev = hw->priv; 1490 struct rt2x00_dev *rt2x00dev = hw->priv;
1491 struct rt2x00_intf *intf = vif_to_intf(control->vif); 1491 struct rt2x00_intf *intf = vif_to_intf(control->vif);
1492 struct queue_entry_priv_pci_tx *priv_tx; 1492 struct queue_entry_priv_pci *entry_priv;
1493 struct skb_frame_desc *skbdesc; 1493 struct skb_frame_desc *skbdesc;
1494 struct txentry_desc txdesc; 1494 struct txentry_desc txdesc;
1495 u32 reg; 1495 u32 reg;
1496 1496
1497 if (unlikely(!intf->beacon)) 1497 if (unlikely(!intf->beacon))
1498 return -ENOBUFS; 1498 return -ENOBUFS;
1499 priv_tx = intf->beacon->priv_data; 1499 entry_priv = intf->beacon->priv_data;
1500 1500
1501 /* 1501 /*
1502 * Copy all TX descriptor information into txdesc, 1502 * Copy all TX descriptor information into txdesc,
@@ -1514,7 +1514,7 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1514 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED; 1514 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED;
1515 skbdesc->data = skb->data; 1515 skbdesc->data = skb->data;
1516 skbdesc->data_len = skb->len; 1516 skbdesc->data_len = skb->len;
1517 skbdesc->desc = priv_tx->desc; 1517 skbdesc->desc = entry_priv->desc;
1518 skbdesc->desc_len = intf->beacon->queue->desc_size; 1518 skbdesc->desc_len = intf->beacon->queue->desc_size;
1519 skbdesc->entry = intf->beacon; 1519 skbdesc->entry = intf->beacon;
1520 1520
@@ -1533,7 +1533,7 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1533 * Write entire beacon with descriptor to register, 1533 * Write entire beacon with descriptor to register,
1534 * and kick the beacon generator. 1534 * and kick the beacon generator.
1535 */ 1535 */
1536 memcpy(priv_tx->data, skb->data, skb->len); 1536 memcpy(entry_priv->data, skb->data, skb->len);
1537 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); 1537 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
1538 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); 1538 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
1539 1539
@@ -1594,28 +1594,28 @@ static const struct data_queue_desc rt2400pci_queue_rx = {
1594 .entry_num = RX_ENTRIES, 1594 .entry_num = RX_ENTRIES,
1595 .data_size = DATA_FRAME_SIZE, 1595 .data_size = DATA_FRAME_SIZE,
1596 .desc_size = RXD_DESC_SIZE, 1596 .desc_size = RXD_DESC_SIZE,
1597 .priv_size = sizeof(struct queue_entry_priv_pci_rx), 1597 .priv_size = sizeof(struct queue_entry_priv_pci),
1598}; 1598};
1599 1599
1600static const struct data_queue_desc rt2400pci_queue_tx = { 1600static const struct data_queue_desc rt2400pci_queue_tx = {
1601 .entry_num = TX_ENTRIES, 1601 .entry_num = TX_ENTRIES,
1602 .data_size = DATA_FRAME_SIZE, 1602 .data_size = DATA_FRAME_SIZE,
1603 .desc_size = TXD_DESC_SIZE, 1603 .desc_size = TXD_DESC_SIZE,
1604 .priv_size = sizeof(struct queue_entry_priv_pci_tx), 1604 .priv_size = sizeof(struct queue_entry_priv_pci),
1605}; 1605};
1606 1606
1607static const struct data_queue_desc rt2400pci_queue_bcn = { 1607static const struct data_queue_desc rt2400pci_queue_bcn = {
1608 .entry_num = BEACON_ENTRIES, 1608 .entry_num = BEACON_ENTRIES,
1609 .data_size = MGMT_FRAME_SIZE, 1609 .data_size = MGMT_FRAME_SIZE,
1610 .desc_size = TXD_DESC_SIZE, 1610 .desc_size = TXD_DESC_SIZE,
1611 .priv_size = sizeof(struct queue_entry_priv_pci_tx), 1611 .priv_size = sizeof(struct queue_entry_priv_pci),
1612}; 1612};
1613 1613
1614static const struct data_queue_desc rt2400pci_queue_atim = { 1614static const struct data_queue_desc rt2400pci_queue_atim = {
1615 .entry_num = ATIM_ENTRIES, 1615 .entry_num = ATIM_ENTRIES,
1616 .data_size = DATA_FRAME_SIZE, 1616 .data_size = DATA_FRAME_SIZE,
1617 .desc_size = TXD_DESC_SIZE, 1617 .desc_size = TXD_DESC_SIZE,
1618 .priv_size = sizeof(struct queue_entry_priv_pci_tx), 1618 .priv_size = sizeof(struct queue_entry_priv_pci),
1619}; 1619};
1620 1620
1621static const struct rt2x00_ops rt2400pci_ops = { 1621static const struct rt2x00_ops rt2400pci_ops = {