From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752286AbdGDK2m (ORCPT ); Tue, 4 Jul 2017 06:28:42 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:47652 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbdGDK2l (ORCPT ); Tue, 4 Jul 2017 06:28:41 -0400 Date: Tue, 04 Jul 2017 03:28:33 -0700 (PDT) Message-Id: <20170704.032833.2030036660842556798.davem@davemloft.net> To: linyunsheng@huawei.com Cc: huangdaode@hisilicon.com, xuwei5@hisilicon.com, liguozhu@hisilicon.com, Yisen.Zhuang@huawei.com, gabriele.paoloni@huawei.com, john.garry@huawei.com, linuxarm@huawei.com, salil.mehta@huawei.com, lipeng321@huawei.com, tremyfr@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net 1/3] net: hns: Add TX CSUM check when fill TX description From: David Miller In-Reply-To: <1499165253-184543-2-git-send-email-linyunsheng@huawei.com> References: <1499165253-184543-1-git-send-email-linyunsheng@huawei.com> <1499165253-184543-2-git-send-email-linyunsheng@huawei.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 04 Jul 2017 03:28:40 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Yun Sheng Date: Tue, 4 Jul 2017 18:47:31 +0800 > From: Yunsheng Lin > > 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 > Reviewed-by: Daode Huang > Reviewed-by: Yunsheng Lin 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 this. 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.