From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Lukas Wunner <lukas@wunner.de>,
Andreas Noever <andreas.noever@gmail.com>,
Gil Fine <gil.fine@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH v2 07/10] thunderbolt: Introduce tb_for_each_upstream_port_on_path()
Date: Fri, 13 Oct 2023 15:06:37 +0300 [thread overview]
Message-ID: <20231013120640.709255-8-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20231013120640.709255-1-mika.westerberg@linux.intel.com>
This is useful when walking over upstream lane adapters over given path.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/tb.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 6d49510eea09..869ac360e1b5 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1073,6 +1073,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.40.1
next prev parent reply other threads:[~2023-10-13 12:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 12:06 [PATCH v2 00/10] thunderbolt: USB4 v2 asymmetric switching and more Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 01/10] thunderbolt: Use constants for path weight and priority Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 02/10] thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth() Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 03/10] thunderbolt: Make is_gen4_link() available to the rest of the driver Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 04/10] thunderbolt: Change bandwidth reservations to comply USB4 v2 Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 05/10] thunderbolt: Set path power management packet support bit for USB4 v2 routers Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 06/10] thunderbolt: Introduce tb_port_path_direction_downstream() Mika Westerberg
2023-10-13 12:06 ` Mika Westerberg [this message]
2023-10-13 12:06 ` [PATCH v2 08/10] thunderbolt: Introduce tb_switch_depth() Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 09/10] thunderbolt: Add support for asymmetric link Mika Westerberg
2023-10-13 12:06 ` [PATCH v2 10/10] thunderbolt: Configure asymmetric link if needed and bandwidth allows Mika Westerberg
2023-10-20 15:24 ` [PATCH v2 00/10] thunderbolt: USB4 v2 asymmetric switching and more Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231013120640.709255-8-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=gil.fine@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.