newbie question: RTL8139 TX buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

kept exploring the sources of rtl8139 NIC and stuck with the weird spot in
'rtl8139_hw_start()' (same both in a 2.4.x and 2.6.x). I don't post here
very detailed code, as I assume everybody here has access to linux source
tree:

...
/* init Tx buffer DMA addresses */
for (i = 0; i < NUM_TX_DESC; i++)
RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs));

RTL_W32_F is a macro exposing into:

'writel(tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs), ...)'

By the time of this call 'tx_buf' has been properly initialised and contains addresses of 4 TX descriptors.

As I understand 'tx_bufs_dma' holds the physical address of DMA memory, while 'tx_bufs' - kernel virtual address. What I can't figure out is the point of this calculations: tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)

Why can't we simply have 'tp->tx_bufs_dma + (i * 4)', providing that we know the size of TX descriptors is 32 bits ?

Thanks in advance.

--
Roman Mashak

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux