March 03, 2007

ethtool 使用實例

最近在做某項 realtime 的研究,因為 NIC 本身的問題,停滯不前,不過我差點忘記,常用的這台 nc4000 就可分析內建網路卡的數據。先來看看硬體:
$ lspci | grep Ethernet
00:13.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705M Gigabit Ethernet (rev 03)
在 Broadcom 的網站提供不錯的 Linux 指引,詳見 FAQ 條目 [What are the Linux tg3, bnx2 and b44 drivers?],依據該對照表,我該用 tg3 kernel module (GPL),那麼這跟官方的 driver 相比,有什麼差別呢?FAQ 提到:
    There are a few minor differences to be aware of if you are migrating from the bcm5700 driver to the tg3 driver. The tg3 driver does not support the Broadcom proprietary load balancing software module known as BASP. The Linux bonding driver and 802.1q driver provide similar functionalities and can be used with tg3. BASP will also be discontinued. The tg3 driver also does not support module parameters to configure the device (line speed, flow control, ring sizes, etc) but relies on standard Linux utilities such as ethtool. Other than these differences, the two drivers are very similar in terms of hardware support, robustness, and performance.
當然我現在得研究 GPL driver,而且 tg3 的效率很不錯。不過呢,後面的敘述讓我有點印象,記得三年前作 Thin client 時,硬體偵測的部份也有參考到 ethtool,而且 Debian 早已收錄 [Package: ethtool],通常安裝好就會有該工具,以下是輸出項目:
$ sudo /usr/sbin/ethtool eth1
Settings for eth1:
	Supported ports: [ MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised auto-negotiation: Yes
	Speed: 10Mb/s
	Duplex: Half
	Port: Twisted Pair
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: g
	Wake-on: d
	Current message level: 0x000000ff (255)
	Link detected: yes
可透過 git 取得最新的 ethtool:
git-clone git://
manpage 提供詳細的使用方式,這裡就不贅述了。
由 jserv 發表於 March 3, 2007 10:37 PM