3

我正在编写一个 linux 网络驱动程序。快完成了。当我在两台电脑之间 ping 时,一切都很完美。然后我尝试使用一些 TCP/UDP 协议,接收者从不回复。我用wireshark查看那里发生了什么,我发现所有的TCP数据包都有不正确的校验和。据说错误的校验和是由TCP校验和卸载引起的。我试图用 ethtool 将其关闭。当我使用sudo ethtool -K uwn0 tx off时,它会回复我

Cannot get device rx-checksumming settings: Operation not supported
Cannot get device tx-checksumming settings: Operation not supported
Cannot get device scatter-gather settings: Operation not supported
Cannot get device tcp-segmentation-offload settings: Operation not supported
Cannot get device udp-fragmentation-offload settings: Operation not supported
Cannot get device generic-segmentation-offload settings: Operation not supported
Cannot get device generic-receive-offload settings: Operation not supported
Cannot get device flags: Operation not supported

有没有办法让我的驱动程序支持 tcp checksum offload?或者只是在软件中计算校验和?谢谢

4

1 回答 1

1

在驱动程序中设置设备接口时,应取消设置标志NETIF_F_HW_CSUMnetdev->hw_features强制 TCP 在软件中计算校验和。

有关设置硬件功能标志的示例,请查看
lxr.free-electrons.com/source/drivers/net/ethernet/intel/e1000e/netdev.c.

于 2013-08-17T08:45:01.120 回答