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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 May 2022 11:53:12 +0200
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, nbd@....name, john@...ozen.org,
        sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
        davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
        Sam.Shih@...iatek.com, linux-mediatek@...ts.infradead.org,
        devicetree@...r.kernel.org, robh@...nel.org,
        lorenzo.bianconi@...hat.com
Subject: Re: [PATCH v2 net-next 12/15] net: ethernet: mtk_eth_soc: introduce
 MTK_NETSYS_V2 support

On May 17, Jakub Kicinski wrote:
> On Mon, 16 May 2022 18:06:39 +0200 Lorenzo Bianconi wrote:
> > +	struct mtk_mac *mac = netdev_priv(dev);
> > +	struct mtk_tx_dma_v2 *desc = txd;
> > +	struct mtk_eth *eth = mac->hw;
> > +	u32 data;
> > +
> > +	WRITE_ONCE(desc->txd1, info->addr);
> > +
> > +	data = TX_DMA_PLEN0(info->size);
> > +	if (info->last)
> > +		data |= TX_DMA_LS0;
> > +	WRITE_ONCE(desc->txd3, data);
> > +
> > +	if (!info->qid && mac->id)
> > +		info->qid = MTK_QDMA_GMAC2_QID;
> > +
> > +	data = (mac->id + 1) << TX_DMA_FPORT_SHIFT_V2; /* forward port */
> > +	data |= TX_DMA_SWC_V2 | QID_BITS_V2(info->qid);
> > +	WRITE_ONCE(desc->txd4, data);
> > +
> > +	data = 0;
> > +	if (info->first) {
> > +		if (info->gso)
> > +			data |= TX_DMA_TSO_V2;
> > +		/* tx checksum offload */
> > +		if (info->csum)
> > +			data |= TX_DMA_CHKSUM_V2;
> > +	}
> > +	WRITE_ONCE(desc->txd5, data);
> > +
> > +	data = 0;
> > +	if (info->first && info->vlan)
> > +		data |= TX_DMA_INS_VLAN_V2 | info->vlan_tci;
> > +	WRITE_ONCE(desc->txd6, data);
> > +
> > +	WRITE_ONCE(desc->txd7, 0);
> > +	WRITE_ONCE(desc->txd8, 0);
> 
> Why all the WRITE_ONCE()? Don't you just need a barrier between writing
> the descriptor and kicking the HW? 

I used this approach just to be aligned with current codebase:
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/mediatek/mtk_eth_soc.c#L1006
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/mediatek/mtk_eth_soc.c#L1031

but I guess we can even convert the code to use barrier instead. Agree?

Regards,
Lorenzo

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