dl2k.txt 9.2 KB

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