lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240118052220.1906721-1-Delphine_CC_Chiu@wiwynn.com>
Date: Thu, 18 Jan 2024 13:22:20 +0800
From: Delphine CC Chiu <Delphine_CC_Chiu@...ynn.com>
To: patrick@...cx.xyz
Cc: Delphine CC Chiu <Delphine_CC_Chiu@...ynn.com>,
	Samuel Mendoza-Jonas <sam@...dozajonas.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v1] NCSI: Add propety : no-channel-monitor and start-redo-probe

Add property start-redo-probe to redo probe, because Mellanox cx7 nic card
cannot't get mac address after nic card hot-plug.
Setup start-redo-probe property so that nic card can get MAC address again.
Also setup no-channel-monitor property so that the log won't keep
popping up when nic card host-plug.

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@...ynn.com>
---
 net/ncsi/internal.h    |  6 ++++++
 net/ncsi/ncsi-manage.c | 25 +++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
index 03757e76bb6b..a605271e04b4 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -199,6 +199,11 @@ struct ncsi_channel_stats {
 	u32 pt_rx_os_err;	/* Rx oversize errors         */
 };
 
+enum {
+	NCSI_CTRL_FLAG_NO_CHANNEL_MONITOR	= 0x0001,
+	NCSI_CTRL_FLAG_START_REDO_PROBE		= 0x0002,
+};
+
 struct ncsi_dev_priv;
 struct ncsi_package;
 
@@ -340,6 +345,7 @@ struct ncsi_dev_priv {
 	bool                multi_package;   /* Enable multiple packages   */
 	bool                mlx_multi_host;  /* Enable multi host Mellanox */
 	u32                 package_whitelist; /* Packages to configure    */
+	unsigned int        ctrl_flags;      /* NCSI control flags */
 };
 
 struct ncsi_cmd_arg {
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index d9da942ad53d..21a4b4db3cdc 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1211,7 +1211,8 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
 		ndp->hot_channel = hot_nc;
 		spin_unlock_irqrestore(&ndp->lock, flags);
 
-		ncsi_start_channel_monitor(nc);
+		if (!(ndp->ctrl_flags & NCSI_CTRL_FLAG_NO_CHANNEL_MONITOR))
+			ncsi_start_channel_monitor(nc);
 		ncsi_process_next_channel(ndp);
 		break;
 	default:
@@ -1779,6 +1780,7 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
 	INIT_LIST_HEAD(&ndp->vlan_vids);
 	INIT_WORK(&ndp->work, ncsi_dev_work);
 	ndp->package_whitelist = UINT_MAX;
+	ndp->ctrl_flags = 0;
 
 	/* Initialize private NCSI device */
 	spin_lock_init(&ndp->lock);
@@ -1804,8 +1806,14 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
 	if (pdev) {
 		np = pdev->dev.of_node;
 		if (np && (of_property_read_bool(np, "mellanox,multi-host") ||
-			   of_property_read_bool(np, "mlx,multi-host")))
+			of_property_read_bool(np, "mlx,multi-host")))
 			ndp->mlx_multi_host = true;
+
+		if (np && of_get_property(np, "ncsi-ctrl,no-channel-monitor", NULL))
+			ndp->ctrl_flags |= NCSI_CTRL_FLAG_NO_CHANNEL_MONITOR;
+
+		if (np && of_get_property(np, "ncsi-ctrl,start-redo-probe", NULL))
+			ndp->ctrl_flags |= NCSI_CTRL_FLAG_START_REDO_PROBE;
 	}
 
 	return nd;
@@ -1815,11 +1823,24 @@ EXPORT_SYMBOL_GPL(ncsi_register_dev);
 int ncsi_start_dev(struct ncsi_dev *nd)
 {
 	struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd);
+	struct ncsi_package *np, *tmp;
+	unsigned long flags;
 
 	if (nd->state != ncsi_dev_state_registered &&
 	    nd->state != ncsi_dev_state_functional)
 		return -ENOTTY;
 
+	if (ndp->ctrl_flags & NCSI_CTRL_FLAG_START_REDO_PROBE) {
+		nd->state = ncsi_dev_state_probe;
+		spin_lock_irqsave(&ndp->lock, flags);
+		ndp->flags &= ~NCSI_DEV_PROBED;
+		ndp->gma_flag = 0;
+		spin_unlock_irqrestore(&ndp->lock, flags);
+
+		list_for_each_entry_safe(np, tmp, &ndp->packages, node)
+			ncsi_remove_package(np);
+	}
+
 	if (!(ndp->flags & NCSI_DEV_PROBED)) {
 		ndp->package_probe_id = 0;
 		nd->state = ncsi_dev_state_probe;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