xref: /linux/Documentation/networking/device_drivers/ethernet/dlink/dl2k.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*132db935SJakub Kicinski.. SPDX-License-Identifier: GPL-2.0
2*132db935SJakub Kicinski
3*132db935SJakub Kicinski=========================================================
4*132db935SJakub KicinskiD-Link DL2000-based Gigabit Ethernet Adapter Installation
5*132db935SJakub Kicinski=========================================================
6*132db935SJakub Kicinski
7*132db935SJakub KicinskiMay 23, 2002
8*132db935SJakub Kicinski
9*132db935SJakub Kicinski.. Contents
10*132db935SJakub Kicinski
11*132db935SJakub Kicinski - Compatibility List
12*132db935SJakub Kicinski - Quick Install
13*132db935SJakub Kicinski - Compiling the Driver
14*132db935SJakub Kicinski - Installing the Driver
15*132db935SJakub Kicinski - Option parameter
16*132db935SJakub Kicinski - Configuration Script Sample
17*132db935SJakub Kicinski - Troubleshooting
18*132db935SJakub Kicinski
19*132db935SJakub Kicinski
20*132db935SJakub KicinskiCompatibility List
21*132db935SJakub Kicinski==================
22*132db935SJakub Kicinski
23*132db935SJakub KicinskiAdapter Support:
24*132db935SJakub Kicinski
25*132db935SJakub Kicinski- D-Link DGE-550T Gigabit Ethernet Adapter.
26*132db935SJakub Kicinski- D-Link DGE-550SX Gigabit Ethernet Adapter.
27*132db935SJakub Kicinski- D-Link DL2000-based Gigabit Ethernet Adapter.
28*132db935SJakub Kicinski
29*132db935SJakub Kicinski
30*132db935SJakub KicinskiThe driver support Linux kernel 2.4.7 later. We had tested it
31*132db935SJakub Kicinskion the environments below.
32*132db935SJakub Kicinski
33*132db935SJakub Kicinski . Red Hat v6.2 (update kernel to 2.4.7)
34*132db935SJakub Kicinski . Red Hat v7.0 (update kernel to 2.4.7)
35*132db935SJakub Kicinski . Red Hat v7.1 (kernel 2.4.7)
36*132db935SJakub Kicinski . Red Hat v7.2 (kernel 2.4.7-10)
37*132db935SJakub Kicinski
38*132db935SJakub Kicinski
39*132db935SJakub KicinskiQuick Install
40*132db935SJakub Kicinski=============
41*132db935SJakub KicinskiInstall linux driver as following command::
42*132db935SJakub Kicinski
43*132db935SJakub Kicinski    1. make all
44*132db935SJakub Kicinski    2. insmod dl2k.ko
45*132db935SJakub Kicinski    3. ifconfig eth0 up 10.xxx.xxx.xxx netmask 255.0.0.0
46*132db935SJakub Kicinski			^^^^^^^^^^^^^^^\	    ^^^^^^^^\
47*132db935SJakub Kicinski					IP		     NETMASK
48*132db935SJakub Kicinski
49*132db935SJakub KicinskiNow eth0 should active, you can test it by "ping" or get more information by
50*132db935SJakub Kicinski"ifconfig". If tested ok, continue the next step.
51*132db935SJakub Kicinski
52*132db935SJakub Kicinski4. ``cp dl2k.ko /lib/modules/`uname -r`/kernel/drivers/net``
53*132db935SJakub Kicinski5. Add the following line to /etc/modprobe.d/dl2k.conf::
54*132db935SJakub Kicinski
55*132db935SJakub Kicinski	alias eth0 dl2k
56*132db935SJakub Kicinski
57*132db935SJakub Kicinski6. Run ``depmod`` to updated module indexes.
58*132db935SJakub Kicinski7. Run ``netconfig`` or ``netconf`` to create configuration script ifcfg-eth0
59*132db935SJakub Kicinski   located at /etc/sysconfig/network-scripts or create it manually.
60*132db935SJakub Kicinski
61*132db935SJakub Kicinski   [see - Configuration Script Sample]
62*132db935SJakub Kicinski8. Driver will automatically load and configure at next boot time.
63*132db935SJakub Kicinski
64*132db935SJakub KicinskiCompiling the Driver
65*132db935SJakub Kicinski====================
66*132db935SJakub KicinskiIn Linux, NIC drivers are most commonly configured as loadable modules.
67*132db935SJakub KicinskiThe approach of building a monolithic kernel has become obsolete. The driver
68*132db935SJakub Kicinskican be compiled as part of a monolithic kernel, but is strongly discouraged.
69*132db935SJakub KicinskiThe remainder of this section assumes the driver is built as a loadable module.
70*132db935SJakub KicinskiIn the Linux environment, it is a good idea to rebuild the driver from the
71*132db935SJakub Kicinskisource instead of relying on a precompiled version. This approach provides
72*132db935SJakub Kicinskibetter reliability since a precompiled driver might depend on libraries or
73*132db935SJakub Kicinskikernel features that are not present in a given Linux installation.
74*132db935SJakub Kicinski
75*132db935SJakub KicinskiThe 3 files necessary to build Linux device driver are dl2k.c, dl2k.h and
76*132db935SJakub KicinskiMakefile. To compile, the Linux installation must include the gcc compiler,
77*132db935SJakub Kicinskithe kernel source, and the kernel headers. The Linux driver supports Linux
78*132db935SJakub KicinskiKernels 2.4.7. Copy the files to a directory and enter the following command
79*132db935SJakub Kicinskito compile and link the driver:
80*132db935SJakub Kicinski
81*132db935SJakub KicinskiCD-ROM drive
82*132db935SJakub Kicinski------------
83*132db935SJakub Kicinski
84*132db935SJakub Kicinski::
85*132db935SJakub Kicinski
86*132db935SJakub Kicinski    [root@XXX /] mkdir cdrom
87*132db935SJakub Kicinski    [root@XXX /] mount -r -t iso9660 -o conv=auto /dev/cdrom /cdrom
88*132db935SJakub Kicinski    [root@XXX /] cd root
89*132db935SJakub Kicinski    [root@XXX /root] mkdir dl2k
90*132db935SJakub Kicinski    [root@XXX /root] cd dl2k
91*132db935SJakub Kicinski    [root@XXX dl2k] cp /cdrom/linux/dl2k.tgz /root/dl2k
92*132db935SJakub Kicinski    [root@XXX dl2k] tar xfvz dl2k.tgz
93*132db935SJakub Kicinski    [root@XXX dl2k] make all
94*132db935SJakub Kicinski
95*132db935SJakub KicinskiFloppy disc drive
96*132db935SJakub Kicinski-----------------
97*132db935SJakub Kicinski
98*132db935SJakub Kicinski::
99*132db935SJakub Kicinski
100*132db935SJakub Kicinski    [root@XXX /] cd root
101*132db935SJakub Kicinski    [root@XXX /root] mkdir dl2k
102*132db935SJakub Kicinski    [root@XXX /root] cd dl2k
103*132db935SJakub Kicinski    [root@XXX dl2k] mcopy a:/linux/dl2k.tgz /root/dl2k
104*132db935SJakub Kicinski    [root@XXX dl2k] tar xfvz dl2k.tgz
105*132db935SJakub Kicinski    [root@XXX dl2k] make all
106*132db935SJakub Kicinski
107*132db935SJakub KicinskiInstalling the Driver
108*132db935SJakub Kicinski=====================
109*132db935SJakub Kicinski
110*132db935SJakub KicinskiManual Installation
111*132db935SJakub Kicinski-------------------
112*132db935SJakub Kicinski
113*132db935SJakub Kicinski  Once the driver has been compiled, it must be loaded, enabled, and bound
114*132db935SJakub Kicinski  to a protocol stack in order to establish network connectivity. To load a
115*132db935SJakub Kicinski  module enter the command::
116*132db935SJakub Kicinski
117*132db935SJakub Kicinski    insmod dl2k.o
118*132db935SJakub Kicinski
119*132db935SJakub Kicinski  or::
120*132db935SJakub Kicinski
121*132db935SJakub Kicinski    insmod dl2k.o <optional parameter>	; add parameter
122*132db935SJakub Kicinski
123*132db935SJakub Kicinski---------------------------------------------------------
124*132db935SJakub Kicinski
125*132db935SJakub Kicinski  example::
126*132db935SJakub Kicinski
127*132db935SJakub Kicinski    insmod dl2k.o media=100mbps_hd
128*132db935SJakub Kicinski
129*132db935SJakub Kicinski   or::
130*132db935SJakub Kicinski
131*132db935SJakub Kicinski    insmod dl2k.o media=3
132*132db935SJakub Kicinski
133*132db935SJakub Kicinski   or::
134*132db935SJakub Kicinski
135*132db935SJakub Kicinski    insmod dl2k.o media=3,2	; for 2 cards
136*132db935SJakub Kicinski
137*132db935SJakub Kicinski---------------------------------------------------------
138*132db935SJakub Kicinski
139*132db935SJakub Kicinski  Please reference the list of the command line parameters supported by
140*132db935SJakub Kicinski  the Linux device driver below.
141*132db935SJakub Kicinski
142*132db935SJakub Kicinski  The insmod command only loads the driver and gives it a name of the form
143*132db935SJakub Kicinski  eth0, eth1, etc. To bring the NIC into an operational state,
144*132db935SJakub Kicinski  it is necessary to issue the following command::
145*132db935SJakub Kicinski
146*132db935SJakub Kicinski    ifconfig eth0 up
147*132db935SJakub Kicinski
148*132db935SJakub Kicinski  Finally, to bind the driver to the active protocol (e.g., TCP/IP with
149*132db935SJakub Kicinski  Linux), enter the following command::
150*132db935SJakub Kicinski
151*132db935SJakub Kicinski    ifup eth0
152*132db935SJakub Kicinski
153*132db935SJakub Kicinski  Note that this is meaningful only if the system can find a configuration
154*132db935SJakub Kicinski  script that contains the necessary network information. A sample will be
155*132db935SJakub Kicinski  given in the next paragraph.
156*132db935SJakub Kicinski
157*132db935SJakub Kicinski  The commands to unload a driver are as follows::
158*132db935SJakub Kicinski
159*132db935SJakub Kicinski    ifdown eth0
160*132db935SJakub Kicinski    ifconfig eth0 down
161*132db935SJakub Kicinski    rmmod dl2k.o
162*132db935SJakub Kicinski
163*132db935SJakub Kicinski  The following are the commands to list the currently loaded modules and
164*132db935SJakub Kicinski  to see the current network configuration::
165*132db935SJakub Kicinski
166*132db935SJakub Kicinski    lsmod
167*132db935SJakub Kicinski    ifconfig
168*132db935SJakub Kicinski
169*132db935SJakub Kicinski
170*132db935SJakub KicinskiAutomated Installation
171*132db935SJakub Kicinski----------------------
172*132db935SJakub Kicinski  This section describes how to install the driver such that it is
173*132db935SJakub Kicinski  automatically loaded and configured at boot time. The following description
174*132db935SJakub Kicinski  is based on a Red Hat 6.0/7.0 distribution, but it can easily be ported to
175*132db935SJakub Kicinski  other distributions as well.
176*132db935SJakub Kicinski
177*132db935SJakub KicinskiRed Hat v6.x/v7.x
178*132db935SJakub Kicinski-----------------
179*132db935SJakub Kicinski  1. Copy dl2k.o to the network modules directory, typically
180*132db935SJakub Kicinski     /lib/modules/2.x.x-xx/net or /lib/modules/2.x.x/kernel/drivers/net.
181*132db935SJakub Kicinski  2. Locate the boot module configuration file, most commonly in the
182*132db935SJakub Kicinski     /etc/modprobe.d/ directory. Add the following lines::
183*132db935SJakub Kicinski
184*132db935SJakub Kicinski	alias ethx dl2k
185*132db935SJakub Kicinski	options dl2k <optional parameters>
186*132db935SJakub Kicinski
187*132db935SJakub Kicinski     where ethx will be eth0 if the NIC is the only ethernet adapter, eth1 if
188*132db935SJakub Kicinski     one other ethernet adapter is installed, etc. Refer to the table in the
189*132db935SJakub Kicinski     previous section for the list of optional parameters.
190*132db935SJakub Kicinski  3. Locate the network configuration scripts, normally the
191*132db935SJakub Kicinski     /etc/sysconfig/network-scripts directory, and create a configuration
192*132db935SJakub Kicinski     script named ifcfg-ethx that contains network information.
193*132db935SJakub Kicinski  4. Note that for most Linux distributions, Red Hat included, a configuration
194*132db935SJakub Kicinski     utility with a graphical user interface is provided to perform steps 2
195*132db935SJakub Kicinski     and 3 above.
196*132db935SJakub Kicinski
197*132db935SJakub Kicinski
198*132db935SJakub KicinskiParameter Description
199*132db935SJakub Kicinski=====================
200*132db935SJakub KicinskiYou can install this driver without any additional parameter. However, if you
201*132db935SJakub Kicinskiare going to have extensive functions then it is necessary to set extra
202*132db935SJakub Kicinskiparameter. Below is a list of the command line parameters supported by the
203*132db935SJakub KicinskiLinux device
204*132db935SJakub Kicinskidriver.
205*132db935SJakub Kicinski
206*132db935SJakub Kicinski
207*132db935SJakub Kicinski===============================   ==============================================
208*132db935SJakub Kicinskimtu=packet_size			  Specifies the maximum packet size. default
209*132db935SJakub Kicinski				  is 1500.
210*132db935SJakub Kicinski
211*132db935SJakub Kicinskimedia=media_type		  Specifies the media type the NIC operates at.
212*132db935SJakub Kicinski				  autosense	Autosensing active media.
213*132db935SJakub Kicinski
214*132db935SJakub Kicinski				  ===========	=========================
215*132db935SJakub Kicinski				  10mbps_hd	10Mbps half duplex.
216*132db935SJakub Kicinski				  10mbps_fd	10Mbps full duplex.
217*132db935SJakub Kicinski				  100mbps_hd	100Mbps half duplex.
218*132db935SJakub Kicinski				  100mbps_fd	100Mbps full duplex.
219*132db935SJakub Kicinski				  1000mbps_fd	1000Mbps full duplex.
220*132db935SJakub Kicinski				  1000mbps_hd	1000Mbps half duplex.
221*132db935SJakub Kicinski				  0		Autosensing active media.
222*132db935SJakub Kicinski				  1		10Mbps half duplex.
223*132db935SJakub Kicinski				  2		10Mbps full duplex.
224*132db935SJakub Kicinski				  3		100Mbps half duplex.
225*132db935SJakub Kicinski				  4		100Mbps full duplex.
226*132db935SJakub Kicinski				  5          	1000Mbps half duplex.
227*132db935SJakub Kicinski				  6          	1000Mbps full duplex.
228*132db935SJakub Kicinski				  ===========	=========================
229*132db935SJakub Kicinski
230*132db935SJakub Kicinski				  By default, the NIC operates at autosense.
231*132db935SJakub Kicinski				  1000mbps_fd and 1000mbps_hd types are only
232*132db935SJakub Kicinski				  available for fiber adapter.
233*132db935SJakub Kicinski
234*132db935SJakub Kicinskivlan=n				  Specifies the VLAN ID. If vlan=0, the
235*132db935SJakub Kicinski				  Virtual Local Area Network (VLAN) function is
236*132db935SJakub Kicinski				  disable.
237*132db935SJakub Kicinski
238*132db935SJakub Kicinskijumbo=[0|1]			  Specifies the jumbo frame support. If jumbo=1,
239*132db935SJakub Kicinski				  the NIC accept jumbo frames. By default, this
240*132db935SJakub Kicinski				  function is disabled.
241*132db935SJakub Kicinski				  Jumbo frame usually improve the performance
242*132db935SJakub Kicinski				  int gigabit.
243*132db935SJakub Kicinski				  This feature need jumbo frame compatible
244*132db935SJakub Kicinski				  remote.
245*132db935SJakub Kicinski
246*132db935SJakub Kicinskirx_coalesce=m			  Number of rx frame handled each interrupt.
247*132db935SJakub Kicinskirx_timeout=n			  Rx DMA wait time for an interrupt.
248*132db935SJakub Kicinski				  If set rx_coalesce > 0, hardware only assert
249*132db935SJakub Kicinski				  an interrupt for m frames. Hardware won't
250*132db935SJakub Kicinski				  assert rx interrupt until m frames received or
251*132db935SJakub Kicinski				  reach timeout of n * 640 nano seconds.
252*132db935SJakub Kicinski				  Set proper rx_coalesce and rx_timeout can
253*132db935SJakub Kicinski				  reduce congestion collapse and overload which
254*132db935SJakub Kicinski				  has been a bottleneck for high speed network.
255*132db935SJakub Kicinski
256*132db935SJakub Kicinski				  For example, rx_coalesce=10 rx_timeout=800.
257*132db935SJakub Kicinski				  that is, hardware assert only 1 interrupt
258*132db935SJakub Kicinski				  for 10 frames received or timeout of 512 us.
259*132db935SJakub Kicinski
260*132db935SJakub Kicinskitx_coalesce=n			  Number of tx frame handled each interrupt.
261*132db935SJakub Kicinski				  Set n > 1 can reduce the interrupts
262*132db935SJakub Kicinski				  congestion usually lower performance of
263*132db935SJakub Kicinski				  high speed network card. Default is 16.
264*132db935SJakub Kicinski
265*132db935SJakub Kicinskitx_flow=[1|0]			  Specifies the Tx flow control. If tx_flow=0,
266*132db935SJakub Kicinski				  the Tx flow control disable else driver
267*132db935SJakub Kicinski				  autodetect.
268*132db935SJakub Kicinskirx_flow=[1|0]			  Specifies the Rx flow control. If rx_flow=0,
269*132db935SJakub Kicinski				  the Rx flow control enable else driver
270*132db935SJakub Kicinski				  autodetect.
271*132db935SJakub Kicinski===============================   ==============================================
272*132db935SJakub Kicinski
273*132db935SJakub Kicinski
274*132db935SJakub KicinskiConfiguration Script Sample
275*132db935SJakub Kicinski===========================
276*132db935SJakub KicinskiHere is a sample of a simple configuration script::
277*132db935SJakub Kicinski
278*132db935SJakub Kicinski    DEVICE=eth0
279*132db935SJakub Kicinski    USERCTL=no
280*132db935SJakub Kicinski    ONBOOT=yes
281*132db935SJakub Kicinski    POOTPROTO=none
282*132db935SJakub Kicinski    BROADCAST=207.200.5.255
283*132db935SJakub Kicinski    NETWORK=207.200.5.0
284*132db935SJakub Kicinski    NETMASK=255.255.255.0
285*132db935SJakub Kicinski    IPADDR=207.200.5.2
286*132db935SJakub Kicinski
287*132db935SJakub Kicinski
288*132db935SJakub KicinskiTroubleshooting
289*132db935SJakub Kicinski===============
290*132db935SJakub KicinskiQ1. Source files contain ^ M behind every line.
291*132db935SJakub Kicinski
292*132db935SJakub Kicinski    Make sure all files are Unix file format (no LF). Try the following
293*132db935SJakub Kicinski    shell command to convert files::
294*132db935SJakub Kicinski
295*132db935SJakub Kicinski	cat dl2k.c | col -b > dl2k.tmp
296*132db935SJakub Kicinski	mv dl2k.tmp dl2k.c
297*132db935SJakub Kicinski
298*132db935SJakub Kicinski    OR::
299*132db935SJakub Kicinski
300*132db935SJakub Kicinski	cat dl2k.c | tr -d "\r" > dl2k.tmp
301*132db935SJakub Kicinski	mv dl2k.tmp dl2k.c
302*132db935SJakub Kicinski
303*132db935SJakub KicinskiQ2: Could not find header files (``*.h``)?
304*132db935SJakub Kicinski
305*132db935SJakub Kicinski    To compile the driver, you need kernel header files. After
306*132db935SJakub Kicinski    installing the kernel source, the header files are usually located in
307*132db935SJakub Kicinski    /usr/src/linux/include, which is the default include directory configured
308*132db935SJakub Kicinski    in Makefile. For some distributions, there is a copy of header files in
309*132db935SJakub Kicinski    /usr/src/include/linux and /usr/src/include/asm, that you can change the
310*132db935SJakub Kicinski    INCLUDEDIR in Makefile to /usr/include without installing kernel source.
311*132db935SJakub Kicinski
312*132db935SJakub Kicinski    Note that RH 7.0 didn't provide correct header files in /usr/include,
313*132db935SJakub Kicinski    including those files will make a wrong version driver.
314*132db935SJakub Kicinski
315