linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2x00: txdone implementation supporting hw encryption.
@ 2010-02-26  1:06 Alban Browaeys
  2010-02-26 19:20 ` Gertjan van Wingerde
  2010-03-15 18:56 ` John W. Linville
  0 siblings, 2 replies; 7+ messages in thread
From: Alban Browaeys @ 2010-02-26  1:06 UTC (permalink / raw)
  To: John Linville
  Cc: Gertjan van Wingerde, rt2x00 Users List, Ivo van Doorn,
	Pavel Roskin, linux-wireless

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: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: Alban Browaeys <prahal@yahoo.com>
---
  drivers/net/wireless/rt2x00/rt2800pci.c |   57 +++++++++++++-----------------
  1 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 0e4c417..841f973 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -907,14 +907,12 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  {
  	struct data_queue *queue;
  	struct queue_entry *entry;
-	struct queue_entry *entry_done;
-	struct queue_entry_priv_pci *entry_priv;
+	__le32 *txwi;
  	struct txdone_entry_desc txdesc;
  	u32 word;
  	u32 reg;
  	u32 old_reg;
-	unsigned int type;
-	unsigned int index;
+	int wcid, ack, pid, tx_wcid, tx_ack, tx_pid;
  	u16 mcs, real_mcs;
  
  	/*
@@ -936,47 +934,41 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  			break;
  		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
  		 * queue identication number.
  		 */
-		type = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE) - 1;
-		if (type >= QID_RX)
+		if (pid - 1 < 0 || pid - 1 >= QID_RX)
  			continue;
  
-		queue = rt2x00queue_get_queue(rt2x00dev, type);
+		queue = rt2x00queue_get_queue(rt2x00dev, pid - 1);
  		if (unlikely(!queue))
  			continue;
  
  		/*
-		 * Skip this entry when it contains an invalid
-		 * index number.
+		 * Inside each queue, we process each entry in a chronological
+		 * order. We first check that the queue is not empty.
  		 */
-		index = rt2x00_get_field32(reg, TX_STA_FIFO_WCID) - 1;
-		if (unlikely(index >= queue->limit))
+		if (queue->length == 0)
  			continue;
+		entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
  
-		entry = &queue->entries[index];
-		entry_priv = entry->priv_data;
-		rt2x00_desc_read((__le32 *)entry->skb->data, 0, &word);
-
-		entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
-		while (entry != entry_done) {
-			/*
-			 * Catch up.
-			 * Just report any entries we missed as failed.
-			 */
-			WARNING(rt2x00dev,
-				"TX status report missed for entry %d\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);
-		}
+		/* Check if we got a match by looking at WCID/ACK/PID
+		 * fields */
+		txwi = (__le32 *)(entry->skb->data -
+				  rt2x00dev->ops->extra_tx_headroom);
+
+		rt2x00_desc_read(txwi, 1, &word);
+		tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID);
+		tx_ack  = rt2x00_get_field32(word, TXWI_W1_ACK);
+		tx_pid  = rt2x00_get_field32(word, TXWI_W1_PACKETID);
+
+		if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid))
+			WARNING(rt2x00dev, "invalid TX_STA_FIFO content\n");
  
  		/*
  		 * Obtain the status about this packet.
@@ -997,6 +989,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  		 * we have mcs = tx_mcs - 1. So the number of
  		 * retry is (tx_mcs - mcs).
  		 */
+		rt2x00_desc_read(txwi, 0, &word);
  		mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
  		real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
  		__set_bit(TXDONE_FALLBACK, &txdesc.flags);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] rt2x00: txdone implementation supporting hw encryption.
  2010-02-26  1:06 [PATCH] rt2x00: txdone implementation supporting hw encryption Alban Browaeys
@ 2010-02-26 19:20 ` Gertjan van Wingerde
  2010-03-15 18:56 ` John W. Linville
  1 sibling, 0 replies; 7+ messages in thread
From: Gertjan van Wingerde @ 2010-02-26 19:20 UTC (permalink / raw)
  To: prahal
  Cc: John Linville, rt2x00 Users List, Ivo van Doorn, Pavel Roskin,
	linux-wireless

