Received: by 10.223.185.116 with SMTP id b49csp5788374wrg; Wed, 7 Mar 2018 18:42:12 -0800 (PST) X-Google-Smtp-Source: AG47ELu6MLF/YzLrNWTiqgNDdXzW6Ttl440MqXn9Xd8CskY89T35tgxZxXpg3Yo8YMrwUi/uyy5y X-Received: by 2002:a17:902:5906:: with SMTP id o6-v6mr21592658pli.60.1520476931970; Wed, 07 Mar 2018 18:42:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520476931; cv=none; d=google.com; s=arc-20160816; b=BG1rfu4Tryh7gN9BZ5MUFo0/nC3eGnnbsYh1jVpqyc9YyE6R2UWl6uLRCUqxL0sNnF qRW51E072hjUqI2vLqqbONVBHuiZWim0itja5FOu+PmiqNCUK83eyeLGqa989U2yFfNa 5jhPZaH02ELQ4VY0qN0LRr1tIvP7hP1nx5XRnTJVA4O4XEmRKQFso6mBkHRmLV22doce rTikGPgSKCupF1jeEazroa769O6r3vYRucv8SZl/xCH5DGAdGo3EYB39Um5ON+rQ7oB4 WhO29PTgx0Sx7/sLdu7pXJ0zHi/VdDA8/n7iStDQrcKqBpLYpppbHSu1JMHaP5JCw7/F XKIQ== 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=57YwvAoyZoG+3Pvs+IKdUkZMHHQK0b7lZHrF5umfwMs=; b=yW8reO5QTTNTaNVdcDq4NXE3iWxCR3mTISW02WRtBuCWl4sJSwZfaSRNqeEmx/JVWz qO0Gtk6uvhAcKTT3QxHUeGEAI+GrQB8RnHPDSsNzI0O8NPXd7jHbBZcmEnR1lL6bDtzj c0FAT6G4cThsjJl6m7Ypa4IbQ8w4Gx0s/vbBfj7HyJRrFbAfd6pxAoS1ehrzDMx0cpwN iTBRkGY39jdl0O4G1EJ/lQgPhu/CoT8Ekue1WZkPmpkPSLoheOpNZAkn1XtC2XTOYhYb 0d2RV7awGVjfQwCrcmqdxuPOcQ3CURRHPArlAAeEx3f3AjnWC8+yPEi87ElZ9wIObRNY B/iw== 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 v62si12814188pfi.156.2018.03.07.18.41.57; Wed, 07 Mar 2018 18:42:11 -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 S934995AbeCHCkA (ORCPT + 99 others); Wed, 7 Mar 2018 21:40:00 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5754 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934814AbeCHCfA (ORCPT ); Wed, 7 Mar 2018 21:35:00 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1813FD1E9845; Thu, 8 Mar 2018 10:34:44 +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; Thu, 8 Mar 2018 10:34:38 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 08/23] {topost} net: hns3: fix rx path skb->truesize reporting bug Date: Thu, 8 Mar 2018 11:06:33 +0800 Message-ID: <1520478408-116992-9-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520478408-116992-1-git-send-email-lipeng321@huawei.com> References: <1520478408-116992-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 83f4b36..f50245d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2064,15 +2064,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