Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 05-30-2008, 01:14 PM   #1
LQ Newbie
Registered: Feb 2008
Location: San Diego, CA
Posts: 15

Rep: Reputation: 0
Question memcpy_toio transfers data in 4 byte chunks, but I need to transfer data in one lump.

I am writing a PCIe device driver that requires me to write data to the address referenced by a Base Address Register (BAR). This particular BAR is setup to be in a memory configuration (as opposed to I/O). I've checked the flags (pci_resource_flags) and confirmed that the address space is I/O Resource Memory. I need to transfer data ranging from a couple bytes to 1/3 of a kilo byte, to this space. My code does the following:

1) calls pci_iomap(), specifying the size requested by using pci_resource_len() //for setup
2) calls memcpy_tio() //for actual transfer

The data is going to and being recieved by the proper location, but the problem is that the data is being split into 4 byte packets (instead of one lump). I used a Lecroy PCIe analyzer, which showed that the data I am transferring is being split into TLPs with 4 byte payloads (this confirms the behavior). It was mentioned to me that I/O, in general, is transfered in 4 byte packets. Is there some way to have it send all the data I want to transfer in one TLP (one lump)?

Computer Info:
1) SUSE Linux Enterprise Server 10 SP1 (kernel version 2.6.16)
2) x86_64 (8 core) processor
3) Dell Precision 490

Any suggestions of how to fix this or places to look to to research this would be more than appreciated. Thank you for taking the time to read my post.
Old 05-30-2008, 07:08 PM   #2
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
In a 64 bit processor 4 bytes = 1 word. At the lowest level the computer can only move data one word at a time, AFAIK.
Old 06-02-2008, 11:25 AM   #3
LQ Newbie
Registered: Feb 2008
Location: San Diego, CA
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for responding. Yes, 4bytes for a transfer rate makes sense to a space at a time. I am more concerned about the TLPs (Transaction Layer Packets). I believe the bus_driver is responsible for creating those TLPs, which are sent off to the Root Complex for the PCIe system. At some point, which I'm not aware of how it does it, the bus_driver decides how much data should be put into a single TLP. That TLP can have numerous different sizes, beyond 4 bytes. I need to be able to create a TLP of size 1/3 KB. I believe that this will require me to re-write the bus_driver and recompile my kernel.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Sub-$10 ARM9 SoC runs Linux, boasts fast data transfers LXer Syndicated Linux News 0 12-19-2006 01:03 PM
Slow file transfers between filesystems while recovering data from failed drive! Diademed Linux - General 18 08-14-2005 10:21 PM
DNS not working, ping wrong data byte error escargot22026 Linux - Networking 3 12-31-2004 02:26 AM
netgear FA310TX only transfers data at 1.2 Megabyte/sec niverson Fedora 14 03-29-2004 11:40 PM
No data transfer ! shaahul Linux - Hardware 3 09-16-2003 02:08 AM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration