From nobody Sat Nov 23 11:00:57 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XwTXp1Pyhz5fKty; Sat, 23 Nov 2024 11:00:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XwTXp0tpRz4pkd; Sat, 23 Nov 2024 11:00:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732359658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5DBGOKIN5x6sWT0e6rSNmU/ns4K0kdnDOWYdal15XT8=; b=VgLyYSLfIA9WadwDMm0TY+e8R0glQV0ffLrWNdEcGLE87U07nNMinEOO+C56uSZAikYFAz ru82UXG6F6C0Oq0uL3LbWZquwRukxRoJnYpZpR0JHzIFS3stnqFsq+u3AIU1qEC1LzCxlS uIae6NPKj5WtXs8kqtUKPuIYPNBnCvOOA/LMAhHsIpeSjKPnJnQKy1wrzCrpVBJscTGJYG SQP9nxmGrwtX97vG2V3UmJk7ougtrYQDQ0T3/GFWKtow5r8m5QVhs53p6vyhFjxhP2gif5 wm6q3McUe6zGfBx8aCrEUw0OmDeVvn+3OXQL2nUeRqMhE1RXuO9wK2s9rZHMWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732359658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5DBGOKIN5x6sWT0e6rSNmU/ns4K0kdnDOWYdal15XT8=; b=m8Fa14kivlbNNNzUNiVtUfqEnPJVeS8nwZE8DXFszsJQlVsUt+XatPt+FHmR+Ki5bXGUEN ucdwXtbJcdqi3BWW/iI7cb1wLRFSHwdOCGphsoWwgaONNNh7HfEpja97ptnPCPgDtoCuTz rcDgjQRTpM5zuta/0Pxg3MUn+2V5PaALBwQ3ecyEWBrmmHRPy6OR0D+I/ZXmM5/KIaQb3y GOzjVquEUm43ipzkNVW7nlVIwBzfRQ+y2vH4bYRxgKz7BmpubjRR4tpGPyk3P4IIBca2V6 RE6sLeeMacRoaP+ZbZtAS85drDK0ELkP4f2Mb7qgqwDB9H9todKiwUw2sKW3EA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732359658; a=rsa-sha256; cv=none; b=JP0mwG4SEJB4y55rzaUsmFmhF1ain7Q/3jIY/pDMIv5DmXCc/sqANhcHw0qqYHJpoQJQXe 7Wee6nm+29gvOsfEzEqCW/QuXcqb6x5TPeqluKpHF0AjjmNdijwTQ00twgYB6OFPkjXzlq ElW3WBvTdvHhH4gPLXqrmGB/Nd+x0bDooKuV0slqwClWptYSwzJW9eN8clMtVhZtF2tLR3 Sb+PKqdKdnhpnAsEcSk2LVfdbFvkYMy5Ud99PeIPPMlgXTp37EriSR8VXGJhA8buntzkH2 LTqq8hZ9r2wgwpfB6H7RiuKlMWsQ0/pQcSwlHClHxs9mHZwQZ1xlVsBHH08B4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XwTXp0NqCz167p; Sat, 23 Nov 2024 11:00:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ANB0vNs011993; Sat, 23 Nov 2024 11:00:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ANB0vBo011990; Sat, 23 Nov 2024 11:00:57 GMT (envelope-from git) Date: Sat, 23 Nov 2024 11:00:57 GMT Message-Id: <202411231100.4ANB0vBo011990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 253a1fa16b98 - main - mlx5: Fix handling of port_module_event List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 253a1fa16b98ac5f73f0820cfdd4f5ad7378757a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=253a1fa16b98ac5f73f0820cfdd4f5ad7378757a commit 253a1fa16b98ac5f73f0820cfdd4f5ad7378757a Author: Ariel Ehrenberg AuthorDate: 2024-10-31 09:18:26 +0000 Commit: Konstantin Belousov CommitDate: 2024-11-23 10:59:26 +0000 mlx5: Fix handling of port_module_event Remove the array of port module status and instead save module status and module number. At boot, for each PCI function driver get event from fw about module status. The event contains module number and module status. Driver stores module number and module status.. When user (ifconfig) ask for modules information, for each pci function driver first queries fw to get module number of current pci function, then driver compares the module number to the module number it stored before and if it matches and module status is "plugged and enabled" then driver queries fw for the eprom information of that module number and return it to the caller. In fact fw could have concluded that required module number of the current pci function, but fw is not implemented this way. current design of PRM/FW is that MCIA register handling is only aware of modules, not the pci function->module connections. FW is designed to take the module number written to MCIA and write/read the content to/from the associated module's EPROM. So, based on current FW design, we must supply the module num so fw can find the corresponding I2C interface of the module to write/read. Sponsored by: NVidia networking MFC after: 1 week --- sys/dev/mlx5/driver.h | 3 ++- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index db1c9f0bb46c..cdefe7e013f6 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -723,7 +723,8 @@ struct mlx5_core_dev { u32 vsc_addr; u32 issi; struct mlx5_special_contexts special_contexts; - unsigned int module_status[MLX5_MAX_PORTS]; + unsigned int module_status; + unsigned int module_num; struct mlx5_flow_root_namespace *root_ns; struct mlx5_flow_root_namespace *fdb_root_ns; struct mlx5_flow_root_namespace *esw_egress_root_ns; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index 29c12e41650e..1090f8638171 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -690,9 +690,9 @@ static const char *mlx5_port_module_event_error_type_to_string(u8 error_type) unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int module_num) { - if (module_num < 0 || module_num >= MLX5_MAX_PORTS) - return 0; /* undefined */ - return dev->module_status[module_num]; + if (module_num != dev->module_num) + return 0; /* module num doesn't equal to what FW reported */ + return dev->module_status; } static void mlx5_port_module_event(struct mlx5_core_dev *dev, @@ -740,8 +740,8 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev, "Module %u, unknown status %d\n", module_num, module_status); } /* store module status */ - if (module_num < MLX5_MAX_PORTS) - dev->module_status[module_num] = module_status; + dev->module_status = module_status; + dev->module_num = module_num; } static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev,