Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933418AbcK1RMu (ORCPT ); Mon, 28 Nov 2016 12:12:50 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:33850 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932669AbcK1RMm (ORCPT ); Mon, 28 Nov 2016 12:12:42 -0500 Date: Mon, 28 Nov 2016 12:12:40 -0500 (EST) Message-Id: <20161128.121240.1321057221950786765.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 net-next] net: hns: Fix to conditionally convey RX checksum flag to stack From: David Miller In-Reply-To: <20161125133240.1264224-1-salil.mehta@huawei.com> References: <20161125133240.1264224-1-salil.mehta@huawei.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / 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]); Mon, 28 Nov 2016 08:13:17 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1318 Lines: 33 From: Salil Mehta Date: Fri, 25 Nov 2016 13:32:40 +0000 > @@ -778,6 +778,35 @@ int hns_ae_get_regs_len(struct hnae_handle *handle) > return total_num; > } > > +static bool hns_ae_is_l3l4_csum_err(struct hnae_handle *handle) > +{ > + struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); > + u32 regval; > + bool retval = false; > + > + /* read PPE_HIS_PRO_ERR register and check for the checksum errors */ > + regval = dsaf_read_dev(ppe_cb, PPE_HIS_PRO_ERR_REG); > + I don't see how a single register can properly provide error status for a ring of pending received packets. No matter how this register is implemented, it is either going to result in packets erroneously being marked as having errors, or error status being lost when multiple packets in a row have such errors. For example, if you receive several packets in a row that have errors, you'll read this register for the first one. If this read clears the error status, which I am guessing it does, then you won't see the error status for the next packet that had one of these errors as well. If you don't have something which is provided on a per-packet basis then you can't determine the error properly. Therefore you will just have to always ignore the checksum if there is any error indicated in the ring descriptor.