TP-LINK TF-3200 On Debian

So I bought a FastEthernet NIC, a cheap TP-LINK PCI card, somewhere around $3,5. Here’s the box:
TP-LINK TF-3200

The model is TF-3200, and I want to install it alongside my D-LINK .. something.

Installation

The hardware installation is boring, I unwrap it, put it on one of the empty PCI slots and fasten its screw to the casing.

Get My Debian To Use It

Strangely at first boot my Debian didn’t recognize it. Yay!! There is only one way to install a PCI card and I could swear even a brick couldn’t get it wrong, so knowing hardwares love-hate relationship with Linux I have to suspect it’s more down to modules and stuff.

Fortunately, for a $3.5 LAN card, it also comes with a “Resource CD”; it’s a driver CD. In short, there is a driver for Linux located in TF-3200/LinuxDriver/ and it comes in source form.

Aww, that’s cute!

I did try to compile but somehow I cant get it to work:

$ make
make -C /lib/modules/2.6.39-2-486/build SUBDIRS=/tmp/LinuxDriver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.39-2-486'
  CC [M]  /tmp/LinuxDriver/sundance_main.o
/tmp/LinuxDriver/sundance_main.c: In function ‘sundance_probe1’:
/tmp/LinuxDriver/sundance_main.c:712: error: implicit declaration of function ‘SET_MODULE_OWNER’
/tmp/LinuxDriver/sundance_main.c:735: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:762: error: ‘struct net_device’ has no member named ‘open’
/tmp/LinuxDriver/sundance_main.c:763: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/tmp/LinuxDriver/sundance_main.c:764: error: ‘struct net_device’ has no member named ‘stop’
/tmp/LinuxDriver/sundance_main.c:765: error: ‘struct net_device’ has no member named ‘get_stats’
/tmp/LinuxDriver/sundance_main.c:766: error: ‘struct net_device’ has no member named ‘set_multicast_list’
/tmp/LinuxDriver/sundance_main.c:767: error: ‘struct net_device’ has no member named ‘set_mac_address’
/tmp/LinuxDriver/sundance_main.c:768: error: ‘struct net_device’ has no member named ‘do_ioctl’
/tmp/LinuxDriver/sundance_main.c:769: error: ‘struct net_device’ has no member named ‘tx_timeout’
/tmp/LinuxDriver/sundance_main.c:771: error: ‘struct net_device’ has no member named ‘change_mtu’
/tmp/LinuxDriver/sundance_main.c: In function ‘mdio_read’:
/tmp/LinuxDriver/sundance_main.c:1029: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘mdio_write’:
/tmp/LinuxDriver/sundance_main.c:1059: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_open’:
/tmp/LinuxDriver/sundance_main.c:1088: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1094: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/tmp/LinuxDriver/sundance_main.c:1094: error: (Each undeclared identifier is reported only once
/tmp/LinuxDriver/sundance_main.c:1094: error: for each function it appears in.)
/tmp/LinuxDriver/sundance_main.c:1141: error: ‘SPIN_LOCK_UNLOCKED’ undeclared (first use in this function)
/tmp/LinuxDriver/sundance_main.c: In function ‘check_speed’:
/tmp/LinuxDriver/sundance_main.c:1195: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_timer’:
/tmp/LinuxDriver/sundance_main.c:1242: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘tx_timeout’:
/tmp/LinuxDriver/sundance_main.c:1258: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘init_ring’:
/tmp/LinuxDriver/sundance_main.c:1311: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘tx_poll’:
/tmp/LinuxDriver/sundance_main.c:1354: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘start_tx’:
/tmp/LinuxDriver/sundance_main.c:1381: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘reset_tx’:
/tmp/LinuxDriver/sundance_main.c:1423: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘intr_handler’:
/tmp/LinuxDriver/sundance_main.c:1487: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘rx_poll’:
/tmp/LinuxDriver/sundance_main.c:1621: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1677: error: implicit declaration of function ‘eth_copy_and_sum’
/tmp/LinuxDriver/sundance_main.c: In function ‘refill_rx’:
/tmp/LinuxDriver/sundance_main.c:1718: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_error’:
/tmp/LinuxDriver/sundance_main.c:1749: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘get_stats’:
/tmp/LinuxDriver/sundance_main.c:1772: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘set_rx_mode’:
/tmp/LinuxDriver/sundance_main.c:1801: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1811: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1816: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1822: error: ‘struct net_device’ has no member named ‘mc_list’
/tmp/LinuxDriver/sundance_main.c:1822: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1823: error: dereferencing pointer to incomplete type
/tmp/LinuxDriver/sundance_main.c:1824: error: dereferencing pointer to incomplete type
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_ethtool_ioctl’:
/tmp/LinuxDriver/sundance_main.c:1869: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_ioctl’:
/tmp/LinuxDriver/sundance_main.c:1953: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_close’:
/tmp/LinuxDriver/sundance_main.c:2001: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘sundance_remove1’:
/tmp/LinuxDriver/sundance_main.c:2118: error: ‘struct net_device’ has no member named ‘priv’
make[4]: *** [/tmp/LinuxDriver/sundance_main.o] Error 1
make[3]: *** [_module_/tmp/LinuxDriver] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.39-2-486'
make: *** [all] Error 2

