Reputation: 832
I am programming a linux networking driver. It is almost done. When I ping between 2 PCs, everything is perfect. And then I try to use some TCP/UDP protocols, the receiver never replies. I used wireshark to see what happens there, and I found all the TCP packets have incorrect checksum. It is said the wrong checksum is caused by TCP checksum offload. I tried to turn it off with ethtool. When I use sudo ethtool -K uwn0 tx off
, it replies me
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
Is there a way to make my driver support tcp checksum offload? Or just compute checksum in software? Thanks
Upvotes: 3
Views: 2745
Reputation: 101
When setting up your device's interface within your driver, you should unset the flag NETIF_F_HW_CSUM
in netdev->hw_features
to force TCP to calculate the check-sum in software.
For a example of setting up the hardware's feature-flags, take a look at
lxr.free-electrons.com/source/drivers/net/ethernet/intel/e1000e/netdev.c
.
Upvotes: 1