From patchwork Fri May 25 18:43:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136981 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3943611lji; Fri, 25 May 2018 11:45:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZptphk1vWH00yzaAChVj+WRjKz3knhtUERK0CjyKG87biSUcZoVdOT2e3GcI07KKls8wCvN X-Received: by 2002:a62:d11d:: with SMTP id z29-v6mr3650752pfg.246.1527273919518; Fri, 25 May 2018 11:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527273919; cv=none; d=google.com; s=arc-20160816; b=hraMtYfH8K56OWYXMY/MHb4JiWg+yk+5r4+CanLNiaNnnMOp1rywuPuUgab5gwPgZ0 fK04iI7Zt7SHrYRy5ByZPNFEcnM5HsJ8SBaUXfSXSMmsJCGjcpLCiWKv5nMWwsSQb/S2 JWS6olxd7O9zaI9pGBJLX2eeDCDBPgMvMVxs6Atq1y6Cua+XAIr5uU7tQF0ILC2sDGMk A6E4ecMjuWL8uDDiNKR34TekpMtec0M9LCdooLS14ZGN+uozbtvKbVmPnVf7/cOyo9K6 wxxRSfCUXec6fUHm5OGYfpa0FOV+/3aYocA78bH1e47S1jb9Mn11DcV7577vTGAlcsqh i9ww== 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=aUmy2vCjOCsf+MDjP4N+6cii8gAxxzYxq3cuzJwO8Tw=; b=aehjMTvSYbsdc3YLNw+tXI7PBpYw1kz160+HMeRT2sOlV5g7wOq927hhVxwerFKp2p xqTbQ8UvhRttPsBCFaC/Xx1P00uyXAXXowEKBb4v89h0/gfUe6sbWfZLtc7v7UzjWYfv +prkH4LVwU8Hq9vJMJmWbqJO4cKKs/anXcRNAVHZjtLFNNvxiWjp9fj/2OcZUPt88DYp 4z3ppmuSdnDDfmsVistN7jQ9OfRPRn6azwNQVIaZ0a/WoatlWFZpMHaqS6OCIIsSnrDM hrER+SAEMnVdnVlzJUZYKfUJfs0ya9IfyX3FQGjvZbtxn2GaqVNGluI/L3MY897XrvYL aFzg== 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 p2-v6si2101279pls.551.2018.05.25.11.45.19; Fri, 25 May 2018 11:45:19 -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 S968211AbeEYSpR (ORCPT + 30 others); Fri, 25 May 2018 14:45:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8144 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S968166AbeEYSpO (ORCPT ); Fri, 25 May 2018 14:45:14 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 567E0D52F7DD1; Sat, 26 May 2018 02:45:01 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Sat, 26 May 2018 02:44:57 +0800 From: Salil Mehta To: CC: , , , , , , , Lijun Ou , Zhou Wang Subject: [PATCH net-next 12/12] net: hns3: Fixes initalization of RoCE handle and makes it conditional Date: Fri, 25 May 2018 19:43:07 +0100 Message-ID: <20180525184307.36288-13-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180525184307.36288-1-salil.mehta@huawei.com> References: <20180525184307.36288-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lijun Ou When register a RoCE client with hnae3vf device, it needs to judge the device whether support RoCE vf function. Otherwise, it will lead to calltrace when RoCE is not support vf function and remove roce device. The calltrace as follows: [ 93.156614] Unable to handle kernel NULL pointer dereference at virtual address 00000015 [ 93.278784] Call trace: [ 93.278788] hnae3_match_n_instantiate+0x24/0xd8 [hnae3] [ 93.278790] hnae3_register_client+0xcc/0x150 [hnae3] [ 93.278801] hns_roce_hw_v2_init+0x18/0x1000 [hns_roce_hw_v2] [ 93.278805] do_one_initcall+0x58/0x160 [ 93.278807] do_init_module+0x64/0x1d8 [ 93.278809] load_module+0x135c/0x15c8 [ 93.278811] SyS_finit_module+0x100/0x118 [ 93.278816] __sys_trace_return+0x0/0x4 [ 93.278827] Code: aa0003f5 12001c56 aa1e03e0 d503201f (b9402660) Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Reported-by: Xinwei Kong Reported-by: Zhou Wang Signed-off-by: Lijun Ou Signed-off-by: Zhou Wang Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 2b0e329..266cdcb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1500,10 +1500,12 @@ static int hclgevf_init_instance(struct hclgevf_dev *hdev, return ret; break; case HNAE3_CLIENT_ROCE: - hdev->roce_client = client; - hdev->roce.client = client; + if (hnae3_dev_roce_supported(hdev)) { + hdev->roce_client = client; + hdev->roce.client = client; + } - if (hdev->roce_client && hnae3_dev_roce_supported(hdev)) { + if (hdev->roce_client && hdev->nic_client) { ret = hclgevf_init_roce_base_info(hdev); if (ret) return ret;