On Fri, Nov 15, 2024 at 07:54:37AM -0600, Bowman, Terry wrote: > On 11/15/2024 2:47 AM, Lukas Wunner wrote: > > On Thu, Nov 14, 2024 at 11:07:26AM -0600, Bowman, Terry wrote: > > > I will remove the "if (!pcie_is_cxl(dev))" block as you suggested. > > > > Ah, this is meant as a speed-up. Actually that makes sense, > > so feel free to keep it. > > > > If you do remove it, I think you'll have to move the cxl_port_dvsec() > > invocation up in the function, in front of the pci_pcie_type() checks. > > The latter require that one first checks that the device is PCIe. > > That's done implicitly by cxl_port_dvsec() because it returns 0 in > > the non-PCIe case. (Due to the "if (dev->cfg_size <= PCI_CFG_SPACE_SIZE)" > > check in pci_find_next_ext_capability().) > > > > Another idea would be to put a "if (!pcie_is_cxl(dev)) return 0;" speed-up > > in cxl_port_dvsec() so that the other caller benefits from it as well. > > Ok, I'll look at adding the same pcie_is_cxl() call and check in > cxl_port_devsec(). If you put "if (!pcie_is_cxl(dev)) return 0;" in cxl_port_devsec() and move the call to cxl_port_devsec() in pcie_is_cxl_port() up in front of the pci_pcie_type() checks, I think you won't need an additional "!pcie_is_cxl(dev)" check in pcie_is_cxl_port(). Thanks, Lukas