Linux下通过修改网卡驱动的参数调整Intel网卡的性能

Intel的千兆网卡驱动(e1000.ko)加载的时候可以加上几个参数,如下:
insmod e1000.ko <parameter>=<value>
下面列出paramerter中和性能相关的几个以及他们的取值范围和默认值。
 
InterruptThrottleRate
范围:100-100000 (0=off, 1=dynamic)
默认:0
注:不支持82542, 82543, 82545, 82544芯片
 
RxDescriptors
范围:80-256 for 82542 and 82543-based adapters 
     80-4096 for all other supported adapters
默认:256
 
RxIntDelay
范围:0-65535 (0=off)
默认:0
 
RxAbsIntDelay
范围:0-65535 (0=off)
默认:128
 
TxDescriptors
范围:80-256 for 82542 and 82543-based adapters
     80-4096 for all other supported adapters
默认:256
 
TxIntDelay
范围:0-65535 (0=off)
默认:64
 
TxAbsIntDelay
范围:0-65535 (0=off)
默认:64
 
 
其中各种*IntDelay的单位是:1.024 microseconds
 
我们可以根据网卡的性能和cpu,内存,pci总线等不同来调整它们的值,另外可以编译网卡驱动的时候修改编译选项:NAPI和NO_NAPI。
make CFLAGS_EXTRA=-DCONFIG_E1000_NAPI
我找到一个关于如何修改这些参数取值得例子不过是英文的,怕翻译的不好,还是放上来原文吧。
 

A Sample Configuration

Some example settings are described below. These numbers are for illustration purposes only. For

optimal performance, the exact controller configuration is best determined through actual

experimentation.

The discussion below assumes that software is optimizing for full-size frames of 1538 bytes.

The calculations below make use of the following facts:

Gigabit Ethernet operates at 1.0 Gb/s or 1,000,000,000 bits per second. At this speed, the time required to transmit or receive a single bit (in other words, the bit-time) is 1.0 nanosecond.

A full-size Ethernet frame requires 1538 bytes (12,304 bits) of bandwidth:

—8-byte preamble and start-of-frame delimiter

—14-byte Ethernet header

—1500-byte payload

—4-byte FCS

—12-byte inter-packet gap

The controller can transmit or receive a full-size frame every 12.3 microseconds or approximately 81,000 packets per second.

Absolute Timers

Configuring the absolute timers is typically a matter of determining the desired interrupt rate or the

desired number of packets per interrupt. To receive approximately 3000 interrupts per second,software would configure the absolute timers to interrupt every 333 microseconds.

Alternately, to receive approximately 50 packets per interrupt, the controller must interruptapproximately 1620 times per second (81,000 packets-per-second at 50 packets-per-interrupt).

Software would then configure the absolute timers to interrupt every 617 microseconds.

Packet Timers

Experiments have shown that values between 20 and 40 microseconds work well for the packettimers.

Software might set the packet timers to expire after 2 full-length packet-times, or approximately 25

microseconds. The packet timers would then expire when throughput falls below about 333Mbps

(two unused packet-times follow every packet arrival, so approximately one-third of the total

bandwidth is in use). At greater levels of utilization, the packet timers would likely chain

repeatedly until the one of the absolute timers expired.

Interrupt Throttle Timer

Configuring the throttle timer is simply a question of determining the desired maximum interrupt

rate. As described earlier, software may realize better results by setting the throttle timer to

interrupt slightly more often than desired to reduce unnecessary latencies.

For typical applications, software might configure the controller to interrupt no more than 5000

times per second.

Different operating systems and environments will be capable of sustaining different maximum

interrupt rates. Experiments have demonstrated that Microsoft Windows-based operating systems

perform best when the device interrupts between 4,000 and 12,000 times per second. Linux-based

operating systems appear to perform best with an interrupt rate between 1,000 and 8,000 interrupts

per second. Other operating systems will perform differently.

Additional Tuning Considerations

The example configuration described above will require modifications to suit the intended

