Aw: [PATCH v2] ethernet:arc: Fix racing of TX ring buffer

Lino Sanfilippo
2016-05-17T16:36:11Z

Hi,

> Von: "Shuyu Wei" <wsy2220-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> @@ -685,13 +684,15 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
> wmb();
>
> skb_tx_timestamp(skb);
> + priv->tx_buff[*txbd_curr].skb = skb;
> +
> + dma_wmb();
>
> *info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
>
> /* Make sure info word is set */
> wmb();
>
> - priv->tx_buff[*txbd_curr].skb = skb;
>
> /* Increment index to point to the next BD */
> *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM;
>

I wonder if this is correct. AFAIK a dma_wmb() only guarantees ordering of writes to DMA memory.
The assignment of the skb however is to RAM not to DMA.

Regards,
Lino