Network driver for SMSC91c111 and linked mbufs

Ian Caddy ianc at microsol.iinet.net.au
Mon Nov 22 02:19:00 UTC 2004


Hi Jonas,



Jonas Moberg wrote:
> When tx-ing an ethernet packet that is assembled from linked mbufs - could
> ever the mbufs have
> an odd length (except for the last mbuf in chain if the complete frame has
> an odd length).

Yes, it is quite possible for mbufs to have an odd length.

> Our problem is that the mcf5249 Coldfire chip can not issue external byte
> writes so that all accesses
> to the network controller must be words.

Are you sure about this.  I am not directly familiar with the mcf5249, 
but we use a MCF5307 with the SMC chip, and all you need to do is use 
the BWE0 and BWE1 lines to setup a byte write to the SMC chip.  Does the 
5248 have BWE lines?


> I can see no way to put single bytes in the tx fifo and then continue
> writing words again
> on next mbuf boundry.

The way we look after this is that we do DMA transfers for each mbuf. 
When you setup the DMA, make sure it is an exact number of words, by 
ANDing the length with 0xFFFE.  Then on the DMA Tx completion, we check 
if there is a byte left in the mbuf and write the individual byte out to 
the SMC chip, setup the next DMA transfer for the next mbuf (if 
required) and start the DMA up again.

> Re-aligning between a potential "odd mbuf chained to next mbuf" would then
> degrade performance.

This may also not be possible, as I am fairly sure the DMA will want to 
perform word transfers on a word boundary, but before anyone says 
otherwise, I haven't checked this, it is just a hunch... ;-)

You still could transmit the Ethernet packets at the Tx task level, and 
the performance hit is not that great, as in a tight loop, the cache 
will be used for the instructions so they will be executing at full 
speed, but it will be interrupted by interrupts (unless you turn off the 
interrupts, but will increase your latency).

regards,

Ian Caddy



More information about the users mailing list