From nobody Wed Oct 8 21:41:17 2025 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B7D1ADFFB; Tue, 24 Jun 2025 09:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750757532; cv=none; b=bInqwzjNg719SYEAa9giOxZ+B4vlurujRIkJfy5PqjpHMO4vieE2ogXoOno06VB3UTWCAgGNeFrKbL32FPPEHxQkZQJXJJEya7pcpfm6h0Ul518Il3+t6kb939XwRw0eTuzmNCtbril+tjDm6/Ja79vS+DrrXZrjKl3s/p8NCCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750757532; c=relaxed/simple; bh=PmUlWJFxi/uLENvElnZSqGns6zEvuAzlndqFMqqkOEA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=bbeiw8mxYvj3/prxohqF5uT5otCtkPvegoDvj/gcS53poQOG3kQsYJDofR2twZNzksO7RHVD6upM4B4X38X1EYZGM0QF3QusqxzP8O6ToccEb0xdxj7/4h+FwYLRvRxhg6Oja4qZH+VxiKViTJtPHZVv/TCq6RiDg4EPbFvMBlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4bRKR73qc9z1W3VJ; Tue, 24 Jun 2025 17:29:39 +0800 (CST) Received: from kwepemk100010.china.huawei.com (unknown [7.202.194.58]) by mail.maildlp.com (Postfix) with ESMTPS id EBD2518001B; Tue, 24 Jun 2025 17:32:06 +0800 (CST) Received: from workspace-z00536909-5022804397323726849.huawei.com (7.151.123.135) by kwepemk100010.china.huawei.com (7.202.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 24 Jun 2025 17:32:05 +0800 From: zhangjianrong To: , , , , , , , , , CC: , , , Subject: [PATCH] net: thunderbolt: Enable e2e flow control in two direction Date: Tue, 24 Jun 2025 17:32:05 +0800 Message-ID: <20250624093205.722560-1-zhangjianrong5@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk100010.china.huawei.com (7.202.194.58) Content-Type: text/plain; charset="utf-8" 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 two direction. Signed-off-by: zhangjianrong Acked-by: Mika Westerberg --- drivers/net/thunderbolt/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c index 0a53ec293d04..643cf67840b5 100644 --- a/drivers/net/thunderbolt/main.c +++ b/drivers/net/thunderbolt/main.c @@ -924,8 +924,12 @@ static int tbnet_open(struct net_device *dev) =20 netif_carrier_off(dev); =20 - ring =3D tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE, - RING_FLAG_FRAME); + flags =3D RING_FLAG_FRAME; + /* Only enable full E2E if the other end supports it too */ + if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E) + flags |=3D RING_FLAG_E2E; + + ring =3D tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE, flags); if (!ring) { netdev_err(dev, "failed to allocate Tx ring\n"); return -ENOMEM; @@ -944,11 +948,6 @@ static int tbnet_open(struct net_device *dev) sof_mask =3D BIT(TBIP_PDF_FRAME_START); eof_mask =3D BIT(TBIP_PDF_FRAME_END); =20 - flags =3D RING_FLAG_FRAME; - /* Only enable full E2E if the other end supports it too */ - if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E) - flags |=3D RING_FLAG_E2E; - ring =3D tb_ring_alloc_rx(xd->tb->nhi, -1, TBNET_RING_SIZE, flags, net->tx_ring.ring->hop, sof_mask, eof_mask, tbnet_start_poll, net); --=20 2.34.1