On 02/26/10 02:06, Alban Browaeys wrote:
> 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: Benoit Papillault <benoit.papillault@free.fr>
> Signed-off-by: Alban Browaeys <prahal@yahoo.com>
> ---

Thanks for bearing with us. I just have a few style issues that need to be resolved.

>  drivers/net/wireless/rt2x00/rt2800pci.c |   57
> +++++++++++++-----------------
>  1 files changed, 25 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c
> b/drivers/net/wireless/rt2x00/rt2800pci.c
> index 0e4c417..841f973 100644
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -907,14 +907,12 @@ static void rt2800pci_txdone(struct rt2x00_dev
> *rt2x00dev)
>  {
>      struct data_queue *queue;
>      struct queue_entry *entry;
> -    struct queue_entry *entry_done;
> -    struct queue_entry_priv_pci *entry_priv;
> +    __le32 *txwi;
>      struct txdone_entry_desc txdesc;
>      u32 word;
>      u32 reg;
>      u32 old_reg;
> -    unsigned int type;
> -    unsigned int index;
> +    int wcid, ack, pid, tx_wcid, tx_ack, tx_pid;
>      u16 mcs, real_mcs;
>  
>      /*
> @@ -936,47 +934,41 @@ static void rt2800pci_txdone(struct rt2x00_dev
> *rt2x00dev)
>              break;
>          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
>           * queue identication number.
>           */
> -        type = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE) - 1;
> -        if (type >= QID_RX)
> +        if (pid - 1 < 0 || pid - 1 >= QID_RX)
>              continue;
>  

How about using:
	if (pid <= 0 || pid > QID_RX)

That's a lot more readable than the current expression.


> -        queue = rt2x00queue_get_queue(rt2x00dev, type);
> +        queue = rt2x00queue_get_queue(rt2x00dev, pid - 1);
>          if (unlikely(!queue))
>              continue;
>  
>          /*
> -         * Skip this entry when it contains an invalid
> -         * index number.
> +         * Inside each queue, we process each entry in a chronological
> +         * order. We first check that the queue is not empty.
>           */
> -        index = rt2x00_get_field32(reg, TX_STA_FIFO_WCID) - 1;
> -        if (unlikely(index >= queue->limit))
> +        if (queue->length == 0)
>              continue;

Please use the rt2x00queue_empty utility function here. It's there exactly for this purpose.

> +        entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
>  
> -        entry = &queue->entries[index];
> -        entry_priv = entry->priv_data;
> -        rt2x00_desc_read((__le32 *)entry->skb->data, 0, &word);
> -
> -        entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
> -        while (entry != entry_done) {
> -            /*
> -             * Catch up.
> -             * Just report any entries we missed as failed.
> -             */
> -            WARNING(rt2x00dev,
> -                "TX status report missed for entry %d\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);
> -        }
> +        /* Check if we got a match by looking at WCID/ACK/PID
> +         * fields */
> +        txwi = (__le32 *)(entry->skb->data -
> +                  rt2x00dev->ops->extra_tx_headroom);
> +
> +        rt2x00_desc_read(txwi, 1, &word);
> +        tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID);
> +        tx_ack  = rt2x00_get_field32(word, TXWI_W1_ACK);
> +        tx_pid  = rt2x00_get_field32(word, TXWI_W1_PACKETID);
> +
> +        if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid))
> +            WARNING(rt2x00dev, "invalid TX_STA_FIFO content\n");
>  
>          /*
>           * Obtain the status about this packet.
> @@ -997,6 +989,7 @@ static void rt2800pci_txdone(struct rt2x00_dev
> *rt2x00dev)
>           * we have mcs = tx_mcs - 1. So the number of
>           * retry is (tx_mcs - mcs).
>           */
> +        rt2x00_desc_read(txwi, 0, &word);
>          mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
>          real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
>          __set_bit(TXDONE_FALLBACK, &txdesc.flags);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] rt2x00: txdone implementation supporting hw encryption.
@ 2010-02-26 22:19 Alban Browaeys
  2010-02-26 22:51 ` Gertjan van Wingerde
  2010-03-01  7:34 ` Ivo van Doorn
  0 siblings, 2 replies; 7+ messages in thread
