mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: zhangjianrong <zhangjianrong5@huawei.com>
Cc: michael.jamet@intel.com, YehezkelShB@gmail.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, guhengsheng@hisilicon.com,
	caiyadong@huawei.com, xuetao09@huawei.com,
	lixinghang1@huawei.com
Subject: Re: [PATCH] net: thunderbolt: Enable e2e flow control in two direction
Date: Tue, 24 Jun 2025 18:38:05 +0300	[thread overview]
Message-ID: <20250624153805.GC2824380@black.fi.intel.com> (raw)
In-Reply-To: <20250624093205.722560-1-zhangjianrong5@huawei.com>

Hi,

Perhaps $subject:

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

or so.

On Tue, Jun 24, 2025 at 05:32:05PM +0800, zhangjianrong wrote:
> 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.

be enabled in both directions.

> Signed-off-by: zhangjianrong <zhangjianrong5@huawei.com>

Good finding, though.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

> ---
>  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)
>  
>  	netif_carrier_off(dev);
>  
> -	ring = tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE,
> -				RING_FLAG_FRAME);
> +	flags = RING_FLAG_FRAME;
> +	/* Only enable full E2E if the other end supports it too */
> +	if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E)
> +		flags |= RING_FLAG_E2E;
> +
> +	ring = 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 = BIT(TBIP_PDF_FRAME_START);
>  	eof_mask = BIT(TBIP_PDF_FRAME_END);
>  
> -	flags = RING_FLAG_FRAME;
> -	/* Only enable full E2E if the other end supports it too */
> -	if (tbnet_e2e && net->svc->prtcstns & TBNET_E2E)
> -		flags |= RING_FLAG_E2E;
> -
>  	ring = 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);
> -- 
> 2.34.1

      reply	other threads:[~2025-06-24 15:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24  9:32 zhangjianrong
2025-06-24 15:38 ` Mika Westerberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250624153805.GC2824380@black.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=caiyadong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guhengsheng@hisilicon.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixinghang1@huawei.com \
    --cc=michael.jamet@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xuetao09@huawei.com \
    --cc=zhangjianrong5@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®