environment. The following factors may influence the tuning of the interrupt moderationparameters:

The latency associated with scheduling an interrupt handler. Larger scheduling latencies

 imply larger packet latencies. Lower interrupt delays may be required in these situations

to avoid overrun conditions and excessive per-packet delays.

The cost associated with handling an interrupt. In OS with low-cost interrupts, higher interrupt rates may be acceptable. In OS with high-cost interrupts, lower interrupt rates may be required.

The expected mixture of packet sizes. The preceding discussion assumes that software is optimizing for full-size frames. Optimizing for small packets or for a variety of packet sizes requires recalculating the expected packet rate.

The expected network utilization. High utilization implies high traffic rates, which makes the controller more susceptible to overrun conditions if it delays interrupts too long.

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: 在Linux下,通常可以使用驱动程序包(如Intel的iwlwifi-firmware和Broadcom的wl)来安装网卡设备的驱动程序。另外,也可以使用发行版提供的更新机制(如Ubuntu的apt-get)来自动安装驱动程序。 ### 回答2: 在Linux操作系统下,网卡设备驱动程序是连接计算机和网络之间的关键组件,它负责控制和管理网卡设备的各种功能和操作。 在Linux中,网卡设备驱动程序是作为内核模块加载的。当系统启动时,内核会根据硬件检测到的网卡设备信息加载相应的驱动程序。这些驱动程序将与内核进行交互,以提供网络通信能力。 网卡设备驱动程序包含了相应网卡设备的底层控制逻辑和操作指令。它通过与内核交互,将上层网络协议栈的请求转换为底层网卡设备可以理解和处理的操作。这意味着网卡设备驱动程序负责处理包括数据发送、接收、处理和中断等操作,使得网络通信能够在硬件层面得以实现。 在Linux系统中,网卡设备驱动程序负责管理和配置网卡设备的属性和参数。用户可以通过不同的工具和命令来进行网卡设备的管理,如ifconfig、ethtool等。这些工具可以帮助用户查看和设置网卡设备的IP地址、子网掩码、数据帧大小等属性,以满足用户的网络需求。 此外,通过更新和升级网卡设备驱动程序,用户可以得到更好的性能和更好的兼容性。开源的Linux系统为用户提供了众多网卡设备驱动程序的选择,以满足不同硬件设备的需求。 综上所述,Linux下的网卡设备驱动程序承担着控制和管理网卡设备的重要角色,是实现网络通信的关键组件。通过加载适当的驱动程序,用户可以使用各种网卡设备并享受网络通信带来的便利。 ### 回答3: 在Linux系统中,网卡设备驱动程序负责管理和控制计算机上的网络接口卡。它们允许操作系统与网络硬件进行通信,并实现网络数据的传输。 网卡设备驱动程序通常由硬件制造商开发,以确保其与特定的网卡设备兼容。这些驱动程序编写成模块形式,可以动态地加载到内核中,或者作为静态链接编译到内核中。 在加载驱动程序时,操作系统通过设备树(如果使用的是现代的设备模型)或基于PCI系统的ioctl调用与网卡设备进行通信。驱动程序初始化网卡设备,设置接口参数,例如MAC地址,MTU等。此外,驱动程序还为设备提供一组网络协议参数,如IP地址、子网掩码和默认网关等。 一旦网卡设备驱动程序加载成功,操作系统便可以通过网络协议栈来发送和接收数据包。驱动程序负责处理硬件中断,收集和发送数据以及管理网络设备的状态。 在Linux中,常见的网卡设备驱动程序是以太网驱动程序。这些驱动程序包括广泛的硬件支持,从常见的千兆以太网控制器到无线网卡设备。 总之,Linux下的网卡设备驱动程序是允许操作系统与网络硬件进行通信,并实现网络数据传输的关键组件。它们负责初始化和管理网卡设备,处理硬件中断以及提供网络协议参数。这些驱动程序在操作系统启动时加载,以确保计算机可以连接到网络并进行通信。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值