System Hang with DMA at 6Mbps and above
Please find an overview of what i am trying below.
I am working on Linux kernel 2.4-20.8 using Excalibur EPXA10F
processor.
I do a dev_alloc_skb in our ethernet driver and then do a netif_rx(skb) to give the skbuff to bridge.
Once skbuff is received from the bridge i need to give the pointer skbuff->data to the DMA hardware. There are two things i need to take care of. First of all i need to ensure that the contents of
skbuff->data is consistent since we have Icache and Dcache enabled. For this i am doing a
pci_map_single( NULL, skbuff->data, datalen,PCI_DMA_TODEVICE).
Secondly i need to ensure that the physical address of the pointer
skbuff->data is provided just before giving it to the hardware for which I am using virt_to_bus().
Finally I am doing a pci_unmap_single( NULL, phy_addr, datalen,
PCI_DMA_TODEVICE).
However i see a complete system hang when we transfer data at higher rates. I am still not being able to comprehend whether there is some
limitation on the number of times pci_map and pci_unmap can be used?
Can you tell us whether there is some limitation on this number or what could be a safe manner to proceed for our problem which will
definitely work in all architectures?
To sum up these are the steps we are following currently. Please correct wherever necessary :-
-> pci_map_single( NULL, skbuff->data, datalen,PCI_DMA_TODEVICE) to
ensure cache and system memory coherency.
-> Give phy_addr to the DMA hardware using virt_to_bus().
-> pci_unmap_single (NULL, phy_addr, datalen, PCI_DMA_TODEVICE).
This is being done each time a packet comes from the ethernet and has to be given to the hardware DMA. Kindle suggest the reason or the changes required to avoid the memory corruption being seen at higher data rates.
|