From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED15FA0555 for ; Thu, 9 Jun 2022 13:38:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF18240689; Thu, 9 Jun 2022 13:38:06 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id AE0D7427EC for ; Thu, 9 Jun 2022 13:38:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654774684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sikc7DVc7Aawq85NYmCT9gpB0aIpZAfnxmEutJXi75c=; b=XwUiE/1SWymk2MUa7Pw7VhDt+lsMQidCfDCiy7dRgH76ljr3pz44Ya2oLa8I7s1FYS14H/ r2Fu97yhSwCxaRXEyUVRop7FmdKD93NuKbED7fqUEBH+uQr/B9IAj0miSrYUK1EJW0RaoC vluHdyQmg9srHlXwy4lmt06tQ7LbJXE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-7zhQthG6OHqGsTU0WM6C7Q-1; Thu, 09 Jun 2022 07:38:03 -0400 X-MC-Unique: 7zhQthG6OHqGsTU0WM6C7Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F147D294EDD6; Thu, 9 Jun 2022 11:38:02 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F42518EA3; Thu, 9 Jun 2022 11:38:02 +0000 (UTC) From: Kevin Traynor To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/ngbe: fix PCIe related operations with bus API' has been queued to stable release 21.11.2 Date: Thu, 9 Jun 2022 12:36:25 +0100 Message-Id: <20220609113701.386938-38-ktraynor@redhat.com> In-Reply-To: <20220609113701.386938-1-ktraynor@redhat.com> References: <20220609113701.386938-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/13/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/ff15e8fab98e51eab2a1b59c3560052c745a0d73 Thanks. Kevin --- >From ff15e8fab98e51eab2a1b59c3560052c745a0d73 Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Mon, 30 May 2022 17:30:13 +0800 Subject: [PATCH] net/ngbe: fix PCIe related operations with bus API [ upstream commit 0aeb133c585fd6809cf7acb6a5dc4c54392ac575 ] When using mailbox to request firmware to enable or disable PCIe bus master, there is a small probability that mailbox cannot respond. Change to use rte_pci_read_config() and rte_pci_write_config(), to avoid this problem. Fixes: ac6c5e9af56a ("net/ngbe: fix Tx hang on queue disable") Signed-off-by: Jiawen Wu --- drivers/net/ngbe/base/ngbe_hw.c | 25 +++++++++++++++++++------ drivers/net/ngbe/base/ngbe_osdep.h | 4 ++++ drivers/net/ngbe/ngbe_ethdev.c | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/ngbe/base/ngbe_hw.c b/drivers/net/ngbe/base/ngbe_hw.c index c462fec9f9..08a7e02943 100644 --- a/drivers/net/ngbe/base/ngbe_hw.c +++ b/drivers/net/ngbe/base/ngbe_hw.c @@ -1060,15 +1060,28 @@ out: s32 ngbe_set_pcie_master(struct ngbe_hw *hw, bool enable) { + struct rte_pci_device *pci_dev = (struct rte_pci_device *)hw->back; s32 status = 0; - u16 addr = 0x04; - u32 data, i; + s32 ret = 0; + u32 i; + u16 reg; + + ret = rte_pci_read_config(pci_dev, ®, + sizeof(reg), PCI_COMMAND); + if (ret != sizeof(reg)) { + DEBUGOUT("Cannot read command from PCI config space!\n"); + return -1; + } - ngbe_hic_pcie_read(hw, addr, &data, 4); if (enable) - data |= 0x04; + reg |= PCI_COMMAND_MASTER; else - data &= ~0x04; + reg &= ~PCI_COMMAND_MASTER; - ngbe_hic_pcie_write(hw, addr, &data, 4); + ret = rte_pci_write_config(pci_dev, ®, + sizeof(reg), PCI_COMMAND); + if (ret != sizeof(reg)) { + DEBUGOUT("Cannot write command to PCI config space!\n"); + return -1; + } if (enable) diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h index b62d793191..bf1fa30312 100644 --- a/drivers/net/ngbe/base/ngbe_osdep.h +++ b/drivers/net/ngbe/base/ngbe_osdep.h @@ -20,4 +20,5 @@ #include #include +#include #include "../ngbe_logs.h" @@ -181,3 +182,6 @@ static inline u64 REVERT_BIT_MASK64(u64 mask) #define ETH_P_8021AD 0x88A8 +#define PCI_COMMAND 0x04 +#define PCI_COMMAND_MASTER 0x4 + #endif /* _NGBE_OS_H_ */ diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index af8d6911d1..ccb45ab92c 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -356,4 +356,5 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) /* Vendor and Device ID need to be set before init of shared code */ + hw->back = pci_dev; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-09 12:34:30.669599827 +0100 +++ 0038-net-ngbe-fix-PCIe-related-operations-with-bus-API.patch 2022-06-09 12:34:29.746980642 +0100 @@ -1 +1 @@ -From 0aeb133c585fd6809cf7acb6a5dc4c54392ac575 Mon Sep 17 00:00:00 2001 +From ff15e8fab98e51eab2a1b59c3560052c745a0d73 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0aeb133c585fd6809cf7acb6a5dc4c54392ac575 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 050649e0a6..facc1d9e82 100644 +index c462fec9f9..08a7e02943 100644 @@ -25 +26 @@ -@@ -1059,15 +1059,28 @@ out: +@@ -1060,15 +1060,28 @@ out: @@ -78 +79 @@ -index 9df9f824a1..5ac1c27a58 100644 +index af8d6911d1..ccb45ab92c 100644 @@ -81 +82 @@ -@@ -357,4 +357,5 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -356,4 +356,5 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)