Re: [RTnet-developers] Monitoring Link Beat
Brought to you by:
bet-frogger,
kiszka
|
From: Jorge A. <j-a...@cr...> - 2006-11-23 16:18:47
|
Em Quinta, 23 de Novembro de 2006 16:02, escreveu: > Jorge Almeida wrote: > > > > Hello Jan, > > > > I'm trying to implement an easy way of monitoring the link beat of one board. > > > > What i want is to pass the index of the board, and internaly call the > > "do_ioctl" function that should be initialialized in the rtnet_device struct > > for each device. > > > > My question is, How do i call the do_ioctl function using the file descriptor > > of one socket that is open passing the number of the if_index (or the > > interface name)? And how rtnet knows wath device to call? > > IOCTLs on RTDM sockets come in over the related protocol handler, see > e.g. this one for packet sockets: > > http://www.rts.uni-hannover.de/rtnet/lxr/source/stack/packet/af_packet.c#L240 > > From there on you can easily go down the chain. > > As the IOCTLs are per-socket and not per-device, you have to provide the > information about the address device within the request packet. Do you > have some Linux data structure you can reuse for it? Something like for > SIOCGIFINDEX? Yes, i have the struct ifreq used for the SIOCGIFINDEX ioctl. I was checking the code and the path is something like this: 1 Start at "rt_packet_ioctl" (af_packet.c) checking for a new type of ioctl "RTIOC_TYPE_MONITORING" 2 send it to a new function in socket.c "rt_socket_monitoring_ioctl" 3 check the device that we are trying to check the link beat 4 send it to the driver (rt_8139too.c) with the do_ioctl pointer. In this i only have one doubt: Where do i return the result? Maybe the solution: Build a new struct in RTnet has support of the monitoring IOCTLS (just for now ) something like struct SDeviceMonit { int nDeviceIndex; int nLinkBeat; } This way i can identify the device (nDeviceIndex;) and get the result (nLinkBeat;). Any sugestion??!! Thanks > > Jan > > -- Jorge Almeida j-a...@cr... DISCLAIMER: This message may contain confidential information or privileged material and is intended only for the individual(s) named. If you are not a named addressee and mistakenly received this message you should not copy or otherwise disseminate it: please delete this e-mail from your system and notify the sender immediately. E-mail transmissions are not guaranteed to be secure or without errors as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. Therefore, the sender does not accept liability for any errors or omissions in the contents of this message that arise as a result of e-mail transmissions. Please request a hard copy version if verification is required. Critical Software, SA. |