编程Linuxnetworking驱动程序以支持closuresTCP校验和卸载

我正在编程一个Linuxnetworking驱动程序。 这几乎完成了。 当我在两台PC之间ping时,一切都是完美的。 然后我尝试使用一些TCP / UDP协议,接收机从来没有答复。 我用wireshark来看看那里发生了什么,我发现所有的TCP数据包都有不正确的校验和。 据说错误校验和是由TCP校验和卸载造成的。 我试图用ethtoolclosures它。 当我使用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_features的标志NETIF_F_HW_CSUM ,强制TCP用软件计算校验和。

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