Received: by 10.223.185.111 with SMTP id b44csp1005867wrg; Fri, 9 Mar 2018 19:00:47 -0800 (PST) X-Google-Smtp-Source: AG47ELs8hJf5PlU5z1fPP1xih1QmXM5I6yEI3M9eY8vlVF/jarzVmB5vhuFgSf8lQ1cfEm0Eh3p6 X-Received: by 10.99.123.74 with SMTP id k10mr563999pgn.217.1520650847420; Fri, 09 Mar 2018 19:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520650847; cv=none; d=google.com; s=arc-20160816; b=Ytb2Ej/Ptpw8BSOZbhXgQdcIwjWDxi6ZcNFJsS41H+dvlOrTN2C0w1/LJvJIZeLwTR k/IPMhg51co8inJM99veEXc0PqEuk9eZ91T0xChwhs6+JiDQybSaruW8gO1wsTaf7QM3 qz5X7QFnydNxZEX+X09ipE5wFsfXWCenOZrEOUfWvjVWqs2V58M6QgCCuMPbacJhbGsR snb3CQP65S0Hm7DK1QppdyUdvHKsWi4QT0p2PYTytPR502f4TDORygswCeWthTGefdIt Sdg2hjOd2wshrfzmE91PAiySL/3SW0kRKO0+VHCPeVXDIN8TaH8Ncg/JkAI8YmwwaQLP M43g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Ca02DvsskAZ5E0bSm083l4/VwIjneFMT8z4xZMtX/ks=; b=MRP5WtFvatVJBA5DCpBtPJaqweAhRIHQ50nOUuJSAJWx0vsCBN4me2YfekQ5L21OCe n9NDBN2ozJFMDtLVwACbegvkrSXhOuvXYcljktcZEzRAAIiz05tlb1Bu3LcB3arTgZRS P9HBIDPF1nJUvysZA5hmCoD0DbydGSjCLG2SoyES6Zb1sko5H08yHWk9IG07OxWuzHrf Gcmh38ygmB89YM3CStIP/lfPiAytVIkewmg2DjBZxxLKdthna/NDkqp7z/Vf2aCzYOmF oHYMBpfqN2qyr8i1kwijdAS1IS5jmgZnW5JeCRx3yKspl6lyoCtoUmquSLDTecNoh9vR CS2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si419892pll.400.2018.03.09.19.00.33; Fri, 09 Mar 2018 19:00:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932788AbeCJC5j (ORCPT + 99 others); Fri, 9 Mar 2018 21:57:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6221 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751371AbeCJC5f (ORCPT ); Fri, 9 Mar 2018 21:57:35 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 772F7265D90A3; Sat, 10 Mar 2018 10:57:21 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Sat, 10 Mar 2018 10:57:16 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 05/12] net: hns3: fix rx path skb->truesize reporting bug Date: Sat, 10 Mar 2018 11:29:26 +0800 Message-ID: <1520652573-75644-6-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> References: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Original skb->truesize reports the received packet size, not the actual buffer size NIC driver allocated(1 Page). The linux net protocol will misjudge the true size of rx queue. Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4dba974..94f0b92 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2080,15 +2080,13 @@ static void hns3_nic_reuse_page(struct sk_buff *skb, int i, desc = &ring->desc[ring->next_to_clean]; size = le16_to_cpu(desc->rx.size); - if (twobufs) { - truesize = hnae_buf_size(ring); - } else { - truesize = ALIGN(size, L1_CACHE_BYTES); + truesize = hnae_buf_size(ring); + + if (!twobufs) last_offset = hnae_page_size(ring) - hnae_buf_size(ring); - } skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len, - size - pull_len, truesize - pull_len); + size - pull_len, truesize); /* Avoid re-using remote pages,flag default unreuse */ if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id())) -- 2.9.3