[PATCH v2 net-next 12/15] net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support
Jakub Kicinski
kuba at kernel.org
Tue May 17 18:44:33 PDT 2022
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?
More information about the Linux-mediatek
mailing list