Mailing List Archive

Re: How to add virtual devices at run-time?
> I would imagine that somewhere down the call stack from sys_ioctl()
> I would need to add a switch for the ADD/DELETE device ioctl
> values to tell it to go get dev_ioctl() to handle the request. Any
> idea where that might be?
For socket ioctls the sock_ioctl code is called - net/socket.c and that
calls the protocol specific handler for the socket (eg
inet_ioctl in net/ipv4/af_inet.c) which then calls dev_ioctl.
> If I could figure out how to add a /proc entry, maybe I could
> just control these things by echo'ing commands to that file?
The wanrouter has a /proc directory it puts physical devices in, which you
can then open and ioctl on to create logical channels. Thats a fairly clean
example of driving /proc
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Re: How to add virtual devices at run-time? [ In reply to ]
Alan Cox wrote:
>
> > act very much like Ethernet Devices, but of course since they
> > are only in software, it is impossible to probe for them at
> > boot, as the Ethernet devices are probed and created.)
> >
> > This is probably a fairly detailed and complex question, so I
> > would really like a pointer to some other code that does
> > something similar.
>
> Its actually an "unsolved problem" as such. Its something that needs cleaner
> handling for Frame LCN's and other stuff too. My guess is you need to add
> an ioctl pair for it (add/del logical device) and put add/del logical device
> in the struct device (include/linux/netdevice.h)
I have added the pairs to dev_ioctl() and (I believe)
the appropriate header files.
However, I am at a loss as to what I would have to do to
get dev_ioctl called with the appropriate arguments. For
example, the sys_ioctl() method seems to expect a file descriptor,
but I'm talking about a device here, so I've no idea how to get
this file descriptor (does this have something to do with the /proc
file system?)
I would imagine that somewhere down the call stack from sys_ioctl()
I would need to add a switch for the ADD/DELETE device ioctl
values to tell it to go get dev_ioctl() to handle the request. Any
idea where that might be?
If I could figure out how to add a /proc entry, maybe I could
just control these things by echo'ing commands to that file?
Gonna keep digging, thanks for any help or pointers you may
have to offer!
Ben
--
Ben Greear (greear@cyberhighway.net) http://www.primenet.com/~greear
Author of ScryMUD: mud.primenet.com 4444
http://www.primenet.com/~greear/ScryMUD/scry.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Re: How to add virtual devices at run-time? [ In reply to ]
Alan Cox wrote:
>
> > I would imagine that somewhere down the call stack from sys_ioctl()
> > I would need to add a switch for the ADD/DELETE device ioctl
> > values to tell it to go get dev_ioctl() to handle the request. Any
> > idea where that might be?
>
> For socket ioctls the sock_ioctl code is called - net/socket.c and that
> calls the protocol specific handler for the socket (eg
> inet_ioctl in net/ipv4/af_inet.c) which then calls dev_ioctl.
>
> > If I could figure out how to add a /proc entry, maybe I could
> > just control these things by echo'ing commands to that file?
>
> The wanrouter has a /proc directory it puts physical devices in, which you
> can then open and ioctl on to create logical channels. Thats a fairly clean
> example of driving /proc
>
> Alan
I took a look at the wanrouter code, very clean!
I've basically just coppied it for the VLAN proc files.
The next thing on my list is to write some code that can set up
peer-to-peer
switching among devices. In other words, each device will be able to
specify
one other device that it is to send all it's incomming packets to.
What this will give me is the ability to directly map DLCI or SVC/PVC
'devices' to
VLAN 'devices', thereby giving me basically a layer-2 switch. So, to
set this up in the kernel, I want to have the ability to specify that
device foo shall send all incomming buffers to device bar.
My original idea was to have a proc file that I could write something
like this: vlan0 <-> dlci5\n ... to a special /proc file.
Is the above idea a standard way to do something like this, or should I
just shoot
for IOCTL's? Can anyone point me to some code that actually handles
writes
to a /proc file?
Thanks,
Ben
--
Ben Greear (greear@cyberhighway.net) http://www.primenet.com/~greear
Author of ScryMUD: mud.primenet.com 4444 (Released under GPL)
http://www.primenet.com/~greear/ScryMUD/scry.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/