From patchwork Tue Aug 14 16:13:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 144193 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4551234ljj; Tue, 14 Aug 2018 09:14:30 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy9L8hu1jKOgNtk+3u/g+366HxCffM6eMcUd/IVGsVBVvghIKsQbxLdCgYa/updSITKOCvT X-Received: by 2002:a17:902:542:: with SMTP id 60-v6mr21539287plf.122.1534263270725; Tue, 14 Aug 2018 09:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534263270; cv=none; d=google.com; s=arc-20160816; b=uk/f1ipUtI7KgvcBCW75So+9dOv7FJKt3/eZUtGGwmvoLy4afCZwIbSvmuFaorq5KD qcUzDzA+YSXLsejEJZeCFRxpkIeeggTZOkQZhxxRu2B4nbiZOGBHajODjnmpJoYmugWO HsAWCdgP/Qhw6U+oLp9oc/+LipNgpPeo6q0yGM4XGWw+hhS5yrGFQVqaMFXuJkDO1kxs 6H2VZkhmeIbBeGGpiNtOqrxV5xj2sm5hRNMUcbqjEKc/VLSUDuqCLOSvyvQuRwhVfsz9 POgz1cz47x8a+VPlpQAx3glTFC/riSCzIpMaN7/InZ6pg7O9lcCFsd+CZlZGcbdUx6Gf B8wQ== 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=tUrSBJ/MNhV+Z152Dg5h6NY2XjOxCcvhAf6zTsv4lgQ=; b=yfC64AofP58vTwCBS/Wwqv5i6JHh1zj0HyhfMgmntBhiWwbFmNR6AXiK/d8FNCc5WU VP5RVdhXmuUhjV09fR+N3pvDwSwCLZtcKl68VcdrQTfWufUYwWiptr0zOQr5HrvmIIHz aS5I6X6tCTvmbwbIUKaYUmm1RRmCFaUXcZOOLOEZCjrfDRu/fOgK5m6Z1gaCpRRSGPUf 9gBvfThzrWEkWeHtCLlVWjFcKNcH0W8YtDgjGCWChQm21OAa+bNu01uTE/ffO0cD+Hoa +pxR4E991wUwyXTzEMwOuEancTxeGURPAw8L68WTMIomsc+B9zngJ08VBxi5ld2gAm9t oNOg== 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 g6-v6si11359553plm.181.2018.08.14.09.14.30; Tue, 14 Aug 2018 09:14:30 -0700 (PDT) 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 S1733092AbeHNTCP (ORCPT + 32 others); Tue, 14 Aug 2018 15:02:15 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10724 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733022AbeHNTCO (ORCPT ); Tue, 14 Aug 2018 15:02:14 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 96B853A3FCE82; Wed, 15 Aug 2018 00:14:21 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Wed, 15 Aug 2018 00:14:16 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH V2 net-next 7/8] net: hns3: Set tx ring' tc info when netdev is up Date: Tue, 14 Aug 2018 17:13:18 +0100 Message-ID: <20180814161319.16392-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180814161319.16392-1-salil.mehta@huawei.com> References: <20180814161319.16392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 The HNS3_RING_TX_RING_TC_REG register is used to map tx ring to specific tc, the tx queue to tc mapping is needed by the hardware to do the correct tx schedule. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 24 ++++++++++++++++++++++++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 1 + 2 files changed, 25 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b7b9ee3..b28c7e1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2974,6 +2974,28 @@ static void hns3_init_ring_hw(struct hns3_enet_ring *ring) } } +static void hns3_init_tx_ring_tc(struct hns3_nic_priv *priv) +{ + struct hnae3_knic_private_info *kinfo = &priv->ae_handle->kinfo; + int i; + + for (i = 0; i < HNAE3_MAX_TC; i++) { + struct hnae3_tc_info *tc_info = &kinfo->tc_info[i]; + int j; + + if (!tc_info->enable) + continue; + + for (j = 0; j < tc_info->tqp_count; j++) { + struct hnae3_queue *q; + + q = priv->ring_data[tc_info->tqp_offset + j].ring->tqp; + hns3_write_dev(q, HNS3_RING_TX_RING_TC_REG, + tc_info->tc); + } + } +} + int hns3_init_all_ring(struct hns3_nic_priv *priv) { struct hnae3_handle *h = priv->ae_handle; @@ -3385,6 +3407,8 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) rx_ring->next_to_use = 0; } + hns3_init_tx_ring_tc(priv); + return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 0f071a0..a02a96a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -37,6 +37,7 @@ enum hns3_nic_state { #define HNS3_RING_TX_RING_BASEADDR_L_REG 0x00040 #define HNS3_RING_TX_RING_BASEADDR_H_REG 0x00044 #define HNS3_RING_TX_RING_BD_NUM_REG 0x00048 +#define HNS3_RING_TX_RING_TC_REG 0x00050 #define HNS3_RING_TX_RING_TAIL_REG 0x00058 #define HNS3_RING_TX_RING_HEAD_REG 0x0005C #define HNS3_RING_TX_RING_FBDNUM_REG 0x00060