lkml.org 
[lkml]   [1998]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: support for firmwares sizes up to 128000 bytes
Hi,

Please take a look at this patch to support firmwares sizes up to
128000 bytes in the wanrouter. This is needed for a sync card that we're
developing a wanrouter driver.

This one patches wanmain.c to use vmalloc/vfree for the data
(firmware), as suggested by Alan Cox. Please take a look to see if it is
correct now, as I have tested it with our devel driver and I got an oops,
but it seems to be related to our driver, which is in very early devel
stage.

Seems like it's much better now, as I was getting a reboot when I was
using kmalloc instead of vmalloc.

I also took a look at the sdla (sangoma) drivers and, as Alan pointed
out it doesn't uses DMA to load the firmware (as far as my knowledge
permits :) )

----------------------------------- 8< ===================================
diff -uNr linux-2.1.132pre4.orig/CREDITS linux-2.1.132pre4/CREDITS
--- linux-2.1.132pre4.orig/CREDITS Tue Dec 22 15:36:42 1998
+++ linux-2.1.132pre4/CREDITS Tue Dec 22 16:19:13 1998
@@ -1271,6 +1271,14 @@
S: D-90453 Nuernberg
S: Germany

+N: Arnaldo Carvalho de Melo
+E: acme@conectiva.com.br
+D: wanrouter hacking
+D: cyclades 2X sync card driver (still in early devel stage)
+S: R. Prof. Rubens Elke Braga, 558 - Parolin
+S: 80220-320 Curitiba - Parana
+S: Brazil
+
N: Michael Meskes
E: meskes@debian.org
P: 1024/04B6E8F5 6C 77 33 CA CC D6 22 03 AB AB 15 A3 AE AD 39 7D
diff -uNr linux-2.1.132pre4.orig/net/wanrouter/wanmain.c linux-2.1.132pre4/net/wanrouter/wanmain.c
--- linux-2.1.132pre4.orig/net/wanrouter/wanmain.c Tue Dec 22 15:36:54 1998
+++ linux-2.1.132pre4/net/wanrouter/wanmain.c Tue Dec 22 16:36:08 1998
@@ -25,6 +25,11 @@
* Oct 15, 1997 Farhan Thawar changed wan_encapsulate to add a pad byte of 0
* Apr 20, 1998 Alan Cox Fixed 2.1 symbols
* May 17, 1998 K. Baranowski Fixed SNAP encapsulation in wan_encapsulate
+* Dec 15, 1998 Arnaldo Melo support for firmwares of up to 128000 bytes
+* check wandev->setup return value
+* Dec 22, 1998 Arnaldo Melo vmalloc/vfree used in device_setup to allocate
+* kernel memory and copy configuration data to
+* kernel space (for big firmwares)
*****************************************************************************/

#include <linux/stddef.h> /* offsetof(), etc. */
@@ -32,6 +37,7 @@
#include <linux/kernel.h>
#include <linux/module.h> /* support for loadable modules */
#include <linux/malloc.h> /* kmalloc(), kfree() */
+#include <linux/vmalloc.h> /* vmalloc(), vfree() */
#include <linux/mm.h> /* verify_area(), etc. */
#include <linux/string.h> /* inline mem*, str* functions */
#include <asm/segment.h> /* kernel <-> user copy */
@@ -459,23 +465,22 @@

if (conf->data_size && conf->data)
{
- if(conf->data_size > 64000 || conf->data_size < 0){
+ if(conf->data_size > 128000 || conf->data_size < 0){
goto bail;
}
- data = kmalloc(conf->data_size, GFP_KERNEL);
+ data = vmalloc(conf->data_size);
if (data)
{
if(!copy_from_user(data, conf->data, conf->data_size))
{
conf->data=data;
- wandev->setup(wandev,conf);
- err = 0;
+ err = wandev->setup(wandev,conf);
}
else
err = -ENOBUFS;
+
+ vfree(data);
}
- if (data)
- kfree(data);
}
bail:
kfree(conf);
----------------------------------- 8< ===================================
- Arnaldo

"These are questions for action,
not speculation, which is idle." - Noam Chomsky


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.716 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site