diff mbox

[2/2] rt2800: nulify all last words of TXWI

Message ID 1366201848-18009-3-git-send-email-stf_xl@wp.pl (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stanislaw Gruszka April 17, 2013, 12:30 p.m. UTC
From: Stanislaw Gruszka <stf_xl@wp.pl>

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Comments

Gertjan van Wingerde April 19, 2013, 9:49 a.m. UTC | #1
Hi Stanislaw,

On Wed, Apr 17, 2013 at 2:30 PM,  <stf_xl@wp.pl> wrote:
> From: Stanislaw Gruszka <stf_xl@wp.pl>
>
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
>  drivers/net/wireless/rt2x00/rt2800lib.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 5c20e98..35f58bb 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -542,6 +542,7 @@ void rt2800_write_tx_data(struct queue_entry *entry,
>  {
>         __le32 *txwi = rt2800_drv_get_txwi(entry);
>         u32 word;
> +       int i;
>
>         /*
>          * Initialize TX Info descriptor
> @@ -584,14 +585,16 @@ void rt2800_write_tx_data(struct queue_entry *entry,
>         rt2x00_desc_write(txwi, 1, word);
>
>         /*
> -        * Always write 0 to IV/EIV fields, hardware will insert the IV
> -        * from the IVEIV register when TXD_W3_WIV is set to 0.
> +        * Always write 0 to IV/EIV fields (word 2 and 3), hardware will insert
> +        * the IV from the IVEIV register when TXD_W3_WIV is set to 0.
>          * When TXD_W3_WIV is set to 1 it will use the IV data
>          * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
>          * crypto entry in the registers should be used to encrypt the frame.
> +        *
> +        * Nulify all remaining words as well, we don't know how to program them.
>          */
> -       _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
> -       _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
> +       for (i = 2; i < entry->queue->winfo_size / sizeof(__le32); i++)
> +               _rt2x00_desc_write(txwi, i, 0);
>  }
>  EXPORT_SYMBOL_GPL(rt2800_write_tx_data);
>

Wouldn't it be easier / better to simply clear the whole descriptor at
the start, instead of selective clearing parts of it after everything
has been written already?

---
Gertjan
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Helmut Schaa April 19, 2013, 11:13 a.m. UTC | #2
Hi Gertjan,

On Fri, Apr 19, 2013 at 11:49 AM, Gertjan van Wingerde
<gwingerde@gmail.com> wrote:
> Wouldn't it be easier / better to simply clear the whole descriptor at
> the start, instead of selective clearing parts of it after everything
> has been written already?

This would add a number of unneeded writes to DMA coherent memory.
And since the descriptor is initialized word by word Stanislaw's approach
looks reasonable to me.

Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 5c20e98..35f58bb 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -542,6 +542,7 @@  void rt2800_write_tx_data(struct queue_entry *entry,
 {
 	__le32 *txwi = rt2800_drv_get_txwi(entry);
 	u32 word;
+	int i;
 
 	/*
 	 * Initialize TX Info descriptor
@@ -584,14 +585,16 @@  void rt2800_write_tx_data(struct queue_entry *entry,
 	rt2x00_desc_write(txwi, 1, word);
 
 	/*
-	 * Always write 0 to IV/EIV fields, hardware will insert the IV
-	 * from the IVEIV register when TXD_W3_WIV is set to 0.
+	 * Always write 0 to IV/EIV fields (word 2 and 3), hardware will insert
+	 * the IV from the IVEIV register when TXD_W3_WIV is set to 0.
 	 * When TXD_W3_WIV is set to 1 it will use the IV data
 	 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which
 	 * crypto entry in the registers should be used to encrypt the frame.
+	 *
+	 * Nulify all remaining words as well, we don't know how to program them.
 	 */
-	_rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */);
-	_rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */);
+	for (i = 2; i < entry->queue->winfo_size / sizeof(__le32); i++)
+		_rt2x00_desc_write(txwi, i, 0);
 }
 EXPORT_SYMBOL_GPL(rt2800_write_tx_data);