[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] xenet_FifoSend(struct sk_buff *orig_skb,structnet_device *dev)
Hi Falk,
Brettschneider Falk wrote:
Hi,
John Williams wrote:
That's the primary entry point for the upper network layer
to send a
packet via this device. The alignment requirement is deeply
ingrained
into the kernel. The problem comes about because ethernet
frame headers
are not a multiple of 4 bytes long, but kernel expects (or at least
assumes) that IP header fields are word aligned.
Here are 2 patches, applying both of them makes xenet_FifoSend() much faster. Patch skbuff.c.diff makes the data aligned for xenet_FifoSend(), patch adapter.c.diff checks the alignment and avoids memcpy() in case of that it's aligned.
Patch skbuff.c.diff slows down tpc.c:tcp_sendmsg() because the memcpy() there has offset=2 now, but the second memcpy() which had offset=2 anyway is completely prevented now. So after all it's better now.
What do you think about these 2 patches?
Does it still work if CPU unaligned exceptions and handler are not enabled?
The issue as I recall is that the kernel networking stack assumes IP
headers are word-aligned (which is what creates this whole issue).
It seems your patch would cause all of those accesses to be unaligned in
the outgoing packet path, and unless the exception handling was on, it
would be completely broken?
My user program was permanently sending data. Time measuring with an oscilloscop showed that most of the time the spent time in xenet_FifoSend() is reduced from about 600us to about 200us. The 200us consists of 100us checksum calculation plus 100us spent in XEmac_FifoSend().
confirms that memcpy is a killer! Note there is an API to combine
memcpy and do_csum - maybe this can help?
Though I noticed that the call of xenet_FifoSend() is just every millisecond. That is why the data throughput (Megabytes per second) to my PC keeps the same. Is xenet_FifoSend() called by a timer with such frequency of 1/ms? If yes, can it be reduced?
FifoSend is be called by the upper level network stack (as
dev->hard_start_xmit()). See linux-2.6.x/net/core/dev.c, around line
1350. This is called by dev_queue_xmit(),
At a quick glance it's not immediately obvious to me how this gets
scheduled, whether outgoing packets are queued and dumped on some kind
of timer, or how that works. Just dig the source or hit the google, see
if there's a nice explanation out there.
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/