[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2.6.x kernels - use of exported symbols/functions
On Tuesday 10 February 2004 01:14, threadhead@web.de wrote:
> > dev_base is a global variable of type struct net_device *
> > and should be accessed using a read/write lock, dev_base_lock.
> > (If in uniprocessor machine lock doesn't matter).
> >
> > Parsing through the list u can find the appropriate network
> > device ( one way is identifying by the name such eth0,..
> > in the name field).
> >
> > And then can make use of the function pointer
> > hard_start_xmit in the structure net_device.
>
> ok when i have obtained the hard_start_xmit function that way,
> i can call it just like that with the two required arguments?
>
> i tried that once but as i said earlier that resulted in a kernel oops.
> (i did the function call only, not anything locking related. is it actually
> necessarry to lock the kernel for the moment the function is called?)
>
> another question would be, how can i build my struct sk_buff and struct
> net_device the correct way? for example if i want to send a packet with the
> ack flag set from that level. passing empty structs doesnt make sense,
> obviously. ;)
"struct netdevice" is created when the
driver is registered to the kernel.
There are some Kernel API's for that
such as register_netdev,..
You can make use any of the network
device driver code to understand
Eg:- 8139too.c
Or Linux Device Drivers, Alessandro Rubini
( just google for free e-version)
Filling a sk_buff is much related to the
protocols used. I think we need to make
use of the protocol specific kernel API's.
To know how to create a sk_buff, just
trace out the packet reception
part in any of the network driver.
Driver allocates a sk_buff using the kernel
API dev_alloc_skb and fill appropriate fields.
It places the received data in one of the field
( "data" I suppose ) of the sk_buff, ...
Hope this may help you....
Regards,
Shine Mohamed
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/