Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4693479ooa; Tue, 14 Aug 2018 09:16:10 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyK5uggdP8nBxR3TpZxxyKulGegAlrocJq2CRyukwYM2juIpkqE5CMl2f2Szv4A1SyHRytO X-Received: by 2002:a17:902:4201:: with SMTP id g1-v6mr21162542pld.203.1534263370296; Tue, 14 Aug 2018 09:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534263370; cv=none; d=google.com; s=arc-20160816; b=RdRu9vembsk1aVAjGM2n16pP6AyqnWor2hvmEELYIDfe/iZguLwWgrR1K7h9HIFmAp pm/3qPOVqfXZkiE8lElQNKWG/5sxwr3GWeoLZZez2McKtiK0mNQ9GyCKWX5VK+5jAFpS +l2aBGXZi979SseP11UDflHatDLar/QCcwcMBNPGUByUjOh2A4DPF6840Yu2gQc4WROQ LE+pDhruqWjRQLfV9tBCQ0LwZMwd7/y/j2qprvw8cB5l2/OJhEN/RsZYjjdQ84Xx+nsx CKlbpkaa57TPHK2dMd5k9Z+9wDxRcSp4afWMg8zwOqzQgLV4YUHtltywb+NyfPMW00Mg BSCg== 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 q27-v6si21373201pgk.187.2018.08.14.09.15.55; Tue, 14 Aug 2018 09:16:10 -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 S1733089AbeHNTCP (ORCPT + 99 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 Content-Type: text/plain 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(+) 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 -- 2.7.4