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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241001173109.1513-11-alexandru.gagniuc@hp.com>
Date: Tue,  1 Oct 2024 17:31:05 +0000
From: Alexandru Gagniuc <alexandru.gagniuc@...com>
To: gregkh@...uxfoundation.org,
	stable@...r.kernel.org
Cc: qin.wan@...com,
	andreas.noever@...il.com,
	michael.jamet@...el.com,
	mika.westerberg@...ux.intel.com,
	YehezkelShB@...il.com,
	linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Alexandru Gagniuc <alexandru.gagniuc@...com>
Subject: [PATCH 6.6 10/14] thunderbolt: Introduce tb_for_each_upstream_port_on_path()

From: Mika Westerberg <mika.westerberg@...ux.intel.com>

[ Upstream commit 956c3abe72fb6a651b8cf77c28462f7e5b6a48b1 ]

This is useful when walking over upstream lane adapters over given path.

Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
Signed-off-by: Qin Wan <qin.wan@...com>
Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@...com>
---
 drivers/thunderbolt/tb.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 6d66dd2a3ab0..4cd5f48e3dee 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1076,6 +1076,21 @@ static inline bool tb_port_use_credit_allocation(const struct tb_port *port)
 	for ((p) = tb_next_port_on_path((src), (dst), NULL); (p);	\
 	     (p) = tb_next_port_on_path((src), (dst), (p)))
 
+/**
+ * tb_for_each_upstream_port_on_path() - Iterate over each upstreamm port on path
+ * @src: Source port
+ * @dst: Destination port
+ * @p: Port used as iterator
+ *
+ * Walks over each upstream lane adapter on path from @src to @dst.
+ */
+#define tb_for_each_upstream_port_on_path(src, dst, p)			\
+	for ((p) = tb_next_port_on_path((src), (dst), NULL); (p);	\
+	     (p) = tb_next_port_on_path((src), (dst), (p)))		\
+		if (!tb_port_is_null((p)) || !tb_is_upstream_port((p))) {\
+			continue;					\
+		} else
+
 int tb_port_get_link_speed(struct tb_port *port);
 int tb_port_get_link_generation(struct tb_port *port);
 int tb_port_get_link_width(struct tb_port *port);
-- 
2.45.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