BIGPHYSAREA Gigabit Driver S. Durkin My gigabit driver is based on the fact that all incoming packets in any ethernet driver are passed to the kernel through a single routine netif_rx. I hijack this routine. As one can see in the routine /bigphysarea_xxxx/d550/dl2x.c the added code is: // durkin hook kludge extern int netif_rx_hook_2(struct sk_buff *skb); extern int netif_rx_hook_3(struct sk_buff *skb); // durkin hook kludge // netif_rx(skb); if(strcmp(dev->name,"eth2")==0)netif_rx_hook_2(skb); /* send it up */ if(strcmp(dev->name,"eth3")==0)netif_rx_hook_3(skb); /* send it up */ The routines netif_rx_hook_x write the incoming packets to bigphysarea memory. I have written a character driver to retreive these packets from this memory. SETUP: I assume that the D-Link ethernet cards are eth2,eth3. If not the code has to be modified (easy). First set up the ethernet scripts to a local area network. /etc/sysconfig/network-scripts/ifcfg-eth2 DEVICE=eth2 USERCTL=no ONBOOT=no BOOTPROTO=none IPADDR=10.0.0.1 BROADCAST=10.0.0.255 NETWORK=10.0.0.0 NETMASK=255.255.255.0 TYPE=Ethernet PEERDNS=no /etc/sysconfig/network-scripts/ifcfg-eth3 DEVICE=eth3 USERCTL=no ONBOOT=no BOOTPROTO=none IPADDR=10.0.0.2 BROADCAST=10.0.0.255 NETWORK=10.0.0.0 NETMASK=255.255.255.0 TYPE=Ethernet PEERDNS=no One now needs to make the character devices: mknod 232 0 c /dev/schar2 mknod 232 0 c /dev/schar3 You should change the permission on these devices so a standard user can access them. ls -all /dev/schar2 crwxrwxrwx 1 root root 232, 0 Mar 9 10:40 /dev/schar2 ls -all /dev/schar3 crwxrwxrwx 1 root root 233, 0 Mar 9 10:40 /dev/schar3 Compile the driver. /bigphysarea_xxxx/d550/make /bigphysarea_xxxx/eth_hook_2/make /bigphysarea_xxxx/eth_hook_3/make Loading the driver. /bigphysarea_xxxx/ethreset Checking the driver loaded. /sbin/lsmod dl2x 14660 2 eth_hook_3 6944 0 [dl2x] eth_hook_2 7584 0 [dl2x] You can check that eth_hook_2 and eth_hook_3 grabbed allocated memory. cat /proc/bigphysarea Big physical area, size 64000 kB free list: used list: number of blocks: 1 2 size of largest block: 56000 kB 4000 kB total: 56000 kB 8000 kB One can also check ethnet packets via /sbin/ifconfig. /sbin/ifconfig eth2 Link encap:Ethernet HWaddr 00:0D:88:B5:86:AC inet addr:10.0.0.1 Bcast:10.0.0.1 Mask:255.255.255.0 UP BROADCAST RUNNING NOARP PROMISC MULTICAST MTU:9000 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:180 (180.0 b) TX bytes:0 (0.0 b) Interrupt:26 Base address:0xc00 eth3 Link encap:Ethernet HWaddr 00:0D:88:B5:86:AF inet addr:10.0.0.2 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING NOARP PROMISC MULTICAST MTU:9000 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:3 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:180 (180.0 b) Interrupt:24 Base address:0x2800 I have also added proc files for the character devices eth_hook_2 and eth_hook_3. Just type. cat /proc/sys/dev/schar/2 or cat /proc/sys/dev/schar/3 GIGABIT DRIVER ETH2 RECEIVE: recieve 3 read 0 nleft 3 bytes 000000192 allowed 004096000 TRANSMIT: transmit 0 bytes 000000000 ERROR STATISTICS: loop 0 counter 0 overwrite 0 flag 0 oversize 0 At this point you can be very confident that the drivers are loaded and working. TUNING DRIVERS The amount of memory allocated by the drivers can be modified in the eth_hook_x drivers. One line of the code needs to be modified. #define MMT_PAGES_2 1000 #define MMT_PAGESIZE_2 4096 Here I have allocated 4096x1000 bytes to the driver. In last years test beam we allocated a full 1 gig of bigphysarea memory to the driver. TESTING DRIVERS Attach a fiber cable between the two gigabit ethernet cards. Make sure the link lights turn on (the drivers must be loaded). Routines to write, read and reset between the connected drivers can be found in: http://www.physics.ohio-state.edu/~durkin/software/frank.tar AUTO LOADING DRIVERS Believe it or not we have been too lazy to do this to date. This is how one might do it though. In the directory /etc/rc.d/init.d one needs to add the following script (name it eth_hook or something).. #!/bin/sh # # chkconfig: 345 55 45 # # Source function library. . /etc/rc.d/init.d/functions # See how we were called. case "$1" in start) echo -n "Starting eth_hook drivers: " /root/bigphysarea_xxxx/ethreset echo eth_hook ;; stop) echo -n "Stopping eth_daemon: " .root/bigphysarea_xxxx/ethdown echo "eth_hook" ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0 Once this script has been added one can use the standard system scripts to add this to the startup programs. Hope this helps. Stan