Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751498AbcLCUJJ (ORCPT ); Sat, 3 Dec 2016 15:09:09 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:36582 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbcLCUJH (ORCPT ); Sat, 3 Dec 2016 15:09:07 -0500 Date: Sat, 03 Dec 2016 15:09:05 -0500 (EST) Message-Id: <20161203.150905.739546865468666597.davem@davemloft.net> To: salil.mehta@huawei.com Cc: yisen.zhuang@huawei.com, mehta.salil.lnk@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com Subject: Re: [PATCH V2 net-next] net: hns: Fix to conditionally convey RX checksum flag to stack From: David Miller In-Reply-To: References: <20161129130945.919372-1-salil.mehta@huawei.com> <20161130.142539.1927956259851457047.davem@davemloft.net> X-Mailer: Mew version 6.7 on Emacs 25.1 / 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]); Sat, 03 Dec 2016 11:09:43 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 855 Lines: 31 From: Salil Mehta Date: Thu, 1 Dec 2016 12:09:22 +0000 > But maybe now since we don't have any method to de-multiplex the kind of > checksum error (cannot depend upon register) we can have below code > re-arrangement: > > hns_nic_rx_checksum() { > /* check supported L3 protocol */ > if (l3 != IPV4 && l3 != IPV6) > return; > /* check if L3 protocols error */ > if (l3e) > return; > > /* check if the packets are fragmented */ > If (l3frags) > Return; > > /* check supported L4 protocol */ > if (l4 != UDP && l4 != TCP && l4 != SCTP) > return; > /* check if any L4 protocol error */ > if (l3e) > return; > > /* packet with valid checksum - covey to stack */ > skb->ip_summed = CHECKSUM_UNNECESSARY > } This looks a lot cleaner and easier to understand.