ipwireless: Preallocate received packet buffers with MRU size
authorDavid Sterba <dsterba@suse.cz>
Mon, 28 Jul 2008 14:53:32 +0000 (16:53 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Jul 2008 15:28:03 +0000 (08:28 -0700)
ipwireless: Preallocate received packet buffers with MRU size

Packets are assembled from link size (~300 bytes) up to PPP MRU
(1500 by default). Try to preallocate full size rather than
repeatedly advance buffer size by 256 bytes.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/pcmcia/ipwireless/hardware.c
drivers/char/pcmcia/ipwireless/network.c
drivers/char/pcmcia/ipwireless/network.h

index d1e69de19156d840d4068cc9c1aa4883ed70eb17..7d500f82195a08b22d1ab550ab95bb43e541dd7a 100644 (file)
@@ -567,7 +567,8 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
                        spin_unlock_irqrestore(&hw->lock, flags);
                        list_del(&packet->queue);
                } else {
-                       static int min_capacity = 256;
+                       const int min_capacity =
+                               ipwireless_ppp_mru(hw->network + 2);
                        int new_capacity;
 
                        spin_unlock_irqrestore(&hw->lock, flags);
index 2b07af05106d1a39cb9821d240fa155189f25b76..590762a7f21790d64ea2b65725ff2a88902b1946 100644 (file)
@@ -499,3 +499,8 @@ int ipwireless_ppp_unit_number(struct ipw_network *network)
 
        return ret;
 }
+
+int ipwireless_ppp_mru(const struct ipw_network *network)
+{
+       return network->mru;
+}
index ccacd26fc7efdf3c9836e80aa3a536190359a809..561f765b333419fa1aa4a48095efe734b89efd8e 100644 (file)
@@ -48,5 +48,6 @@ void ipwireless_ppp_open(struct ipw_network *net);
 void ipwireless_ppp_close(struct ipw_network *net);
 int ipwireless_ppp_channel_index(struct ipw_network *net);
 int ipwireless_ppp_unit_number(struct ipw_network *net);
+int ipwireless_ppp_mru(const struct ipw_network *net);
 
 #endif