mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
thunderbolt: Enable USB4 v2 PCIe TLP/DLLP extended encapsulation
USB4 v2 spec introduces modified encapsulation of PCIe TLP and DLLP packets. This improves the PCIe tunneled traffic usage by reducing overhead. Enable this if both sides of the link support it. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
committed by
Mika Westerberg
parent
14200a2631
commit
6e19d48ea0
@@ -2796,3 +2796,34 @@ int usb4_dp_port_requested_bw(struct tb_port *port)
|
||||
|
||||
return (val & ADP_DP_CS_8_REQUESTED_BW_MASK) * granularity;
|
||||
}
|
||||
|
||||
/**
|
||||
* usb4_pci_port_set_ext_encapsulation() - Enable/disable extended encapsulation
|
||||
* @port: PCIe adapter
|
||||
* @enable: Enable/disable extended encapsulation
|
||||
*
|
||||
* Enables or disables extended encapsulation used in PCIe tunneling. Caller
|
||||
* needs to make sure both adapters support this before enabling. Returns %0 on
|
||||
* success and negative errno otherwise.
|
||||
*/
|
||||
int usb4_pci_port_set_ext_encapsulation(struct tb_port *port, bool enable)
|
||||
{
|
||||
u32 val;
|
||||
int ret;
|
||||
|
||||
if (!tb_port_is_pcie_up(port) && !tb_port_is_pcie_down(port))
|
||||
return -EINVAL;
|
||||
|
||||
ret = tb_port_read(port, &val, TB_CFG_PORT,
|
||||
port->cap_adap + ADP_PCIE_CS_1, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (enable)
|
||||
val |= ADP_PCIE_CS_1_EE;
|
||||
else
|
||||
val &= ~ADP_PCIE_CS_1_EE;
|
||||
|
||||
return tb_port_write(port, &val, TB_CFG_PORT,
|
||||
port->cap_adap + ADP_PCIE_CS_1, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user