[Click] problem compiling linux kernel driver, plus a code submission
todd lewis
tgl2 at yahoo.com
Sun Jun 18 20:47:03 EDT 2006
And of course, when it's not 4AM, the problem is staring me right in the face. Re-commenting out
HAVE_CLICK_KERNEL_TX_NOTIFY in include/click/config-linuxmodule.h worked perfectly.
May I suggest that all references to HAVE_CLICK_KERNEL_TX_NOTIFY be removed? They probably never
worked. Not a big deal, unless you're blindly whacking your header files like a big dummy. 8^)
--- todd lewis <tgl2 at yahoo.com> wrote:
> I come bearing code! (Patch at the end of this message.)
>
> I have a problem compiling the click.o kernel module for linux:
>
>
********************************************************************************************************
> ../elements/linuxmodule/todevice.cc: In function `static void ToDevice::static_cleanup()':
> ../elements/linuxmodule/todevice.cc:75: implicit declaration of function `int
> unregister_net_tx(...)'
> ../elements/linuxmodule/todevice.cc: In method `int ToDevice::initialize(ErrorHandler *)':
> ../elements/linuxmodule/todevice.cc:157: implicit declaration of function `int
> register_net_tx(...)'
>
********************************************************************************************************
>
> The kernel, the modified e1000 driver, the click kernel patch, nothing has these functions.
> Heck,
> the only google mention is one cvsweb version of the file in question, todevice.cc. Here is the
> annotated code:
>
>
********************************************************************************************************
> 1.137 (eddietwo 03-Jul-04): void
> 1.137 (eddietwo 03-Jul-04): ToDevice::static_cleanup()
> 1.109 (eddietwo 21-Jun-01): {
> 1.137 (eddietwo 03-Jul-04): unregister_netdevice_notifier(&device_notifier);
> 1.141 (jbicket 03-Jun-05): #ifdef HAVE_CLICK_KERNEL_TX_NOTIFY
> 1.141 (jbicket 03-Jun-05): if (registered_tx_notifiers) {
> 1.141 (jbicket 03-Jun-05): unregister_net_tx(&tx_notifier);
> 1.141 (jbicket 03-Jun-05): }
> 1.141 (jbicket 03-Jun-05): #endif
> 1.141 (jbicket 03-Jun-05): }
>
********************************************************************************************************
>
> This adds yet another mystery: it's been in there for a year? Obviously, I am missing
> something.
>
> After the reported click/driver problems with 2.6, I switched to linux 2.4.32. It has the click
> patch and the click e1000-5 driver. I'm using g++-2.95. I configured click thusly:
>
> ./configure --enable-all-elements --enable-analysis --enable-grid --enable-ip6
> --prefix=/usr/local/click/ --enable-polling --enable-intel-cpu --enable-warp9
> --with-linux-map=/usr/src/2.4.clean/linux-2.4.32/System.map
>
> Having repeatedly struggled with these messages:
>
>
********************************************************************************************************
> config:52: While initializing 'todevice0 :: ToDevice':
> warning: not compiled for a Click kernel
> config:51: While initializing 'PollDevice at 6 :: PollDevice':
> warning: can't get packets: not compiled with polling extensions
>
********************************************************************************************************
>
> I made these changes to include/click/config-linuxmodule.h
>
>
********************************************************************************************************
> /* Define if your Linux kernel has Click extensions. */
> -/* #undef HAVE_CLICK_KERNEL */
> +#define HAVE_CLICK_KERNEL 1
>
> /* Define if your Linux kernel has Click transmit notification extensions. */
> -/* #undef HAVE_CLICK_KERNEL_TX_NOTIFY */
> +#define HAVE_CLICK_KERNEL_TX_NOTIFY 1
>
> /* Define if fast checksum functions available. */
> #define HAVE_FAST_CHECKSUM 1
> @@ -34,7 +34,7 @@
> /* #undef HAVE_KERNEL_ASSERT */
>
> /* Define if your Linux kernel has polling extensions. */
> -/* #undef HAVE_LINUX_POLLING */
> +#define HAVE_LINUX_POLLING 1
>
********************************************************************************************************
>
> It probably is something obvious and silly, but I'm a newbie, so please don't be too hard on me.
>
> And now the code. I've modified make-ip-conf.pl to pull the interface information and static
> routes from the operating system, rather than having to be set manually in the script. Attached
> is the diff, submitted for inclusion by someone with cvs access. If anyone has any change
> requests, then please send them my way.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com > --- ../make-ip-conf.pl 2003-06-23 23:02:48.000000000 -0400
> +++ make-ip-conf.pl 2006-06-18 01:56:23.000000000 -0400
> @@ -33,18 +33,51 @@
> # The netmask on that interface; and
> # The router's Ethernet address on that interface.
> # This setup for blackisle -> plebic -> darkstar.
> -my $ifs = [ [ "eth0", 1, "18.26.4.92", "255.255.255.0", "00:00:C0:3B:71:EF" ],
> - [ "eth1", 1, "1.0.0.1", "255.0.0.0", "00:00:C0:CA:68:EF" ],
> -# [ "eth2", 1, "2.0.0.1", "255.0.0.0", "00:00:C0:8A:67:EF" ],
> - ];
>
> -# This used for testing purposes at MIT.
> -if ($#ARGV >= 0) {
> +my $use_oldmode = 0;
> +
> +if ($use_oldmode){
> + my $ifs = [ [ "eth0", 1, "18.26.4.92", "255.255.255.0", "00:00:C0:3B:71:EF" ],
> + [ "eth1", 1, "1.0.0.1", "255.0.0.0", "00:00:C0:CA:68:EF" ],
> + # [ "eth2", 1, "2.0.0.1", "255.0.0.0", "00:00:C0:8A:67:EF" ],
> + ];
> +
> +} elsif ($#ARGV >= 0) { # This used for testing purposes at MIT.
> $ifs = [];
> for ($i = 0; $i < $ARGV[0]; $i++) {
> push @$ifs, [ "eth" . $i, 1, "1.0.0.2", "255.0.0.0", "00:00:c0:8a:67:ef" ];
> }
> +
> +} else {
> + $ifs = [];
> + open(IFCONFIG, "ifconfig -a |") or die "ifconfig open";
> + my ($mode, $dev, $hwaddr, $iaddr, $mask) = (0,0,0,0,0);
> + while(<IFCONFIG>){
> + # eth0 Link encap:Ethernet HWaddr 00:07:E9:02:02:95
> + # inet addr:192.168.75.6 Bcast:192.168.75.255 Mask:255.255.255.0
> + if(/addr/){
> + chomp;
> + my @A=split;
> + if(/^([a-z][a-z0-9]*)\s*Link.*HWaddr\s*([0-9a-fA-F:]*)/){
> + if ($mode != 0){ print(STDERR "AIEE! Invalid ifconfig output(0: $_); aborting.\n");
> exit(-1); }
> + $dev = $1;
> + $hwaddr = $2;
> + $mode = 1;
> + } elsif(/inet addr:([0-9\.]*).*Mask:([0-9\.]*)/) {
> + if ($mode != 1){ print(STDERR "AIEE! Invalid ifconfig output(1: $_); aborting.\n");
> exit(-1); }
> + $iaddr = $1;
> + $mask = $2;
> + print "// Adding interface: [$dev, 1, $iaddr, $mask, $hwaddr]\n";
> + push @$ifs, [$dev, 1, $iaddr, $mask, $hwaddr];
> + $mode = 0;
> + } else {
> + # print "# Skipping line: '$_'\n";
> + }
> + }
> + }
> + close(IFCONFIG) or die "ifconfig close";
> }
> +print "//\n\n";
>
> # Static routes to hosts/networks beyond adjacent networks specified in $ifs.
> # One line per route, containing:
> @@ -53,8 +86,31 @@
> # The gateway IP address (next hop);
> # The output network interface name.
> # A default route (mask 0.0.0.0) can be specified as the last entry.
> -my $srts = [ [ "0.0.0.0", "0.0.0.0", "18.26.4.1", "eth0" ]
> - ];
> +
> +if($use_oldmode){
> + $srts = [ [ "0.0.0.0", "0.0.0.0", "18.26.4.1", "eth0" ]
> + ];
> +} else {
> + $srts = [ ];
> + open(NETSTAT, "netstat -rn |") or die "netstat open";
> + while(<NETSTAT>){
> + # # netstat -rn
> + # Kernel IP routing table
> + # Destination Gateway Genmask Flags MSS Window irtt Iface
> + # 192.168.0.0 192.168.75.5 255.255.255.0 UG 0 0 0 eth0
> + # 192.168.77.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
> + # 192.168.76.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
> + # 192.168.75.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
> + if(/^[0-9]/){
> + chomp;
> + my @A=split;
> + print "// Adding route: $A[0], $A[2], $A[1], $A[7]\n";
> + push(@$srts, [$A[0], $A[2], $A[1], $A[7]]);
> + }
> + }
> + close(NETSTAT) or die "netstat close";
> +}
> +print "//\n\n";
>
> # Set to, e.g., "Print(toh) -> Discard" for user-level.
> my $local_host = "ToHost";
> > _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the click
mailing list