目錄
什么是ethtool?
ethtool的安裝
ethtool的使用
什么是ethtool?
Ethtool是Linux下用于查詢和設定網卡引數的命令,
用于控制網路驅動程式和硬體(尤其是有線以太網設備)的標準Linux實用程式,它可以用于:
- 獲取標識和診斷資訊
- 獲取擴展的設備統計資訊
- 以太網設備的控制速度,雙工,自動協商和流控制
- 控制校驗和卸載和其他硬體卸載功能
- 控制DMA環大小和中斷控制
- 控制多佇列設備的接收佇列選擇
- 升級閃存中的韌體
ethtool的安裝
- 下載tcpdump、libpcap官方原始碼:
https://mirrors.edge.kernel.org/pub/software/network/ethtool/
- 解壓縮
tar -vxzf ethtool-5.2.tar.gz
注:小技巧:Linux下一般壓縮檔案后綴為.tar.bz2和.tar.gz,
它們解壓命令有兩三個選項是一致的:
xf(v),前者再加上j選項,后者再加上z選項,
- 進入目錄
cd ethtool-5.2
- 配置
3536:
CC=arm-hisiv400-linux-gcc ./configure --host=arm-hisiv400-linux --target=arm-hisiv400-linux --program-prefix=arm-hisiv400-linux- --with-pcap=linux --prefix=$(pwd)/../output/3536
3519:
CC=arm-hisiv600-linux-gcc ./configure --host=arm-hisiv600-linux --target=arm-hisiv600-linux --program-prefix=arm-hisiv600-linux- --with-pcap=linux --prefix=$(pwd)/../output/3519a
3519av100:
CC=arm-himix200-linux-gcc ./configure --host=arm-himix200-linux --target=arm-himix200-linux --program-prefix=arm-himix200-linux- --with-pcap=linux --prefix=$(pwd)/../output/3519av100
開發機:
./configure --with-pcap=linux --prefix=$(pwd)/../output/pc
編譯引數說明:
1) CC:編譯gdb使用的交叉編譯工具鏈,3536和3519的工具不一樣
2) --host:編譯出來的gdb運行在什么機器上
3) --target:要除錯的目標板
4) --program-prefix:編譯生成可執行檔案的前綴
5) --prefix:make install的的位置
注:–target=arm-linux意思是說目標平臺是運行于ARM體系結構的linux內核;–program-prefix=arm-linux-是指生成的可執行檔案的前綴,
比如arm-linux-gdb,–prefix是指生成的可執行檔案安裝在哪個目錄,這個目錄需要根據實際情況作選擇,如果該目錄不存在,會自動創建,當然,權限足夠的話,
- 編譯、安裝
make
make install
ethtool的使用
ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX
ethtool [-A] ethX [autoneg on|off] [rx on|off] [tx on|off]
ethtool [-C] ethX [adaptive-rx on|off] [adaptive-tx on|off] [rx-usecs N]
[rx-frames N] [rx-usecs-irq N] [rx-frames-irq N] [tx-usecs N]
[tx-frames N] [tx-usecs-irq N] [tx-frames-irq N] [stats-block-usecs N]
[pkt-rate-low N][rx-usecs-low N] [rx-frames-low N] [tx-usecs-low N]
[tx-frames-low N] [pkt-rate-high N] [rx-usecs-high N] [rx-frames-high N]
[tx-usecs-high N] [tx-frames-high N] [sample-interval N]
ethtool [-G] ethX [rx N] [rx-mini N] [rx-jumbo N] [tx N]
ethtool [-e] ethX [raw on|off] [offset N] [length N]
ethtool [-E] ethX [magic N] [offset N] [value N]
ethtool [-K] ethX [rx on|off] [tx on|off] [sg on|off] [tso on|off]
ethtool [-p] ethX [N]
ethtool [-t] ethX [offline|online]
ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off]
[port tp|aui|bnc|mii] [phyad N] [xcvr internal|external]
[wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N]
引數說明:
-a //查看網卡中接收模塊RX、發送模塊TX和Autonegotiate模塊的狀態:啟動on 或 停用off,
-A //修改網卡中 接收模塊RX、發送模塊TX和Autonegotiate模塊的狀態:啟動on 或 停用off,
-c //display the Coalesce(聚合、聯合) information of the specified ethernet card.聚合網口資訊,使看起來更有規律,
-C //Change the Coalesce setting of the specified ethernet card.修改網卡聚合資訊,
-g //Display the rx/tx ring parameter information of the specified ethernet card. 顯示網卡的接收/發送環形引數,
-G //Change the rx/tx ring setting of the specified ethernet card. 修改網卡的接收/發送環形引數,
-i //顯示網卡驅動的資訊,如驅動的名稱、版本等,
-d //顯示register dump資訊, 部分網卡驅動不支持該選項,
-e //顯示EEPROM dump資訊,部分網卡驅動不支持該選項,
-E //修改網卡EEPROM byte.
-k //顯示網卡Offload引數的狀態:on 或 off,包括rx-checksumming、tx-checksumming等,
-K //修改網卡Offload引數的狀態
-p //用于區別不同ethX對應網卡的物理位置,常用的方法是使網卡port上的led不斷的閃;N指示了網卡閃的持續時間,以秒為單位,
-r //如果auto-negotiation模塊的狀態為on,則restarts auto-negotiation.
-s //修改網卡的部分配置,包括網卡速度、單工/全雙工模式、mac地址等,加上-s選項修改的內容才會生效
-S //顯示NIC- and driver-specific 的統計引數,如網卡接收/發送的位元組數、接收/發送的廣播包個數等,
-t //讓網卡執行自我檢測,有兩種模式:offline or online.
獲取更多相關的嵌入式開發工具,可收藏系列博文,持續更新中:
【開發工具】嵌入式常用開發工具匯總帖
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/249837.html
標籤:其他
