Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2967102rwo; Thu, 3 Aug 2023 19:08:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZbHmHOIRDkGi9c2K2jl2UksLuRWGE3PvjJ0eI/+lnSS86CCzIKLZ5LmLz129iegPYsspY X-Received: by 2002:a05:6512:2097:b0:4f8:5ede:d447 with SMTP id t23-20020a056512209700b004f85eded447mr209868lfr.28.1691114929170; Thu, 03 Aug 2023 19:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691114929; cv=none; d=google.com; s=arc-20160816; b=R6kUllumHjL65Kv/VOjj2+Cc4sDnYlBV/NATmF8nqjatkQhQsUS1AfywISlWMEc3j/ 2vh6cpKx0CirFU+u3lCtdfApD7kH1CQOLIQCb8wPkLomqfpFBPRYPpaVdYTfT4bntBRS YbUu4I2k2yKDLQme1V2JQ/46PVsRnCCLtfuG2lRJDVWFL6M/kiLabDyHQqwzZ5CC53Ue JiqbCGgM8/6UQRyxE0CGLWccUGLlMPlOBbgtqL1W2QKPuXScgq8xYrml2JxCfm+lzgCS VRGcrr3hqrQgmJdRi3tw8rB9unNinhuhoHcE/6JtlncPfE7m7SmuU89pmCJpdA0sRL8/ zzlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SObk4UyPh0M7v2ccwf+Ptosqb7xs59Bdm/YVL+OMcdY=; fh=3H3oLXANh5v13tjHxrBYuXblpWbB01kHKe+fQJ1oJi8=; b=dPOjvYUAf3En4RDHh7tKbPjC/Is/cmvCaxcLUajl5aeVfzs67E2EO/o3FEI4DGcvaN ecUkEle4auphFzQPXAZUWYmubwov8FezpMCC7uraKfKrVCd7UYOIzNgcdGMTAIU8m8rr MMUYHgs87JD65AQHWZ2Xs6OskrAr+Rh4rkuFYcSmG7kdCsoO5VffZNwMwDdPNt/eMtVG Lthg/ygv4X7LlGEajKFzRiWMFofaSeyi3djEEycIug666jQBLN9Y95xbBSvx40cQ9umH X2PZ7p82EoeyWAYydHOkNX+dEczr1M3r/vb6xB5lkrdoNLldcU+73s/lsc2iKX4FI/hE F09w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a056402070e00b005227823a722si814897edx.128.2023.08.03.19.08.24; Thu, 03 Aug 2023 19:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjHDB36 (ORCPT + 99 others); Thu, 3 Aug 2023 21:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbjHDB3x (ORCPT ); Thu, 3 Aug 2023 21:29:53 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4EA423E; Thu, 3 Aug 2023 18:29:52 -0700 (PDT) Received: from kwepemi500006.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RH7Np50jqzJrGH; Fri, 4 Aug 2023 09:27:06 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500006.china.huawei.com (7.221.188.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 4 Aug 2023 09:29:50 +0800 From: Junxian Huang To: , CC: , , , Subject: [PATCH for-rc 1/4] RDMA/hns: Fix port active speed Date: Fri, 4 Aug 2023 09:27:08 +0800 Message-ID: <20230804012711.808069-2-huangjunxian6@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230804012711.808069-1-huangjunxian6@hisilicon.com> References: <20230804012711.808069-1-huangjunxian6@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500006.china.huawei.com (7.221.188.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengchang Tang HW supports a variety of different speed, but the current speed is fixed. The real speed should be querried from ethernet. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Signed-off-by: Chengchang Tang Signed-off-by: Junxian Huang --- drivers/infiniband/hw/hns/hns_roce_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 485e110ca433..9141eadf33d2 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -219,6 +219,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num, unsigned long flags; enum ib_mtu mtu; u32 port; + int ret; port = port_num - 1; @@ -231,8 +232,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num, IB_PORT_BOOT_MGMT_SUP; props->max_msg_sz = HNS_ROCE_MAX_MSG_LEN; props->pkey_tbl_len = 1; - props->active_width = IB_WIDTH_4X; - props->active_speed = 1; + ret = ib_get_eth_speed(ib_dev, port_num, &props->active_speed, + &props->active_width); + if (ret) + ibdev_warn(ib_dev, "failed to get speed, ret = %d.\n", ret); spin_lock_irqsave(&hr_dev->iboe.lock, flags); -- 2.30.0