Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: thunderbolt: Enable end-to-end flow control also in transmit

According to USB4 specification, if E2E flow control is disabled for
the Transmit Descriptor Ring, the Host Interface Adapter Layer shall
not require any credits to be available before transmitting a Tunneled
Packet from this Transmit Descriptor Ring, so e2e flow control should
be enabled in both directions.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/20250624153805.GC2824380@black.fi.intel.com
Signed-off-by: zhangjianrong <zhangjianrong5@huawei.com>
Link: https://patch.msgid.link/20250628093813.647005-1-zhangjianrong5@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

zhangjianrong and committed by
Jakub Kicinski
a8065af3 8ec31cb1

+6 -7
+6 -7
drivers/net/thunderbolt/main.c
··· 924 924 925 925 netif_carrier_off(dev); 926 926 927 - ring = tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE, 928 - RING_FLAG_FRAME); 927 + flags = RING_FLAG_FRAME; 928 + /* Only enable full E2E if the other end supports it too */ 929 + if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E) 930 + flags |= RING_FLAG_E2E; 931 + 932 + ring = tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE, flags); 929 933 if (!ring) { 930 934 netdev_err(dev, "failed to allocate Tx ring\n"); 931 935 return -ENOMEM; ··· 947 943 948 944 sof_mask = BIT(TBIP_PDF_FRAME_START); 949 945 eof_mask = BIT(TBIP_PDF_FRAME_END); 950 - 951 - flags = RING_FLAG_FRAME; 952 - /* Only enable full E2E if the other end supports it too */ 953 - if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E) 954 - flags |= RING_FLAG_E2E; 955 946 956 947 ring = tb_ring_alloc_rx(xd->tb->nhi, -1, TBNET_RING_SIZE, flags, 957 948 net->tx_ring.ring->hop, sof_mask,