From: Alban Browaeys @ 2010-02-26 22:19 UTC (permalink / raw)
  To: John Linville
  Cc: rt2x00 Users List, Gertjan van Wingerde, Ivo van Doorn,
	Pavel Roskin, linux-wireless

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: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: Alban Browaeys <prahal@yahoo.com>
---
  drivers/net/wireless/rt2x00/rt2800pci.c |   57 +++++++++++++-----------------
  1 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 0e4c417..7049c74 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -907,14 +907,12 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  {
  	struct data_queue *queue;
  	struct queue_entry *entry;
-	struct queue_entry *entry_done;
-	struct queue_entry_priv_pci *entry_priv;
+	__le32 *txwi;
  	struct txdone_entry_desc txdesc;
  	u32 word;
  	u32 reg;
  	u32 old_reg;
-	unsigned int type;
-	unsigned int index;
+	int wcid, ack, pid, tx_wcid, tx_ack, tx_pid;
  	u16 mcs, real_mcs;
  
  	/*
@@ -936,47 +934,41 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  			break;
  		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
  		 * queue identication number.
  		 */
-		type = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE) - 1;
-		if (type >= QID_RX)
+		if (pid <= 0 || pid > QID_RX)
  			continue;
  
-		queue = rt2x00queue_get_queue(rt2x00dev, type);
+		queue = rt2x00queue_get_queue(rt2x00dev, pid - 1);
  		if (unlikely(!queue))
  			continue;
  
  		/*
-		 * Skip this entry when it contains an invalid
-		 * index number.
+		 * Inside each queue, we process each entry in a chronological
+		 * order. We first check that the queue is not empty.
  		 */
-		index = rt2x00_get_field32(reg, TX_STA_FIFO_WCID) - 1;
-		if (unlikely(index >= queue->limit))
+		if (rt2x00queue_empty(queue))
  			continue;
+		entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
  
-		entry = &queue->entries[index];
-		entry_priv = entry->priv_data;
-		rt2x00_desc_read((__le32 *)entry->skb->data, 0, &word);
-
-		entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
-		while (entry != entry_done) {
-			/*
-			 * Catch up.
-			 * Just report any entries we missed as failed.
-			 */
-			WARNING(rt2x00dev,
-				"TX status report missed for entry %d\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);
-		}
+		/* Check if we got a match by looking at WCID/ACK/PID
+		 * fields */
+		txwi = (__le32 *)(entry->skb->data -
+				  rt2x00dev->ops->extra_tx_headroom);
+
+		rt2x00_desc_read(txwi, 1, &word);
+		tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID);
+		tx_ack  = rt2x00_get_field32(word, TXWI_W1_ACK);
+		tx_pid  = rt2x00_get_field32(word, TXWI_W1_PACKETID);
+
+		if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid))
+			WARNING(rt2x00dev, "invalid TX_STA_FIFO content\n");
  
  		/*
  		 * Obtain the status about this packet.
@@ -997,6 +989,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
  		 * we have mcs = tx_mcs - 1. So the number of
  		 * retry is (tx_mcs - mcs).
  		 */
+		rt2x00_desc_read(txwi, 0, &word);
  		mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
  		real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS);
  		__set_bit(TXDONE_FALLBACK, &txdesc.flags);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] rt2x00: txdone implementation supporting hw encryption.
  2010-02-26 22:19 Alban Browaeys
@ 2010-02-26 22:51 ` Gertjan van Wingerde
  2010-03-01  7:34 ` Ivo van Doorn
  1 sibling, 0 replies; 7+ messages in thread
From: Gertjan van Wingerde @ 2010-02-26 22:51 UTC (permalink / raw)
  To: prahal
  Cc: John Linville, rt2x00 Users List, Ivo van Doorn, Pavel Roskin,
	linux-wireless

On 02/26/10 23:19, Alban Browaeys wrote:
> 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: Benoit Papillault <benoit.papillault@free.fr>
> Signed-off-by: Alban Browaeys <prahal@yahoo.com>
> ---

Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rt2x00: txdone implementation supporting hw encryption.
  2010-02-26 22:19 Alban Browaeys
  2010-02-26 22:51 ` Gertjan van Wingerde
@ 2010-03-01  7:34 ` Ivo van Doorn
  1 sibling, 0 replies; 7+ messages in thread
