Re: [PATCH v2] net: add Faraday FTMAC100 10/100 Ethernet driver

From: Po-Yu Chuang
Date: Wed Jan 19 2011 - 04:21:06 EST


Dear Eric,

On Tue, Jan 18, 2011 at 2:21 AM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
> Le lundi 17 janvier 2011 Ã 17:21 +0800, Po-Yu Chuang a Ãcrit :
>> + Â Â spin_lock_irqsave(&priv->tx_lock, flags);
>> + Â Â ftmac100_txdes_set_skb(txdes, skb);
>> + Â Â ftmac100_txdes_set_dma_addr(txdes, map);
>> +
>> + Â Â ftmac100_txdes_set_first_segment(txdes);
>> + Â Â ftmac100_txdes_set_last_segment(txdes);
>> + Â Â ftmac100_txdes_set_txint(txdes);
>> + Â Â ftmac100_txdes_set_buffer_size(txdes, len);
>
> I wonder if its not too expensive to read/modify/write txdes->txdes1
>
> Maybe you should use a temporary u32 var and perform one final write on
> txdes->txdes1 (with the set_dma_own)

That's OK, the compiler combines these bits updates together and write once
since txdes is not volatile. (I checked the object file)
It's not expensive.

BTW, DMA_OWN bit is at txdes0

>> + Â Â priv->tx_pending++;
>> + Â Â if (priv->tx_pending == TX_QUEUE_ENTRIES) {
>> + Â Â Â Â Â Â if (net_ratelimit())
>> + Â Â Â Â Â Â Â Â Â Â netdev_info(netdev, "tx queue full\n");
>> +
>> + Â Â Â Â Â Â netif_stop_queue(netdev);
>> + Â Â }
>> +
>> + Â Â /* start transmit */
>> + Â Â ftmac100_txdes_set_dma_own(txdes);
>
> Â Â Â Âtxdes->txdes1 = txdes1;
>
> BTW, shouldnt you use cpu_to_be32() or cpu_to_le32(), if this driver is
> multi platform ?

OK, but I am not sure if I use them the right way.
Please check my v3 patch later.

Thanks,
Po-Yu Chuang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/