Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7730998ybi; Thu, 6 Jun 2019 00:11:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmh8uu2wZHhnRw7ulrUo/IGOG63wOC1b0L0yhFZnlpjTzh8D2f8cbaez8NkKjmggrhCjS9 X-Received: by 2002:a62:640e:: with SMTP id y14mr49882307pfb.109.1559805093578; Thu, 06 Jun 2019 00:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559805093; cv=none; d=google.com; s=arc-20160816; b=GThpzBtqxFy8oeN0ql4EWtFTf1YoOe/QvjrRQ6RqwJIqll48bOXwxB5meA1YOG1Xfb smXQMUnn2y4TJkmqVFxA3QQztzrnmfEzt9nCVRUZXkS5Qgdj1hXbOShLuWwr3M2h6DsF 2KpeKM+eWkPtd5mGN5mUY6uIyOSS1zYRWvasIUh4WFrOmhvfHbJrbrRAj5Ynjuxfda0o kxBFb1B29Zc8wYcoZc0LU7T6Ap202TXakTznzjLO5qsCeK1Pf4VIT3OpD8NrMOQKrBhL +mWPQeAby3EcmAYAplNQPeQVbbJLOM6GgQqR8pyaWGYOuiz8mWrN5ngaZBy2MLbJ6I7e 9R8Q== 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=m69FZZN5KYt61dbIldU5rNcOzfekT4rZ48WwQcrhgqg=; b=RpVjM2KeyyfkXF8JX0uPa5z3A603K9yaXvwTZfF6W3egZ8NJrruMfTo2gRQ6B+C4Rt TFRbZKJOT7gn8u7U7yISTiT61o1dFAYTuzw3rmQ+26obbPxC/mFU/K7MW1p6/sktQJck ybquHnFIzv/4sApx0VP5bDEf3jCo4MHnEQeT7rdeKj0uUF6+9mclBZQ5LB5w41CaPHJo HOkQZkKLifTkUE3BCQnefsh8B2IsSvZ3qE27uzedHWtEHRHi4HcuGPUNMeuTg8PUFum4 Z4PTuuWkwqorQ6tBhR1bIzP/KOb7CxRzq+AKinKRF4gAZkI6NN1Gr7yKlOsVrgXzy+T9 ftDw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si1335541pgr.22.2019.06.06.00.11.15; Thu, 06 Jun 2019 00:11:33 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726785AbfFFHJy (ORCPT + 99 others); Thu, 6 Jun 2019 03:09:54 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:30682 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFFHJx (ORCPT ); Thu, 6 Jun 2019 03:09:53 -0400 Received-SPF: SoftFail (esa2.microchip.iphmx.com: domain of kelvin.cao@microchip.com is inclined to not designate 208.19.100.22 as permitted sender) identity=mailfrom; client-ip=208.19.100.22; receiver=esa2.microchip.iphmx.com; envelope-from="kelvin.cao@microchip.com"; x-sender="kelvin.cao@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com a:mx1.microchip.iphmx.com a:mx2.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@smtp.microsemi.com) identity=helo; client-ip=208.19.100.22; receiver=esa2.microchip.iphmx.com; envelope-from="kelvin.cao@microchip.com"; x-sender="postmaster@smtp.microsemi.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=kelvin.cao@microchip.com; spf=None smtp.helo=postmaster@smtp.microsemi.com; dmarc=fail (p=none dis=none) d=microchip.com X-IronPort-AV: E=Sophos;i="5.63,558,1557212400"; d="scan'208";a="36174407" Received: from unknown (HELO smtp.microsemi.com) ([208.19.100.22]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2019 00:09:52 -0700 Received: from AVMBX3.microsemi.net (10.100.34.33) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 6 Jun 2019 00:09:52 -0700 Received: from AVMBX3.microsemi.net (10.100.34.33) by AVMBX3.microsemi.net (10.100.34.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 6 Jun 2019 00:09:51 -0700 Received: from NTB-Peer.microsemi.net (10.188.116.183) by avmbx3.microsemi.net (10.100.34.33) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 6 Jun 2019 00:09:48 -0700 From: Kelvin Cao To: , , , , , , , CC: , Subject: [PATCH 1/3] ntb_hw_switchtec: Remove redundant steps of switchtec_ntb_reinit_peer() function Date: Thu, 6 Jun 2019 15:09:42 +0800 Message-ID: <1559804984-24698-2-git-send-email-kelvin.cao@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559804984-24698-1-git-send-email-kelvin.cao@microchip.com> References: <1559804984-24698-1-git-send-email-kelvin.cao@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joey Zhang When a re-initialization is caused by a link event, the driver will re-setup the shared memory window. But at that time, the shared memory is still valid, and it's unnecessary to free, reallocate and then initialize it again. We only need to reconfigure the hardware registers. Remove the redundant steps from switchtec_ntb_reinit_peer() function. Signed-off-by: Joey Zhang Signed-off-by: Wesley Sheng Reviewed-by: Logan Gunthorpe --- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c index d905d36..947ed0b 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -1457,10 +1457,13 @@ static void switchtec_ntb_deinit_db_msg_irq(struct switchtec_ntb *sndev) static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev) { - dev_info(&sndev->stdev->dev, "peer reinitialized\n"); - switchtec_ntb_deinit_shared_mw(sndev); - switchtec_ntb_init_mw(sndev); - return switchtec_ntb_init_shared_mw(sndev); + int rc; + + dev_info(&sndev->stdev->dev, "reinitialize shared memory window\n"); + rc = config_rsvd_lut_win(sndev, sndev->mmio_peer_ctrl, 0, + sndev->self_partition, + sndev->self_shared_dma); + return rc; } static int switchtec_ntb_add(struct device *dev, -- 2.7.4