Send users mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        
http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com

or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of users digest..."


Today's Topics:

   1. [PATCH] rt2x00usb: Zero USB padding before sending        URB
      (Jakub Kici?ski)
   2. [PATCH] rt2800usb: Let rt2x00usb handle USB padding
      (Jakub Kici?ski)
   3. Rework USB padding handling in rt2800usb (Jakub Kici?ski)


----------------------------------------------------------------------

Message: 1
Date: Wed, 21 Dec 2011 12:31:49 +0100
From: Jakub Kici?ski <[email protected]>
To: Ivo van Doorn <[email protected]>, Helmut Schaa
        <[email protected]>, Gertjan van Wingerde
        <[email protected]>
Cc: [email protected]
Subject: [rt2x00-users] [PATCH] rt2x00usb: Zero USB padding before
        sending URB
Message-ID: <20111221123149.2fd59e2a@north>
Content-Type: text/plain; charset=US-ASCII

When USB driver requires padding at the end of frame or URB it will report
this need by increasing return value of get_tx_data_len callback. Common
USB code uses that return value as desired URB length.

Ensure that appropriate part of skb's tailroom exists and is zeroed.


Signed-off-by: Jakub Kicinski <[email protected]>
--
 drivers/net/wireless/rt2x00/rt2x00usb.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c 
b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1e31050..2eea386 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -298,12 +298,22 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry 
*entry, void* data)
                return false;
 
        /*
-        * USB devices cannot blindly pass the skb->len as the
-        * length of the data to usb_fill_bulk_urb. Pass the skb
-        * to the driver to determine what the length should be.
+        * USB devices require certain padding at the end of each frame
+        * and urb. Those paddings are not included in skbs. Pass entry
+        * to the driver to determine what the overall length should be.
         */
        length = rt2x00dev->ops->lib->get_tx_data_len(entry);
 
+       status = skb_padto(entry->skb, length);
+       if (unlikely(status)) {
+               /* TODO: report something more appropriate than IO_FAILED. */
+               WARNING(rt2x00dev, "TX SKB padding error, out of memory\n");
+               set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
+               rt2x00lib_dmadone(entry);
+
+               return false;
+       }
+
        usb_fill_bulk_urb(entry_priv->urb, usb_dev,
                          usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
                          entry->skb->data, length,



------------------------------

Message: 2
Date: Wed, 21 Dec 2011 12:31:49 +0100
From: Jakub Kici?ski <[email protected]>
To: Ivo van Doorn <[email protected]>, Helmut Schaa
        <[email protected]>, Gertjan van Wingerde
        <[email protected]>
Cc: [email protected]
Subject: [rt2x00-users] [PATCH] rt2800usb: Let rt2x00usb handle USB
        padding
Message-ID: <20111221123149.03a666ff@north>
Content-Type: text/plain; charset=US-ASCII

Older USB drivers does not append end padding to skb but instead report
it in size of data to be transmitted to HW. rt2800usb should follow that 
behaviour. Custom write_tx_data callback which was adding pad to skb
is not be needed any more.

Thanks to this patch frames handed back from rt2800usb to mac80211 will
no longer contain end padding.


Signed-off-by: Jakub Kicinski <[email protected]>
---
 drivers/net/wireless/rt2x00/rt2800usb.c |   37 ++++++++----------------------
 1 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c 
b/drivers/net/wireless/rt2x00/rt2800usb.c
index 3778763..3c4b88c 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -400,10 +400,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry 
*entry,
        /*
         * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is
         * TXWI + 802.11 header + L2 pad + payload + pad,
-        * so need to decrease size of TXINFO and USB end pad.
+        * so need to decrease size of TXINFO.
         */
        rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN,
-                          entry->skb->len - TXINFO_DESC_SIZE - 4);
+                          roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE);
        rt2x00_set_field32(&word, TXINFO_W0_WIV,
                           !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
        rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);
@@ -421,37 +421,20 @@ static void rt2800usb_write_tx_desc(struct queue_entry 
*entry,
        skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
 }
 
-static void rt2800usb_write_tx_data(struct queue_entry *entry,
-                                       struct txentry_desc *txdesc)
+/*
+ * TX data initialization
+ */
+static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
 {
-       unsigned int len;
-       int err;
-
-       rt2800_write_tx_data(entry, txdesc);
-
        /*
-        * pad(1~3 bytes) is added after each 802.11 payload.
-        * USB end pad(4 bytes) is added at each USB bulk out packet end.
+        * pad(1~3 bytes) is needed after each 802.11 payload.
+        * USB end pad(4 bytes) is needed at each USB bulk out packet end.
         * TX frame format is :
         * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end 
pad |
         *                 |<------------- tx_pkt_len ------------->|
         */
-       len = roundup(entry->skb->len, 4) + 4;
-       err = skb_padto(entry->skb, len);
-       if (unlikely(err)) {
-               WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of 
memory\n");
-               return;
-       }
 
-       entry->skb->len = len;
-}
-
-/*
- * TX data initialization
- */
-static int rt2800usb_get_tx_data_len(struct queue_entry *entry)
-{
-       return entry->skb->len;
+       return roundup(entry->skb->len, 4) + 4;
 }
 
 /*
@@ -807,7 +790,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
        .flush_queue            = rt2x00usb_flush_queue,
        .tx_dma_done            = rt2800usb_tx_dma_done,
        .write_tx_desc          = rt2800usb_write_tx_desc,
-       .write_tx_data          = rt2800usb_write_tx_data,
+       .write_tx_data          = rt2800_write_tx_data,
        .write_beacon           = rt2800_write_beacon,
        .clear_beacon           = rt2800_clear_beacon,
        .get_tx_data_len        = rt2800usb_get_tx_data_len,



------------------------------

Message: 3
Date: Wed, 21 Dec 2011 12:31:50 +0100
From: Jakub Kici?ski <[email protected]>
To: Ivo van Doorn <[email protected]>, Helmut Schaa
        <[email protected]>, Gertjan van Wingerde
        <[email protected]>
Cc: [email protected]
Subject: [rt2x00-users] Rework USB padding handling in rt2800usb
Message-ID: <20111221121123.67385601@north>
Content-Type: text/plain; charset=US-ASCII

Hi!

As Ivo suggested USB padding should be handled by common code so I
modified rt2800usb not to add the padding on its own and slightly
changed rt2x00usb code to ensure padding is always zeroed.

My previous posting of this patch was a little messy, sorry for that.
I post it again divided in two "logical changes" and with better
descriptions. Hopefully this time it will raise some comments.

  -- Kuba



------------------------------

_______________________________________________
users mailing list
[email protected]
http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com


End of users Digest, Vol 34, Issue 9
************************************

Reply via email to