From: Ivo van Doorn @ 2010-03-01  7:34 UTC (permalink / raw)
  To: prahal
  Cc: John Linville, rt2x00 Users List, Gertjan van Wingerde,
	Pavel Roskin, linux-wireless

On Friday 26 February 2010, Alban Browaeys wrote:
> 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: Benoit Papillault <benoit.papillault@free.fr>
> Signed-off-by: Alban Browaeys <prahal@yahoo.com>

Acked-by: Ivo van Doorn <IvDoorn@gmail.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rt2x00: txdone implementation supporting hw encryption.
  2010-02-26  1:06 [PATCH] rt2x00: txdone implementation supporting hw encryption Alban Browaeys
  2010-02-26 19:20 ` Gertjan van Wingerde
@ 2010-03-15 18:56 ` John W. Linville
  2010-03-15 19:22   ` Gertjan van Wingerde
  1 sibling, 1 reply; 7+ messages in thread
From: John W. Linville @ 2010-03-15 18:56 UTC (permalink / raw)
  To: Alban Browaeys
  Cc: Gertjan van Wingerde, rt2x00 Users List, Ivo van Doorn,
	Pavel Roskin, linux-wireless

On Fri, Feb 26, 2010 at 02:06:46AM +0100, Alban Browaeys wrote:
> 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: Benoit Papillault <benoit.papillault@free.fr>
> Signed-off-by: Alban Browaeys <prahal@yahoo.com>

/home/linville/git/wireless-testing
[linville-t400.local]:> patch -p1 < rt2x00.patch
patching file drivers/net/wireless/rt2x00/rt2800pci.c
Hunk #1 FAILED at 907.
Hunk #2 FAILED at 936.
Hunk #3 FAILED at 997.
3 out of 3 hunks FAILED -- saving rejects to file drivers/net/wireless/rt2x00/rt2800pci.c.rej

Would you care to post a version that applies against the current
wireless-testing?

Thanks!

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rt2x00: txdone implementation supporting hw encryption.
  2010-03-15 18:56 ` John W. Linville
@ 2010-03-15 19:22   ` Gertjan van Wingerde
  0 siblings, 0 replies; 7+ messages in thread
From: Gertjan van Wingerde @ 2010-03-15 19:22 UTC (permalink / raw)
  To: John W. Linville
  Cc: Alban Browaeys, rt2x00 Users List, Ivo van Doorn, Pavel Roskin,
	linux-wireless

On 03/15/10 19:56, John W. Linville wrote:
> On Fri, Feb 26, 2010 at 02:06:46AM +0100, Alban Browaeys wrote:
>> 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: Benoit Papillault <benoit.papillault@free.fr>
>> Signed-off-by: Alban Browaeys <prahal@yahoo.com>
> 
> /home/linville/git/wireless-testing
> [linville-t400.local]:> patch -p1 < rt2x00.patch
> patching file drivers/net/wireless/rt2x00/rt2800pci.c
> Hunk #1 FAILED at 907.
> Hunk #2 FAILED at 936.
> Hunk #3 FAILED at 997.
> 3 out of 3 hunks FAILED -- saving rejects to file drivers/net/wireless/rt2x00/rt2800pci.c.rej
> 
> Would you care to post a version that applies against the current
> wireless-testing?
> 

John,

If you want, you can also pull from:

git://git.gwingerde.nl/rt2x00-next-2.6.git

This contains all rt2x00 patches sent to the list (and you) that were acked by either Ivo or myself, or both.
This tree is against wireless-next-2.6, but should do the trick, I guess.

---
Gertjan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-03-15 19:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-26  1:06 [PATCH] rt2x00: txdone implementation supporting hw encryption Alban Browaeys
2010-02-26 19:20 ` Gertjan van Wingerde
2010-03-15 18:56 ` John W. Linville
2010-03-15 19:22   ` Gertjan van Wingerde
  -- strict thread matches above, loose matches on Subject: below --
2010-02-26 22:19 Alban Browaeys
2010-02-26 22:51 ` Gertjan van Wingerde
2010-03-01  7:34 ` Ivo van Doorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).