Re: [PATCH net 1/3] net: hns: Add TX CSUM check when fill TX description

From: David Miller
Date: Tue Jul 04 2017 - 06:28:51 EST

From: Lin Yun Sheng <linyunsheng@xxxxxxxxxx>
Date: Tue, 4 Jul 2017 18:47:31 +0800

> From: Yunsheng Lin <linyunsheng@xxxxxxxxxx>
> If driver support checksum offload, should check netdev feature
> before fill TX description and get CSUM err bit from RX
> description. HNS driver do the check in RX derction but it doesn't
> do the check in TX direction.
> Signed-off-by: lipeng <lipeng321@xxxxxxxxxx>
> Reviewed-by: Daode Huang <huangdaode@xxxxxxxxxxxxx>
> Reviewed-by: Yunsheng Lin <linyunsheng@xxxxxxxxxx>

This is not correct.

You should be checking the skb->checksum field to decide if you should
offload the TX checksum of the packet or not.

Correct drivers, as far as I am aware, do not check the feature flags
so I wonder where you got this idea from. Always use other well
established existing drivers as a model for how to handle things like

And this makes sense. An SKB can have it's checksumming determination
made first, then the netdev feature change is made afterwards. For
correctness you still need to TX checksum offload that SKB otherwise
it will be emitted without a correctly computed checksum.

Thank you.