Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9030943ybi; Tue, 23 Jul 2019 20:23:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH/B/vPS6BscmGSN/yU1DaBLTIQ3MZK91wLAu5I45X4vOuLCr1bLieCdefQ1cVQQnini2F X-Received: by 2002:a17:902:b186:: with SMTP id s6mr83458055plr.343.1563938626610; Tue, 23 Jul 2019 20:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563938626; cv=none; d=google.com; s=arc-20160816; b=tU8orcsOqPR5BDygzbxG+a79OGUWg1vVZq6R8LtG2AQIKDqtIe/zICssFFwesCXf/o VtooN5maHkYJMkz5uEIeMz2q837qSNijqUZawvKWLKbitBSA9XWoOhQicnwZ6o98+MTk 9owrZ/vJxqeuuhm5QsAAlN9kblMbgqQC2deftHfQGEoxAcYIWdq2tqJXERo6yOL/xCUy 9rVmthMBNyCtZig+YbxsNem/R/4U/fTfjcmXteyFdwgLYhqul39lnDKJ2X3tHtYe+TRl 8gdZT6mDBT1zbL3UFAWiNficPoszYn2IyzH8QInaBOwrdYBWvxnvPMnVGpnSarNcLIGc b9cw== 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=PQgWSl0g1rsw5XEzKzFKdrC+o07XPWSuNhLUqZkV+QQ=; b=ziNT4dMaqea9mEUsMEyw1VoQAUoCH8UUbItFtGxodx975ViwuEIwNaEBoBt1I0x1/o xpXiXKiLsQC2ZEAxuQx0sJa6td+8ej3Ehl51jXN0Suypwm8PZIf3T04A+x+udDR54iLn nuSOvWNL9vCuyh/PkwQ88Vcs5kmUtz6R0bh37sZcc0yMh4k5xPh589OayiZpgSlXpen/ ybJ8oOGXZ2ONuwV0T4Qo4VQgtqIBexpJFn2w6sJdO0sRVVjEroyqcMyXrtT1b29GUPWl 7f9zzw4BcIRLHWYul/Ht2aIb8xZclaplqRmxCJv1jln533EIcYetEiEsTUyHlBsQHkZJ RClg== 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 w9si12155902pjv.67.2019.07.23.20.23.31; Tue, 23 Jul 2019 20:23:46 -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 S1726807AbfGXDVx (ORCPT + 99 others); Tue, 23 Jul 2019 23:21:53 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:50500 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725497AbfGXDU4 (ORCPT ); Tue, 23 Jul 2019 23:20:56 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 70F9D67A04EC192DFFC1; Wed, 24 Jul 2019 11:20:52 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Wed, 24 Jul 2019 11:20:43 +0800 From: Huazhong Tan To: CC: , , , , , Yonglong Liu , Peng Li , Huazhong Tan Subject: [PATCH net-next 04/11] net: hns3: fix mis-counting IRQ vector numbers issue Date: Wed, 24 Jul 2019 11:18:40 +0800 Message-ID: <1563938327-9865-5-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563938327-9865-1-git-send-email-tanhuazhong@huawei.com> References: <1563938327-9865-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonglong Liu The num_msi_left means the vector numbers of NIC, but if the PF supported RoCE, it contains the vector numbers of NIC and RoCE(Not expected). This may cause interrupts lost in some case, because of the NIC module used the vector resources which belongs to RoCE. This patch corrects the value of num_msi_left to be equals to the vector numbers of NIC, and adjust the default tqp numbers according to the value of num_msi_left. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Yonglong Liu Signed-off-by: Peng Li Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++++- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 3c64d70..a59d13f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1470,13 +1470,16 @@ static int hclge_vport_setup(struct hclge_vport *vport, u16 num_tqps) { struct hnae3_handle *nic = &vport->nic; struct hclge_dev *hdev = vport->back; + u16 alloc_tqps; int ret; nic->pdev = hdev->pdev; nic->ae_algo = &ae_algo; nic->numa_node_mask = hdev->numa_node_mask; - ret = hclge_knic_setup(vport, num_tqps, + alloc_tqps = min_t(u16, hdev->roce_base_msix_offset - 1, num_tqps); + + ret = hclge_knic_setup(vport, alloc_tqps, hdev->num_tx_desc, hdev->num_rx_desc); if (ret) dev_err(&hdev->pdev->dev, "knic setup failed %d\n", ret); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index a13a0e1..db84782 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -287,6 +287,14 @@ static int hclgevf_get_queue_info(struct hclgevf_dev *hdev) memcpy(&hdev->rss_size_max, &resp_msg[2], sizeof(u16)); memcpy(&hdev->rx_buf_len, &resp_msg[4], sizeof(u16)); + /* if irq is not enough, let tqps have the same value of irqs, + * to make sure one irq just bind to one tqp, this can improve + * the performance + */ + hdev->num_tqps = min_t(u16, hdev->roce_base_msix_offset - 1, + hdev->num_tqps); + hdev->rss_size_max = min_t(u16, hdev->rss_size_max, hdev->num_tqps); + return 0; } @@ -2208,7 +2216,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) int vectors; int i; - if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) + if (hnae3_dev_roce_supported(hdev)) vectors = pci_alloc_irq_vectors(pdev, hdev->roce_base_msix_offset + 1, hdev->num_msi, @@ -2495,7 +2503,7 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) req = (struct hclgevf_query_res_cmd *)desc.data; - if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) { + if (hnae3_dev_roce_supported(hdev)) { hdev->roce_base_msix_offset = hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee), HCLGEVF_MSIX_OFT_ROCEE_M, -- 2.7.4