编程Linux网络驱动程序以支持关闭TCP校验和卸载
我正在编写一个linux网络驱动程序。差不多完成了。当我在两台电脑之间ping时,一切都很完美。然后我尝试使用一些TCP/UDP协议,接收方从不回复。我使用wireshark查看那里发生了什么,我发现所有TCP数据包的校验和都不正确。据说错误的校验和是由TCP校验和卸载引起的。我试图用ethtool关闭它。当我使用编程Linux网络驱动程序以支持关闭TCP校验和卸载,linux,tcp,linux-device-driver,Linux,Tcp,Linux Device Driver,我正在编写一个linux网络驱动程序。差不多完成了。当我在两台电脑之间ping时,一切都很完美。然后我尝试使用一些TCP/UDP协议,接收方从不回复。我使用wireshark查看那里发生了什么,我发现所有TCP数据包的校验和都不正确。据说错误的校验和是由TCP校验和卸载引起的。我试图用ethtool关闭它。当我使用sudo ethtool-K uwn0 tx off时,它会回复我 Cannot get device rx-checksumming settings: Operation not
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校验和卸载?或者只是在软件中计算校验和?
谢谢在驱动程序中设置设备接口时,您应该在
netdev->HW\u features
中取消设置标志NETIF\u F\u HW\u CSUM
,以强制TCP在软件中计算校验和
有关设置硬件功能标志的示例,请参阅.这是一个很好的问题,但应该在@JamesC结束。不,它属于这里,因为它是关于编写网络设备驱动程序,而不是如何配置现有驱动程序。