Re: dev driver / pci throughput
Sebastian Heidl (heidl@zib.de)
Fri, 9 Nov 2001 13:32:15 +0100
On Fri, Nov 09, 2001 at 10:48:58AM +0000, Matthew Clark wrote:
> #define CHUNK 512->4096 depending on implementation
>
> static ssize_t BSL_write(..., const char *buf, size_t count..){
> char chunk[CHUNK];
> int i,pos,
> for(i=0,pos=0;i<amount of data;i++,pos+=CHUNK){
> copy_from_user(buff,buf+pos,CHUNK);
> /* reorder data */
> /* not significant in throughput */
> for(k=0;k<CHUNK;k++){
> chunk[k]=buff[B_SM(j+k)];
> }
> memcpy_toio(MEM_reg+pos+i*CHUNK+j,chunk,CHUNK);
> }
> return count;
> }
> + lots of not important details-----
>
> MEM_reg=ioremap(pci_resource_start(dev,B_SM_MEM)&PCI_BASE_ADDRESS_MEM_MASK,REG_SIZE);
Don't know if this will improve the performance much but if you checked the
area you are copying from with access_ok you can replace copy_from_user by
__copy_from_user. The second version does not check the area and so saves some
cycles.
regards,
_sh_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/