diff options
author | Gertjan van Wingerde <gwingerde@kpnplanet.nl> | 2008-05-10 07:44:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:47:33 -0400 |
commit | 4de36fe5abe077a4c65bf0b6a309865aa043e055 (patch) | |
tree | 3d7aadff5f9163a115c1fd1ee6de5146b797c76b | |
parent | 70a96109439cba0af0780ee1dc25ec7ed15f0bae (diff) |
rt2x00: Only initialize the minimum needed fields of PCI TX descriptors.
In preparation of replacing the statically allocated data DMA buffers with DMA-mapped
skb's we need to change the TXD handling of the PCI drivers, by moving the programming
of the buffer address fields to the actual TXD writing at TX time, instead of at start-up
time.
Signed-off-by: Gertjan van Wingerde <gwingerde@kpnplanet.nl>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 24 |
3 files changed, 21 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index b4310d798f94..2c0cf394c78e 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -643,15 +643,6 @@ static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev, | |||
643 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; | 643 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; |
644 | u32 word; | 644 | u32 word; |
645 | 645 | ||
646 | rt2x00_desc_read(priv_tx->desc, 1, &word); | ||
647 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, priv_tx->data_dma); | ||
648 | rt2x00_desc_write(priv_tx->desc, 1, word); | ||
649 | |||
650 | rt2x00_desc_read(priv_tx->desc, 2, &word); | ||
651 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, | ||
652 | entry->queue->data_size); | ||
653 | rt2x00_desc_write(priv_tx->desc, 2, word); | ||
654 | |||
655 | rt2x00_desc_read(priv_tx->desc, 0, &word); | 646 | rt2x00_desc_read(priv_tx->desc, 0, &word); |
656 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | 647 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); |
657 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | 648 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); |
@@ -1004,13 +995,19 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1004 | struct txentry_desc *txdesc) | 995 | struct txentry_desc *txdesc) |
1005 | { | 996 | { |
1006 | 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; | ||
1007 | __le32 *txd = skbdesc->desc; | 999 | __le32 *txd = skbdesc->desc; |
1008 | u32 word; | 1000 | u32 word; |
1009 | 1001 | ||
1010 | /* | 1002 | /* |
1011 | * Start writing the descriptor words. | 1003 | * Start writing the descriptor words. |
1012 | */ | 1004 | */ |
1005 | rt2x00_desc_read(entry_priv->desc, 1, &word); | ||
1006 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | ||
1007 | rt2x00_desc_write(entry_priv->desc, 1, word); | ||
1008 | |||
1013 | rt2x00_desc_read(txd, 2, &word); | 1009 | rt2x00_desc_read(txd, 2, &word); |
1010 | rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, skbdesc->data_len); | ||
1014 | rt2x00_set_field32(&word, TXD_W2_DATABYTE_COUNT, skbdesc->data_len); | 1011 | rt2x00_set_field32(&word, TXD_W2_DATABYTE_COUNT, skbdesc->data_len); |
1015 | rt2x00_desc_write(txd, 2, word); | 1012 | rt2x00_desc_write(txd, 2, word); |
1016 | 1013 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 54aaa8375a2c..6c31c5db0ca1 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -733,10 +733,6 @@ static void rt2500pci_init_txentry(struct rt2x00_dev *rt2x00dev, | |||
733 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; | 733 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; |
734 | u32 word; | 734 | u32 word; |
735 | 735 | ||
736 | rt2x00_desc_read(priv_tx->desc, 1, &word); | ||
737 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, priv_tx->data_dma); | ||
738 | rt2x00_desc_write(priv_tx->desc, 1, word); | ||
739 | |||
740 | rt2x00_desc_read(priv_tx->desc, 0, &word); | 736 | rt2x00_desc_read(priv_tx->desc, 0, &word); |
741 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | 737 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); |
742 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | 738 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); |
@@ -1158,12 +1154,17 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1158 | struct txentry_desc *txdesc) | 1154 | struct txentry_desc *txdesc) |
1159 | { | 1155 | { |
1160 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1156 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1157 | struct queue_entry_priv_pci_tx *entry_priv = skbdesc->entry->priv_data; | ||
1161 | __le32 *txd = skbdesc->desc; | 1158 | __le32 *txd = skbdesc->desc; |
1162 | u32 word; | 1159 | u32 word; |
1163 | 1160 | ||
1164 | /* | 1161 | /* |
1165 | * Start writing the descriptor words. | 1162 | * Start writing the descriptor words. |
1166 | */ | 1163 | */ |
1164 | rt2x00_desc_read(entry_priv->desc, 1, &word); | ||
1165 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | ||
1166 | rt2x00_desc_write(entry_priv->desc, 1, word); | ||
1167 | |||
1167 | rt2x00_desc_read(txd, 2, &word); | 1168 | rt2x00_desc_read(txd, 2, &word); |
1168 | rt2x00_set_field32(&word, TXD_W2_IV_OFFSET, IEEE80211_HEADER); | 1169 | rt2x00_set_field32(&word, TXD_W2_IV_OFFSET, IEEE80211_HEADER); |
1169 | rt2x00_set_field32(&word, TXD_W2_AIFS, txdesc->aifs); | 1170 | rt2x00_set_field32(&word, TXD_W2_AIFS, txdesc->aifs); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 68d2216131b2..d8e681ec4bb0 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1037,20 +1037,6 @@ static void rt61pci_init_txentry(struct rt2x00_dev *rt2x00dev, | |||
1037 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; | 1037 | struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data; |
1038 | u32 word; | 1038 | u32 word; |
1039 | 1039 | ||
1040 | rt2x00_desc_read(priv_tx->desc, 1, &word); | ||
1041 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); | ||
1042 | rt2x00_desc_write(priv_tx->desc, 1, word); | ||
1043 | |||
1044 | rt2x00_desc_read(priv_tx->desc, 5, &word); | ||
1045 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->queue->qid); | ||
1046 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, entry->entry_idx); | ||
1047 | rt2x00_desc_write(priv_tx->desc, 5, word); | ||
1048 | |||
1049 | rt2x00_desc_read(priv_tx->desc, 6, &word); | ||
1050 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | ||
1051 | priv_tx->data_dma); | ||
1052 | rt2x00_desc_write(priv_tx->desc, 6, word); | ||
1053 | |||
1054 | rt2x00_desc_read(priv_tx->desc, 0, &word); | 1040 | rt2x00_desc_read(priv_tx->desc, 0, &word); |
1055 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | 1041 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); |
1056 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | 1042 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); |
@@ -1529,6 +1515,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1529 | struct txentry_desc *txdesc) | 1515 | struct txentry_desc *txdesc) |
1530 | { | 1516 | { |
1531 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1517 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1518 | struct queue_entry_priv_pci_tx *entry_priv = skbdesc->entry->priv_data; | ||
1532 | __le32 *txd = skbdesc->desc; | 1519 | __le32 *txd = skbdesc->desc; |
1533 | u32 word; | 1520 | u32 word; |
1534 | 1521 | ||
@@ -1542,6 +1529,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1542 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); | 1529 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); |
1543 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); | 1530 | rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); |
1544 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); | 1531 | rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); |
1532 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); | ||
1545 | rt2x00_desc_write(txd, 1, word); | 1533 | rt2x00_desc_write(txd, 1, word); |
1546 | 1534 | ||
1547 | rt2x00_desc_read(txd, 2, &word); | 1535 | rt2x00_desc_read(txd, 2, &word); |
@@ -1552,11 +1540,19 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1552 | rt2x00_desc_write(txd, 2, word); | 1540 | rt2x00_desc_write(txd, 2, word); |
1553 | 1541 | ||
1554 | rt2x00_desc_read(txd, 5, &word); | 1542 | rt2x00_desc_read(txd, 5, &word); |
1543 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, skbdesc->entry->queue->qid); | ||
1544 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, | ||
1545 | skbdesc->entry->entry_idx); | ||
1555 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, | 1546 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, |
1556 | TXPOWER_TO_DEV(rt2x00dev->tx_power)); | 1547 | TXPOWER_TO_DEV(rt2x00dev->tx_power)); |
1557 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); | 1548 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); |
1558 | rt2x00_desc_write(txd, 5, word); | 1549 | rt2x00_desc_write(txd, 5, word); |
1559 | 1550 | ||
1551 | rt2x00_desc_read(txd, 6, &word); | ||
1552 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | ||
1553 | entry_priv->data_dma); | ||
1554 | rt2x00_desc_write(txd, 6, word); | ||
1555 | |||
1560 | if (skbdesc->desc_len > TXINFO_SIZE) { | 1556 | if (skbdesc->desc_len > TXINFO_SIZE) { |
1561 | rt2x00_desc_read(txd, 11, &word); | 1557 | rt2x00_desc_read(txd, 11, &word); |
1562 | rt2x00_set_field32(&word, TXD_W11_BUFFER_LENGTH0, skbdesc->data_len); | 1558 | rt2x00_set_field32(&word, TXD_W11_BUFFER_LENGTH0, skbdesc->data_len); |