From patchwork Mon Jul 29 14:58:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Thompson X-Patchwork-Id: 1966093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WXhMc0Yk2z20FY for ; Tue, 30 Jul 2024 00:59:07 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sYRq2-00056t-1o; Mon, 29 Jul 2024 14:59:02 +0000 Received: from mail-dm6nam10on2064.outbound.protection.outlook.com ([40.107.93.64] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sYRq0-00054o-2m for kernel-team@lists.ubuntu.com; Mon, 29 Jul 2024 14:59:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xSzhhV+EHhwLCZsDo/Bkze8CK9AFg3Z/r882AtXGadknm7w0DpxPaGaIGjMZ/cMpVfdpgSdmMSrd/APmxWw0noNnfW/XUdvtjbAcoVN4o8WedOItLXqNax8azVG7HX73Wv+eXuBfWSrNBEHfExtdQ7kYZ0CllZ8zEfkxQiXMBSF6bUtLH9r59s0VSD1VdXby0eyrl8aqp5A4+OjWeQ1/2stpi8PK1oa0nepQVRdbkfZZZBy+LqGxnFhdDN+cF5fGPIl1hgsevTT5RhdtLguV7pdOtvkuTwi42F9Z/Xrr7Qht3kfZP0qk1HBsE6hlPIGRrI9Ao6RtzZGLkM9eS/9bzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WDAUvEwD29MLRhQ4UhxQhzbUzoSdzPwoMx0w9YgMOaI=; b=Ez2kwYp3SNDU5jAbXJGLImvZLpMRcyWtjlfvE9AA8bB7wd1FniMFrb5zaPLH9C1uiVfl/td+hFBtXqImiIBvso+pUr4msT96jEATeeqy7e1NGXw73v/hOm+Gn1Ku5iLIiiYj/WZJgT3j+YLIO4UvZuyF9PXdggq7324AV5ZPHgiQtVN7UtNYMtNCi+IJSEYqSAueXn9uQkB1WPaKVrW9Qfh66YtzqAz6KSsSEQMr97cKlR7Yb/4kWAn6kMRt5uCuf1mW/wAb9gFQnhOlP+Q+zY7gLkB8zqHyJ4EEmmT4QBm9rWPrp0jsdyruSmm6Tz7hl8B0QHe7WvkIsAM/CsDwvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) Received: from DM6PR01CA0012.prod.exchangelabs.com (2603:10b6:5:296::17) by PH8PR12MB6819.namprd12.prod.outlook.com (2603:10b6:510:1ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.26; Mon, 29 Jul 2024 14:58:55 +0000 Received: from DS3PEPF0000C37F.namprd04.prod.outlook.com (2603:10b6:5:296:cafe::f2) by DM6PR01CA0012.outlook.office365.com (2603:10b6:5:296::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.35 via Frontend Transport; Mon, 29 Jul 2024 14:58:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF0000C37F.mail.protection.outlook.com (10.167.23.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.19 via Frontend Transport; Mon, 29 Jul 2024 14:58:54 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 29 Jul 2024 07:58:40 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 29 Jul 2024 07:58:40 -0700 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 29 Jul 2024 07:58:39 -0700 From: David Thompson To: Subject: [SRU][J:linux-bluefield][PATCH v1 1/1] UBUNTU: SAUCE: mlxbf_gige: disable RX filters until RX path initialized Date: Mon, 29 Jul 2024 10:58:28 -0400 Message-ID: <86809091466aae89a77909a920b05c972cfcbfc0.1722264272.git.davthompson@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37F:EE_|PH8PR12MB6819:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dbffe0f-8120-4a4b-eb71-08dcafdef77c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: MOh1D+x5pLRwQ8lSw1D2rMPm+u8J8/6rbHZLuI2y9MAhI8IoaHQ6cYz4U39m+0+lXmQC2E3nHlprGe43uUTo1Yc2ik0f0wzw0QLArmptvgMDIg0f7GlXmKB7md0px7tNhL8jD57C4w8wgO0uDOBYu5gLFiGwAsCPDrUm5dJcFyIR7pHqP2Qk26cEYs67RrScY2I1j9EbmuqkrNnMtCRv9enjQE+6bfxLqvzNYVVx2mv5jDLPJtd1tZY+spp+e84QqEKsOg1sfofRi2X2Fw/tU3MSrUNk/rLfhgiS7Ef45iSE09dF2l/n3xjqTbP+Xbx8e/rPRkEwZIi8FQFBTUPEosk6I2OQ2l20W7Rf47q+V3+b3T8ofZiHVj5yQQFKIGa0Y3vY2qdyrjxIYhdqZ3TttqMmwFkpGGOQE/Cfh3lg3NthJT1ryOP5ckkeHbQQ7qW+Izuy7vOX5EcmmTHp0mhdFi72upuRXDLjibPI/Js+tvRRqLzgBjaDucl8uCrWqUMCG7CIc+fq608IVZhW18ceMzR1zXVIjBOWh+tKo3W6mQJ1Ki1cwArWJWLNLTUkejhhMnS54CWJLTxtdDUtQGU57CGWdD4ANCiuhgFWgfeqsvXId9cZkS3c0TSoRj+e14RlWiBvm9WC1oQLpe7uL8X2t9YrAf7j/QeuiHObKxV0Ot8XKfiLxCyCo1f1FJxFX1k/Yu7dUoOVe4Y9p2ZesHJrpEQNCXWZGRI6NWuIXpu8C+N555/syFlD5Gzwz5cobUQZ3t3lmoIt+hZDtZ6lKnxw9XeTqLzC1fYNIZf1ohyNFVFXVgOjzaSJUTAXmJ4C1kLXug3W0gaYd46sjtXo4MEJF2SODV+PBTQwVwUHDB9wTZlwhAOnSSXpPVXlLSpxYKdl8alFdnA2pTTbyrj9H3CBIqF63h4jJNkbYERo4YmVQKxSKO/ZsH/dNph7ANmJTE9nnsp5VBeaul5qnpw1LQhGP2d3KDlqVG/miyKG3yI9L8wy/uK0/10d0xyraL9XHb4zEJ0KcoOx0w3ChZupjLdydynRjH22F+DrzAAeg8Hd57naJ+8cF1kwvHlypo8xpZuJvWKYtYGHiaJiBJxVJmzuoRCEcZ3kNRa2TSJjInDeoTb5RP/k9mzRhKZ4KaQslyqMgYkIjcpook2arO/z44H2qcKVyrOKnZ3LUrss3Jur0gQuTTIH84JYff8ldZfuCPrvHox/PC5GJI9X6BUBjto9814xMDSmaq7htS2cWzktinYl1gg/7mgdZMP7/+zm+UtdxrQvGw9KH1CwcG3sWdUB1W9NFg3OFeJbVj6/jvrnUq6rRjDwaMucgbqSGu+jvzBLtesmLMUifnJo2C5z+pxkYlA3Ee0VvOIX360AkOocaDMGCVp73Fn80BQfcH2Vx6j79kPNjifJ+mlpBqgRLOCRcOK48aOs1g1prq+n/J9rr66Bp5eB3Mm2D4TxEAzBYA8b X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2024 14:58:54.7964 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dbffe0f-8120-4a4b-eb71-08dcafdef77c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6819 Received-SPF: softfail client-ip=40.107.93.64; envelope-from=davthompson@nvidia.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: asmaa@nvidia.com, David Thompson Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2074123 A recent version of the driver exposed a bug where the MAC RX filters (local MAC, broadcast MAC, and multicast MAC) are configured and enabled before the RX path is fully initialized. The result of this bug is that after the PHY is started packets that match these MAC RX filters start to flow into RX FIFO. And then, after rx_init() is completed these packets will go into into the driver RX ring as well. If enough packets are received to fill the RX ring (default size is 128 packets) before the call to request_irq() completes, the driver RX function becomes stuck. This bug is intermittent but is most likely to be seen where OOB interface is connected to a "busy network", a network with lots of broadcast and multicast traffic. The fix is to disable all MAC RX filters until the RX path is ready, i.e. all initialization is done and all the IRQs are installed. Reviewed-by: Asmaa Mnebhi Signed-off-by: David Thompson --- .../ethernet/mellanox/mlxbf_gige/mlxbf_gige.h | 6 +++ .../mellanox/mlxbf_gige/mlxbf_gige_main.c | 8 +++ .../mellanox/mlxbf_gige/mlxbf_gige_regs.h | 2 + .../mellanox/mlxbf_gige/mlxbf_gige_rx.c | 50 ++++++++++++++++--- 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h index a85823a64d94..20ae2d08fe65 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h @@ -176,6 +176,12 @@ int mlxbf_gige_mdio_probe(struct platform_device *pdev, struct mlxbf_gige *priv); void mlxbf_gige_mdio_remove(struct mlxbf_gige *priv); +void mlxbf_gige_enable_multicast_rx(struct mlxbf_gige *priv); +void mlxbf_gige_disable_multicast_rx(struct mlxbf_gige *priv); +void mlxbf_gige_enable_mac_rx_filter(struct mlxbf_gige *priv, + unsigned int index); +void mlxbf_gige_disable_mac_rx_filter(struct mlxbf_gige *priv, + unsigned int index); void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv, unsigned int index, u64 dmac); void mlxbf_gige_get_mac_rx_filter(struct mlxbf_gige *priv, diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c index 61af4f6f59c7..c9ae3f76c8f0 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c @@ -186,6 +186,10 @@ static int mlxbf_gige_open(struct net_device *netdev) if (err) goto napi_deinit; + mlxbf_gige_enable_mac_rx_filter(priv, MLXBF_GIGE_BCAST_MAC_FILTER_IDX); + mlxbf_gige_enable_mac_rx_filter(priv, MLXBF_GIGE_LOCAL_MAC_FILTER_IDX); + mlxbf_gige_enable_multicast_rx(priv); + /* Set bits in INT_EN that we care about */ int_en = MLXBF_GIGE_INT_EN_HW_ACCESS_ERROR | MLXBF_GIGE_INT_EN_TX_CHECKSUM_INPUTS | @@ -448,6 +452,10 @@ static int mlxbf_gige_probe(struct platform_device *pdev) priv->rx_q_entries = MLXBF_GIGE_DEFAULT_RXQ_SZ; priv->tx_q_entries = MLXBF_GIGE_DEFAULT_TXQ_SZ; + mlxbf_gige_disable_mac_rx_filter(priv, MLXBF_GIGE_BCAST_MAC_FILTER_IDX); + mlxbf_gige_disable_mac_rx_filter(priv, MLXBF_GIGE_LOCAL_MAC_FILTER_IDX); + mlxbf_gige_disable_multicast_rx(priv); + /* Write initial MAC address to hardware */ mlxbf_gige_initial_mac(priv); diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h index 98a8681c21b9..4d14cb13fd64 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h @@ -62,6 +62,8 @@ #define MLXBF_GIGE_TX_STATUS_DATA_FIFO_FULL BIT(1) #define MLXBF_GIGE_RX_MAC_FILTER_DMAC_RANGE_START 0x0520 #define MLXBF_GIGE_RX_MAC_FILTER_DMAC_RANGE_END 0x0528 +#define MLXBF_GIGE_RX_MAC_FILTER_GENERAL 0x0530 +#define MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST BIT(1) #define MLXBF_GIGE_RX_MAC_FILTER_COUNT_DISC 0x0540 #define MLXBF_GIGE_RX_MAC_FILTER_COUNT_DISC_EN BIT(0) #define MLXBF_GIGE_RX_MAC_FILTER_COUNT_PASS 0x0548 diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c index a18fa860e5cc..6ffc8c28bca9 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c @@ -11,15 +11,31 @@ #include "mlxbf_gige.h" #include "mlxbf_gige_regs.h" -void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv, - unsigned int index, u64 dmac) +void mlxbf_gige_enable_multicast_rx(struct mlxbf_gige *priv) { void __iomem *base = priv->base; - u64 control; + u64 data; - /* Write destination MAC to specified MAC RX filter */ - writeq(dmac, base + MLXBF_GIGE_RX_MAC_FILTER + - (index * MLXBF_GIGE_RX_MAC_FILTER_STRIDE)); + data = readq(base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL); + data |= MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST; + writeq(data, base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL); +} + +void mlxbf_gige_disable_multicast_rx(struct mlxbf_gige *priv) +{ + void __iomem *base = priv->base; + u64 data; + + data = readq(base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL); + data &= ~MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST; + writeq(data, base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL); +} + +void mlxbf_gige_enable_mac_rx_filter(struct mlxbf_gige *priv, + unsigned int index) +{ + void __iomem *base = priv->base; + u64 control; /* Enable MAC receive filter mask for specified index */ control = readq(base + MLXBF_GIGE_CONTROL); @@ -27,6 +43,28 @@ void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv, writeq(control, base + MLXBF_GIGE_CONTROL); } +void mlxbf_gige_disable_mac_rx_filter(struct mlxbf_gige *priv, + unsigned int index) +{ + void __iomem *base = priv->base; + u64 control; + + /* Disable MAC receive filter mask for specified index */ + control = readq(base + MLXBF_GIGE_CONTROL); + control &= ~(MLXBF_GIGE_CONTROL_EN_SPECIFIC_MAC << index); + writeq(control, base + MLXBF_GIGE_CONTROL); +} + +void mlxbf_gige_set_mac_rx_filter(struct mlxbf_gige *priv, + unsigned int index, u64 dmac) +{ + void __iomem *base = priv->base; + + /* Write destination MAC to specified MAC RX filter */ + writeq(dmac, base + MLXBF_GIGE_RX_MAC_FILTER + + (index * MLXBF_GIGE_RX_MAC_FILTER_STRIDE)); +} + void mlxbf_gige_get_mac_rx_filter(struct mlxbf_gige *priv, unsigned int index, u64 *dmac) {