Hi, On Thu, Feb 29, 2024 at 12:18:31PM +0000, mohamed.rayan@xxxxxxxxxxx wrote: > Hello, > > > > Hope this mail finds you well, It does but sending HTML has some issues if the receiver such as me uses text based mail client ;-) > I am sending this mail asking you for some help in the usage of tb/usb4 > driver, > > I have downloaded this driver for kernel v6.5 to install it with a certain > USB4 host controller, Here is the driver link: > [1]https://elixir.bootlin.com/linux/v6.5/source/drivers/thunderbol > > > > I have found something not clear to me in “switch.c”, and exactly at line > #2260: “[2]tb_switch_alloc”, which is responsible for allocating and > initialization a switch: > > 1- This function has a local variable called “upstream_port” > > 2- A “tb_cfg_get_upstream_port” is first called to get the value of “upstream_port” from Switch config space > > 3- When I checked “tb_cfg_get_upstream_port” function, I found that it reads first DW (DW#0) of the router configuration space > > 4- In USB4 standard specifications, the first DW of the router config space is Vendor/Product IDs, not the Upstream Adapter, please check the below snapshot from USB4 standard > > 5- Later in the code of the “[3]tb_switch_alloc” function, at line#2297, this value of “upstream_port” is used to overwrite another variable in the struct as follow: > > > > > > > > > > 6- So at the end, “sw->config.upstream_port_number” will get updated with incorrect settings, So I am wondering if this is an expected behavior, Am I missing something? This is historic to support Thunderbolt 1-3 devices where the upstream port could change. In USB4 routers it is read-only. Do you see any real issue with this?