From nobody Wed Oct 8 11:40:05 2025 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 E833B198A09; Sat, 28 Jun 2025 09:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751103507; cv=none; b=g9Fk3j9B99NGF98A4Vtwxu48Hymy10Oog/hGIAGFCKqGZqBVYiKSCE4optAOAFagFqHnCvzvYgnwt2tyNDOiJS5Pe8NFLRvM1vczEtooO0GNlNJn7IYNrdus3foB5FxAXUgNHjumXRRPnhZcaCRJsm/AqCDJZ7iYJUn4GzqMB/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751103507; c=relaxed/simple; bh=qmD57pNlU8IpA3r0Rhf/560u+TtYPik1mEAgDEbnZPw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lQCY1Iy0DgzLZgYD2nxkE6TWZ9m+6nDtMKrEOysviJGrQ+/u1rIO/t2sQhwj0xZrR5SBTr8l2yvMJRAyVPq8utqVaX7WnBvTeAG2YBSLNZh4eEKTkDYiKiMvgC4JHW64vF403Cpqm+URkrUXO5h51wk2teSnC/5dRgZv1Q6/ZBg= 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.32 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.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4bTnSH0JCqz27hQC; Sat, 28 Jun 2025 17:39:11 +0800 (CST) Received: from kwepemk100010.china.huawei.com (unknown [7.202.194.58]) by mail.maildlp.com (Postfix) with ESMTPS id 52B3B1A016C; Sat, 28 Jun 2025 17:38:15 +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; Sat, 28 Jun 2025 17:38:14 +0800 From: zhangjianrong To: , , , , , , , , , CC: , , , Subject: [PATCH v2] net: thunderbolt: Enable end-to-end flow control also in transmit Date: Sat, 28 Jun 2025 17:38:13 +0800 Message-ID: <20250628093813.647005-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: kwepems500002.china.huawei.com (7.221.188.17) 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 both directions. Signed-off-by: zhangjianrong --- v2: update subject and commit message v1: initial submission 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