Networking Forums

Networking Forums > Computer Networking > Linux Networking > IOCTL problem for network device

Reply
Thread Tools Display Modes

IOCTL problem for network device

 
 
sara
Guest
Posts: n/a

 
      12-27-2004, 04:13 PM
Hi all,
Iam writing PCI device driver for the custom board that is
registered as network driver "zzz0" using register_netdevice() that
does bus master DMA data transfer.
1. In my driver, I could do DMA transfer (filling dma memory in
the kernel itself) data between pc to board and vice versa by
programming the memory mapped device DMA register.
Now what I want is that,I want the user application to fill the
dma buffer area through IOCTL and to start the transfer.
Iam not clear with copy_from_user/ copy_to_user with mmap()
function. I hope using mmap gives high preformance. Let me know how to
use mmap to map kernelspace into user space.
hint will be helpfull.


2. Also,as I registered the device as network device, I could use
socket and interface name (zzz0) to open the device as I read from
rubini's virtual network interface.
But when I try to issue ioctl cmd , I get failed in
copy_from_user which gives no of bytes not copied error. I used the
following sample code.

int sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
struct zzz_userinfo info; /* configuration data in/out */
struct ifreq req;

strcpy(req.ifr_name, "zzz0");
req.ifr_data = (zzz)&info;

/* filled my info here*/

if (ioctl(sock, SIOCGDEVINFO, &req)<0) {
/* deal with error */
}


/* in kernel driver */
ptr = (struct zzz_userinfo *)ifr->ifr_data;
err = copy_from_user(&info, ptr, sizeof(info));
if (err)
{ printk(" not coiped %d",err); return err;}
/* deal with the information */
return 0;

whats wrong in the above code?
Hope somebody can help me on this.

Sara.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anybody correct this code that is used to get/set ARP entries and uses ioctl( ) jeniffer Linux Networking 1 04-25-2006 07:07 AM
ioctl() call with a raw socket??? john.chludzinski@gmail.com Linux Networking 0 03-28-2006 11:11 PM
SIOCGSTAMP ioctl request for TCP Amit Yadav Linux Networking 0 01-14-2005 06:33 AM
network card problem in device manager Andrew Windows Networking 3 11-18-2003 07:18 PM
ioctl(SIOCGIFCONF) AW Linux Networking 1 09-23-2003 10:04 AM



1 2 3 4 5 6 7 8 9 10 11