From patchwork Mon Apr 22 14:42:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Sheng X-Patchwork-Id: 10910725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB8F01515 for ; Mon, 22 Apr 2019 06:44:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4F8D285FD for ; Mon, 22 Apr 2019 06:44:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A594928606; Mon, 22 Apr 2019 06:44:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=2.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38819285FD for ; Mon, 22 Apr 2019 06:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbfDVGoB (ORCPT ); Mon, 22 Apr 2019 02:44:01 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:37736 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726190AbfDVGoB (ORCPT ); Mon, 22 Apr 2019 02:44:01 -0400 X-IronPort-AV: E=Sophos;i="5.60,380,1549954800"; d="scan'208";a="31972696" Received: from unknown (HELO smtp.microsemi.com) ([208.19.99.222]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Apr 2019 23:43:59 -0700 Received: from AUSMBX3.microsemi.net (10.201.34.33) by AUSMBX2.microsemi.net (10.201.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 22 Apr 2019 01:43:59 -0500 Received: from AUSMBX3.microsemi.net (10.201.34.33) by AUSMBX3.microsemi.net (10.201.34.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 22 Apr 2019 01:43:58 -0500 Received: from server1.microsemi.net (10.188.116.203) by ausmbx3.microsemi.net (10.201.34.33) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 22 Apr 2019 01:43:55 -0500 From: Wesley Sheng To: , , , , , , , CC: , , Subject: [PATCH 0/3] Redundant steps removal and bug fix of ntb_hw_switchtec Date: Mon, 22 Apr 2019 22:42:55 +0800 Message-ID: <1555944178-1957-1-git-send-email-wesley.sheng@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Everyone, This patch series remove redundant steps and fix one bug of the ntb_hw_switchtec module. When a re-initialization is caused by a link event, the driver will re-setup the shared memory windows. But at that time, the shared memory is still valid, and it's unnecessary to free, reallocate and then initialize it again. Remove these redundant steps. In case of NTB crosslink topology, the setting of shared memory window in the virtual partition doesn't reset on peer's reboot. So skip the re-setup of shared memory window for that case. Switchtec does not support setting multiple MWs simultaneously. However, there's a race condition when a re-initialization is caused by a link event, the driver will re-setup the shared memory window asynchronously and this races with the client setting up its memory windows on the link up event. Fix this by ensure do the entire initialization in a work queue and signal the client once it's done. Regard, Wesley --- Changed since v1: - It's a resend of v1 -- Joey Zhang (2): ntb_hw_switchtec: Remove redundant steps of switchtec_ntb_reinit_peer() function ntb_hw_switchtec: Fix setup MW with failure bug Wesley Sheng (1): ntb_hw_switchtec: Skip unnecessary re-setup of shared memory window for crosslink case drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 80 +++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 31 deletions(-)