Ethtool查看网卡信息

今天在定位网卡丢包情况的时候,由于不太清楚实际环境,猜想有可能驱动几个queue打到了同一个queue去了,导致丢包,但是由于用的驱动直接打了个缺口,将包送到了用户态进行处理,而没有经过内核态,所以以为跟tcpdump以及tshark无法监听一样,但实际上,通过一个ethtool的简单命令,是可以得到信息的

# ethtool -S xge0
NIC statistics:
     rx_packets: 46492161059
     tx_packets: 6
     rx_bytes: 17618855793124
     tx_bytes: 468
     lsc_int: 1
     tx_busy: 0
     non_eop_descs: 0
     rx_errors: 0
     tx_errors: 0
     rx_dropped: 0
     tx_dropped: 0
     multicast: 413997
     broadcast: 828557
     rx_no_buffer_count: 0
     collisions: 0
     rx_over_errors: 0
     rx_crc_errors: 0
     rx_frame_errors: 0
     rx_fifo_errors: 0
     rx_missed_errors: 1313867353
     tx_aborted_errors: 0
     tx_carrier_errors: 0
     tx_fifo_errors: 0
     tx_heartbeat_errors: 0
     tx_timeout_count: 0
     tx_restart_queue: 0
     rx_long_length_errors: 0
     rx_short_length_errors: 0
     tx_tcp4_seg_ctxt: 0
     tx_tcp6_seg_ctxt: 0
     tx_flow_control_xon: 0
     rx_flow_control_xon: 0
     tx_flow_control_xoff: 0
     rx_flow_control_xoff: 0
     rx_csum_offload_good: 0
     rx_csum_offload_errors: 0
     tx_csum_offload_ctxt: 0
     low_latency_interrupt: 0
     alloc_rx_page_failed: 0
     alloc_rx_buff_failed: 0
     lro_aggregated: 0
     lro_flushed: 0
     lro_recycled: 0
     rx_no_dma_resources: 0
     hw_rsc_count: 0
     rx_flm: 0
     fdir_match: 0
     fdir_miss: 0
     tx_queue_0_packets: 6
     tx_queue_0_bytes: 468
     tx_queue_1_packets: 0
     tx_queue_1_bytes: 0
     tx_queue_2_packets: 0
     tx_queue_2_bytes: 0
     tx_queue_3_packets: 0
     tx_queue_3_bytes: 0
     rx_queue_0_packets: 29820640125
     rx_queue_0_bytes: 12341613815128
     rx_queue_1_packets: 2464849382
     rx_queue_1_bytes: 374791298420
     rx_queue_2_packets: 8355358699
     rx_queue_2_bytes: 832094937421
     rx_queue_3_packets: 5851312853
     rx_queue_3_bytes: 4070355742155

这里实际上可以获得网卡驱动的信息,这正是我想要的,一共加载了4个queue

# ethtool -S xge0 | grep rx_queue
     rx_queue_0_packets: 29820640125
     rx_queue_0_bytes: 12341613815128
     rx_queue_1_packets: 2464849382
     rx_queue_1_bytes: 374791298420
     rx_queue_2_packets: 8355358699
     rx_queue_2_bytes: 832094937421
     rx_queue_3_packets: 5851312853
     rx_queue_3_bytes: 4070355742155

这里就是硬件RX的情况,除了-S选项,还有几个也是用的比较普遍的,下面几个是平时用的比较多,需要检查的,接收模块,以及RX,TX,AUTONEG等等,其它的一些选项,搜搜就知道用法了

# ethtool xge0
Settings for xge0:
	Supported ports: [ FIBRE ]
	Supported link modes:   1000baseT/Full 
	                        10000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Speed: 10000Mb/s
	Duplex: Full
	Port: FIBRE
	PHYAD: 0
	Transceiver: external
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes

# ethtool -a xge0
Pause parameters for xge0:
Autonegotiate:	off
RX:		off
TX:		off

# ethtool -k xge0
Features for xge0:
rx-checksumming: on
tx-checksumming: off
scatter-gather: off
tcp-segmentation-offload: off
udp-fragmentation-offload: off
generic-segmentation-offload: off
generic-receive-offload: off
large-receive-offload: off
rx-vlan-offload: off
tx-vlan-offload: off
ntuple-filters: off
receive-hashing: off

发表回复