From patchwork Wed Aug 19 05:35:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 262302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B840C433DF for ; Wed, 19 Aug 2020 05:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DD72207D3 for ; Wed, 19 Aug 2020 05:35:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="OQvYlomg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgHSFfX (ORCPT ); Wed, 19 Aug 2020 01:35:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58970 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726410AbgHSFfT (ORCPT ); Wed, 19 Aug 2020 01:35:19 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07J5Wi9q129447; Wed, 19 Aug 2020 01:35:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=O9IIOQ1K6JePfyVHDRPg/tI1B+Vg13ObJD4Fn8XH28w=; b=OQvYlomgeTth7cbQfBdXVs0/iOu9oIcXPP3iL7OwMjP0GoQ1axACRWXhmrfjYyhrMwok Ikqcf+tz4ktxUQDVDOpaRwV0nxqnGXnD8A5ieNdGQHNamNx/IpBsJYstPqeNgL2pdzen 0lk7nB6SjlJiBZdranEUdswUHkfxxLd7kCoIJ22zrvdw8VG31VwG9OXRkhfrfTN/39Y/ w58g5Qnwemiqhj06BFgWfNOmh2pn/n2AGM3ZI6wGYDC36orp/ck7oQeD2StJyds5qqy+ lr8uOHHkBPmLlwyhMjHCR8637ydG83WtuW4K/7667LF0d3cGqd11nwCUJFpN+u6oAszL 2w== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0b-001b2d01.pphosted.com with ESMTP id 3304t29swu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 01:35:15 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07J5UpqG026871; Wed, 19 Aug 2020 05:35:14 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma03wdc.us.ibm.com with ESMTP id 3304ce1kd6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 05:35:14 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07J5ZE1954591932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Aug 2020 05:35:14 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B5FFAC05E; Wed, 19 Aug 2020 05:35:14 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1498CAC05B; Wed, 19 Aug 2020 05:35:14 +0000 (GMT) Received: from pompom.ibm.com (unknown [9.160.104.33]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 19 Aug 2020 05:35:13 +0000 (GMT) From: Lijun Pan To: netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Lijun Pan Subject: [PATCH net-next 3/5] ibmvnic: improve ibmvnic_init and ibmvnic_reset_init Date: Wed, 19 Aug 2020 00:35:10 -0500 Message-Id: <20200819053512.3619-4-ljp@linux.ibm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200819053512.3619-1-ljp@linux.ibm.com> References: <20200819053512.3619-1-ljp@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-19_02:2020-08-18,2020-08-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 suspectscore=1 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008190042 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When H_SEND_CRQ command returns with H_CLOSED, it means the server's CRQ is not ready yet. Instead of resetting immediately, we wait for the server to launch passive init. ibmvnic_init() and ibmvnic_reset_init() should also return the error code from ibmvnic_send_crq_init() call. Signed-off-by: Lijun Pan --- drivers/net/ethernet/ibm/ibmvnic.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 50e86e65961e..e366fd42a8c4 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -3568,8 +3568,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter *adapter, if (rc) { if (rc == H_CLOSED) { dev_warn(dev, "CRQ Queue closed\n"); - if (test_bit(0, &adapter->resetting)) - ibmvnic_reset(adapter, VNIC_RESET_FATAL); + /* do not reset, report the fail, wait for passive init from server */ } dev_warn(dev, "Send error (rc=%d)\n", rc); @@ -4985,7 +4984,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter) reinit_completion(&adapter->init_done); adapter->init_done_rc = 0; - ibmvnic_send_crq_init(adapter); + rc = ibmvnic_send_crq_init(adapter); + if (rc) { + dev_err(dev, "%s: Send crq init failed with error %d\n", __func__, rc); + return rc; + } + if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { dev_err(dev, "Initialization sequence timed out\n"); return -1; @@ -5039,7 +5043,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter) adapter->from_passive_init = false; adapter->init_done_rc = 0; - ibmvnic_send_crq_init(adapter); + rc = ibmvnic_send_crq_init(adapter); + if (rc) { + dev_err(dev, "%s: Send crq init failed with error %d\n", __func__, rc); + return rc; + } + if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { dev_err(dev, "Initialization sequence timed out\n"); return -1;