Anyway, after a quick glance at the Makefile it seems it (supposed to) generate sundance.o and to install it to /lib/modules/$(KernelVersion)/kernel/drivers/net/ as sundance.ko. Fortunately a quick ls -lh /lib/modules/$(uname -r)/kernel/drivers/net/ | grep sundance told me that I already have it. So I hope I can skip it, now that I know my Debian already have its sundance.ko.

About sundance.ko

Of course, the next step is to get to know this sundance.ko thing. I query that driver by running:

$ sudo modinfo /lib/modules/$(uname -r)/kernel/drivers/net/sundance.ko
filename:       /lib/modules/2.6.39-2-486/kernel/drivers/net/sundance.ko
license:        GPL
description:    Sundance Alta Ethernet driver
author:         Donald Becker 
alias:          pci:v000013F0d00000200sv*sd*bc*sc*i*
alias:          pci:v000013F0d00000201sv*sd*bc*sc*i*
alias:          pci:v00001186d00001002sv*sd*bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001040bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001012bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001003bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001002bc*sc*i*
depends:        mii
intree:         Y
vermagic:       2.6.39-2-486 mod_unload modversions 486
parm:           media:array of charp
parm:           debug:Sundance Alta debug level (0-5) (int)
parm:           rx_copybreak:Sundance Alta copy breakpoint for copy-only-tiny-frames (int)
parm:           flowctrl:Sundance Alta flow control [0|1] (int)

I found the author (Donald Becker) match with the information found at sundance_main.c. Another interesting information I found is the dependency of this module, it says it depends on another module named mii, so I ran a check on that one too:

$ sudo modinfo mii
filename:       /lib/modules/2.6.39-2-486/kernel/drivers/net/mii.ko
license:        GPL
description:    MII hardware support library
author:         Jeff Garzik 
depends:
intree:         Y
vermagic:       2.6.39-2-486 mod_unload modversions 486

This sundance depends on mii, where we also have mii.c and mii.h lying on the source directory too, so this DEFINITELY it.

I already have it! So now it should be working after I enable those two modules, okay then:

$ sudo modprobe mii; sudo modprobe sundance;

And then I want to see if anything happened:

$ dmesg | grep -i eth | tail
.. unrelated texts ..
[53251.562523] eth1: IC Plus Corporation IP100A FAST Ethernet Adapter at 00019800, 54:e6:fc:83:12:72, IRQ 19.
[53251.563050] eth1: MII PHY found at address 0, status 0x7849 advertising 01e1.
.. unrelated texts ..

It seems my card finally recognized by Linux! One final check just to make sure :

$ ip link show
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:19:5b:5b:cb:22 brd ff:ff:ff:ff:ff:ff
3: eth1:  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 54:e6:fc:83:12:72 brd ff:ff:ff:ff:ff:ff
4: wlan0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:11:09:be:fe:0d brd ff:ff:ff:ff:ff:ff

Yep, it’s there.

Okay, Now What?

I put it into use, duh! I update my shorewall configurations and make dhcpd to serve on that interface too, etc.. all is well until I get to reboot.

I forgot that I have to automatically load those two modules at boot, so I add sundance.conf to /etc/modprobe.d:

# /etc/modprobe.d/sundance.conf
alias eth1 sundance
options sundance debug=3

Now everything works as it should be.

Advertisements

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s