Commit 632dd959 authored by Alban Browaeys's avatar Alban Browaeys Committed by John W. Linville

rt2x00: txdone implementation supporting hw encryption.

This is an implementation that support WCID being the encryption key.
Wireless Cli Id was set to be the encryption key in rt2800pci_write_tx_desc
and read (TX_STA_FIFO_WCID) as the current queue entry index.
Signed-off-by: default avatarBenoit Papillault <benoit.papillault@free.fr>
Signed-off-by: default avatarAlban Browaeys <prahal@yahoo.com>
Acked-by: default avatarIvo van Doorn <ivdoorn@gmail.com>
Signed-off-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d6e36ec1
...@@ -907,14 +907,12 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) ...@@ -907,14 +907,12 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
{ {
struct data_queue *queue; struct data_queue *queue;
struct queue_entry *entry; struct queue_entry *entry;
struct queue_entry *entry_done; __le32 *txwi;
struct queue_entry_priv_pci *entry_priv;
struct txdone_entry_desc txdesc; struct txdone_entry_desc txdesc;
u32 word; u32 word;
u32 reg; u32 reg;
u32 old_reg; u32 old_reg;
unsigned int type; int wcid, ack, pid, tx_wcid, tx_ack, tx_pid;
unsigned int index;
u16 mcs, real_mcs; u16 mcs, real_mcs;
/* /*
...@@ -936,47 +934,41 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) ...@@ -936,47 +934,41 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
break; break;
old_reg = reg; old_reg = reg;
wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID);
ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED);
pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE);
/* /*
* Skip this entry when it contains an invalid * Skip this entry when it contains an invalid
* queue identication number. * queue identication number.
*/ */
type = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE) - 1; if (pid <= 0 || pid > QID_RX)
if (type >= QID_RX)
continue; continue;
queue = rt2x00queue_get_queue(rt2x00dev, type); queue = rt2x00queue_get_queue(rt2x00dev, pid - 1);
if (unlikely(!queue)) if (unlikely(!queue))
continue; continue;
/* /*
* Skip this entry when it contains an invalid * Inside each queue, we process each entry in a chronological
* index number. * order. We first check that the queue is not empty.
*/ */
index = rt2x00_get_field32(reg, TX_STA_FIFO_WCID) - 1; if (rt2x00queue_empty(queue))
if (unlikely(index >= queue->limit))
continue; continue;
entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
entry = &queue->entries[index]; /* Check if we got a match by looking at WCID/ACK/PID
entry_priv = entry->priv_data; * fields */
rt2x00_desc_read((__le32 *)entry->skb->data, 0, &word); txwi = (__le32 *)(entry->skb->data -
rt2x00dev->ops->extra_tx_headroom);
entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
while (entry != entry_done) { rt2x00_desc_read(txwi, 1, &word);
/* tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID);
* Catch up. tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK);
* Just report any entries we missed as failed. tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID);
*/
WARNING(rt2x00dev, if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid))
"TX status report missed for entry %d\n", WARNING(rt2x00dev, "invalid TX_STA_FIFO content\n");
entry_done->entry_idx);
txdesc.flags = 0;
__set_bit(TXDONE_UNKNOWN, &txdesc.flags);
txdesc.retry = 0;
rt2x00lib_txdone(entry_done, &txdesc);
entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
}
/* /*
* Obtain the status about this packet. * Obtain the status about this packet.
...@@ -997,6 +989,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) ...@@ -997,6 +989,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
* we have mcs = tx_mcs - 1. So the number of * we have mcs = tx_mcs - 1. So the number of
* retry is (tx_mcs - mcs). * retry is (tx_mcs - mcs).
*/ */
rt2x00_desc_read(txwi, 0, &word);
mcs = rt2x00_get_field32(word, TXWI_W0_MCS); mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS); real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
__set_bit(TXDONE_FALLBACK, &txdesc.flags); __set_bit(TXDONE_FALLBACK, &txdesc.flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment