Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp629549ybh; Tue, 21 Jul 2020 04:10:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzekzj6B/qGDmYpAYz3SKjUQUygKvUndYmxSKWi4sBD6m9lTGy4p10kY4j8Z1OPuqNaazJ5 X-Received: by 2002:a17:906:5246:: with SMTP id y6mr24187998ejm.316.1595329816713; Tue, 21 Jul 2020 04:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595329816; cv=none; d=google.com; s=arc-20160816; b=N/gP01371Hk+YRIYSsl6iDzPY/s0g1CVi+XJEIIWzVLXeAZ46EnVpmH28IMwV9vTr2 bWp3jHrmeTZkQsaTsVP+8lotsqaax9HTF6oL2G8YbNwG2oq7LXVQ3e0NhEwTBl10xH2/ evicTdpCiN9LaZu+PDHQ2l8DUB7CfMgb3NVi6OyOkb4jyl975nDoM/z2mzC47iz/uBHD FhQRRogMZ2GPKFWIXOXZlmOrKwFqSgjafbq3HEo5ChxL+8B6d5Hxl1VouGekiQOKSSzN VfwxU4mbNS7ZQPmFLnUPW4uwAwKUknQzDBourPtKH33un627ht9bZOutiT4twGphmvEV XeLg== 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; bh=sREHLnR0WbCBnqByYEKnfoNuxWIkeYdmcoDwL4Z/1Ig=; b=irvGotwDJRGN/T6wc+tJ+k1E+qcYfcMLdoQLVDZNIKqNZIP9j87PcWH+oP1nq4fdc7 MSWoe3t5E41Np3JymG2M72X/+X73mkLf4gmUWkOcj0qMVHZWKejf8Kya2L+yEy+U04Ac SrLpkYsbDcdlVrtQuoWpiQplyDy71iKU5U927gr1oZmBOieLUCU3UhSPqED45ltqOIw+ Rabj52ciW863X3fJSVLxonD0pzyERKPO9ihgvKH+G88ZvdWOwVUgSDG82ym2mY20XLrN 6JcBBfLQVaPHtKsgJS0AJ7hg0oLVkfcDfI7EmTocg/4U6Tf9p+CepA+tlqMX0/7A48Ue uomg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si11848741edn.299.2020.07.21.04.09.53; Tue, 21 Jul 2020 04:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729572AbgGULHY (ORCPT + 99 others); Tue, 21 Jul 2020 07:07:24 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7807 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727940AbgGULHF (ORCPT ); Tue, 21 Jul 2020 07:07:05 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2B62AE29E8F847C15CE8; Tue, 21 Jul 2020 19:07:02 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 21 Jul 2020 19:06:55 +0800 From: Huazhong Tan To: CC: , , , , , , Yunsheng Lin , Huzhong Tan Subject: [PATCH net 1/4] net: hns3: fix for not unmapping TX buffer correctly Date: Tue, 21 Jul 2020 19:03:51 +0800 Message-ID: <1595329434-46766-2-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595329434-46766-1-git-send-email-tanhuazhong@huawei.com> References: <1595329434-46766-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin When a big TX buffer is sent using multi BD, the driver maps the whole TX buffer, and unmaps it using info in desc_cb corresponding to each BD, but only the info in the desc_cb of first BD is correct, other info in desc_cb is wrong, which causes TX unmapping problem when SMMU is on. Only set the mapping and freeing info in the desc_cb of first BD to fix this problem, because the TX buffer only need to be unmapped and freed once. Fixes: 1e8a7977d09f("net: hns3: add handling for big TX fragment") Signed-off-by: Yunsheng Lin Signed-off-by: Huzhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index fe7d57ae..18f7623 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1118,12 +1118,12 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, return -ENOMEM; } + desc_cb->priv = priv; desc_cb->length = size; + desc_cb->dma = dma; + desc_cb->type = type; if (likely(size <= HNS3_MAX_BD_SIZE)) { - desc_cb->priv = priv; - desc_cb->dma = dma; - desc_cb->type = type; desc->addr = cpu_to_le64(dma); desc->tx.send_size = cpu_to_le16(size); desc->tx.bdtp_fe_sc_vld_ra_ri = @@ -1140,13 +1140,6 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, /* When frag size is bigger than hardware limit, split this frag */ for (k = 0; k < frag_buf_num; k++) { - /* The txbd's baseinfo of DESC_TYPE_PAGE & DESC_TYPE_SKB */ - desc_cb->priv = priv; - desc_cb->dma = dma + HNS3_MAX_BD_SIZE * k; - desc_cb->type = ((type == DESC_TYPE_FRAGLIST_SKB || - type == DESC_TYPE_SKB) && !k) ? - type : DESC_TYPE_PAGE; - /* now, fill the descriptor */ desc->addr = cpu_to_le64(dma + HNS3_MAX_BD_SIZE * k); desc->tx.send_size = cpu_to_le16((k == frag_buf_num - 1) ? @@ -1158,7 +1151,6 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, /* move ring pointer to next */ ring_ptr_move_fw(ring, next_to_use); - desc_cb = &ring->desc_cb[ring->next_to_use]; desc = &ring->desc[ring->next_to_use]; } -- 2.7.4