lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240126173925.16794-1-rohan.g.thomas@intel.com>
Date: Sat, 27 Jan 2024 01:39:25 +0800
From: rohan.g.thomas@...el.com
To: esben@...nix.com
Cc: alexandre.torgue@...s.st.com,
	conor+dt@...nel.org,
	davem@...emloft.net,
	devicetree@...r.kernel.org,
	edumazet@...gle.com,
	fancer.lancer@...il.com,
	joabreu@...opsys.com,
	krzysztof.kozlowski+dt@...aro.org,
	kuba@...nel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	linux-stm32@...md-mailman.stormreply.com,
	mcoquelin.stm32@...il.com,
	netdev@...r.kernel.org,
	pabeni@...hat.com,
	peppe.cavallaro@...com,
	robh+dt@...nel.org,
	rohan.g.thomas@...el.com
Subject: RE: [PATCH net-next 2/2] net: stmmac: TBS support for platform driver

From: Rohan G Thomas <rohan.g.thomas@...el.com>

On Fri, 26 Jan 2024 09:35:01 +0100, Esben Haabendal wrote:
Hi Esben,

Thanks for your comments. Please find my reply inline.

> > +	/* If TBS feature is supported(i.e. tbssel is true), then at least 1 Tx
> > +	 * DMA channel supports TBS. So if tbs_ch_num is 0 and tbssel is true,
> > +	 * assume all Tx DMA channels support TBS. TBS_CH field, which gives
> > +	 * number of Tx DMA channels with TBS support is only available only
> for
> > +	 * DW xGMAC IP. For other DWMAC IPs all Tx DMA channels can
> support TBS.
> 
> The Ethernet QOS controllers found in various i.MX socs does not support TBS
> on TX queue 0. I believe this patch would break the dwmac driver for these
> platforms.

AFAIU from Synopsys DWMAC5 Databook, all queues support TBS. But TBS
cannot coexist with TSO. So all glue drivers enabling TBS feature are
avoiding queue 0 to support TSO. Also packets requesting TSO are
always directed to queue 0 by stmmac driver.

> 
> > +	 */
> > +	if (priv->dma_cap.tbssel && !priv->dma_cap.tbs_ch_num)
> > +		priv->dma_cap.tbs_ch_num = priv-
> >dma_cap.number_tx_channel;
> > +

I don't think updating tbs_ch_num with number_tx_channel would break
the dwmac driver for i.MX socs. tbs_ch_num is used by 'Earlier check
for TBS' loop to set tbs flag. 

> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -3773,12 +3773,18 @@ stmmac_setup_dma_desc(struct stmmac_priv
> *priv, unsigned int mtu)
> >  		dma_conf->dma_rx_size = DMA_DEFAULT_RX_SIZE;
> >
> >  	/* Earlier check for TBS */
> > -	for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) {
> > -		struct stmmac_tx_queue *tx_q = &dma_conf-
> >tx_queue[chan];
> > -		int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en;
> > +	if (priv->dma_cap.tbssel) {
> > +		/* TBS is available only for tbs_ch_num of Tx DMA channels,
> > +		 * starting from the highest Tx DMA channel.
> > +		 */
> > +		chan = priv->dma_cap.number_tx_channel - priv-
> >dma_cap.tbs_ch_num;

For IPs which don't have tbs_ch_num, this loop goes from 0 to
number_tx_channel to check if tbs_enable is set by glue driver.
Existing logic is also the same. Unless you set tbs_en flag of
queue 0 from the glue driver or dts configuration this patch doesn't
set tbs flag for queue 0. This is a sanity check to avoid wrong
configuration for IPs which support tbs only in a few number of
queues.

> > +		for (; chan < priv->plat->tx_queues_to_use; chan++) {
> > +			struct stmmac_tx_queue *tx_q = &dma_conf-
> >tx_queue[chan];
> > +			int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en;
> >
> > -		/* Setup per-TXQ tbs flag before TX descriptor alloc */
> > -		tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0;
> > +			/* Setup per-TXQ tbs flag before TX descriptor alloc
> */
> > +			tx_q->tbs |= tbs_en ? STMMAC_TBS_AVAIL : 0;
> > +		}
> >  	}

Please correct me if I've misstated anything.

BR,
Rohan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