From patchwork Fri Aug 4 01:27:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Huang X-Patchwork-Id: 130905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1523066vqx; Thu, 3 Aug 2023 19:02:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxIEcVnEo5NAE/FrLwT8vqD7iqJhF4ZNry2JFpHZL6C/IovlE9bCoWOE6yVAksfJhB/SnZ X-Received: by 2002:a92:d944:0:b0:349:3c78:fd14 with SMTP id l4-20020a92d944000000b003493c78fd14mr5948490ilq.1.1691114520022; Thu, 03 Aug 2023 19:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691114519; cv=none; d=google.com; s=arc-20160816; b=z+r+GX+nGIa2Cb5ttlulMBvlpbdmhGpevO8J8Js09rHs+LVBAkidFGzt3f3NGR/MEv fPTnJjayir/vBuredhif2jTK1/jROpHG6Mz96VvQ6d+1wfwQNXFw9HRX7PdsAaWWgKIk FGQjlDOuauc2S79wqsRVmnk33R7AaHMG6rur8WsBlFbYGqE9eJUS8FNm+0mUfjI1HS75 OABUOE5nzc9AB+zSS3atPGeGH/CI5oTiokdCKR4wNrvA9OxcO4uufSxViSOSU/bvIyjB 4M5qSBZwDhxSCtXo3vHPyoK8253PxryMrIfRnSL8zmLGyC822SlPZVaubmoQREYU3GHy 3I3w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj10-20020a17090b4d8a00b00263d1729212si4513311pjb.85.2023.08.03.19.01.46; Thu, 03 Aug 2023 19:01:59 -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 S232226AbjHDB36 (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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773262098709951565 X-GMAIL-MSGID: 1773262098709951565 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);