[PATCH] zd1211rw: Optimized handling of zero length entries in length info
authorUlrich Kunitz <kune@deine-taler.de>
Wed, 22 Nov 2006 00:06:19 +0000 (00:06 +0000)
committerJeff Garzik <jeff@garzik.org>
Sat, 2 Dec 2006 05:12:05 +0000 (00:12 -0500)
There are a high number of split USB transactions, which contain
only one packet but have a length info field. This patch optimizes
this code by stopping parsing the length info structure if a zero
length field is encountered.

Signed-off-by: Ulrich Kunitz <kune@deine-taler.de>
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/zd1211rw/zd_usb.c

index c3449cfae7e8f6b9d28b3eb247cfbb9105645cb1..aa782e88754b3d777722eb3e41fd66c7ee669291 100644 (file)
@@ -593,6 +593,8 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
                unsigned int l, k, n;
                for (i = 0, l = 0;; i++) {
                        k = le16_to_cpu(get_unaligned(&length_info->length[i]));
+                       if (k == 0)
+                               return;
                        n = l+k;
                        if (n > length)
                                return;