Date: Mon, 25 Aug 1997 18:16:02 +0200 From: Thomas Berndes <thobe@cs.tu-berlin.de> To: questions FreeBSD Org <freebsd-questions@FreeBSD.org> Subject: Problems developing a network-driver as an kernel-module Message-ID: <3401AFC1.885739D2@cs.tu-berlin.de>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hello FreeBSD-Programmers,
I have a problem, while developing a network-driver for FreeBSD (2.2.1).
The driver, i have written, works fine when linked static with the
kernel, but something failes when using it as a kernel-module (LKM).
* Has anybody a suggestion, about the reason for that failure ??
* Where can i get more doc about the LKM's ?
* Has anybody written a <if_detach()> function, so i can
unregisterand unload my driver, which registered with the
<if_attach()> function ?
regards,
Thomas Berndes
======================================================================
The next few lines are describing the appearance of the failure:
bash# modload .... -> OK
bash# ifconfig Date0 inet 101.102.103.1 101.102.103.2 netmask
255.255.255.0
bash# route add -net 101.102.103.0 -netmask 255.255.255.0 -interface
Date0
add net 101.102.103.0: gateway Date0
bash# ping 101.102.103.22
PING 101.102.103.22 (101.102.103.22): 56 data bytes
ping: sendto: No buffer space available
ping: wrote 101.102.103.22 64 chars, ret=-1
ping: sendto: No buffer space available
ping: wrote 101.102.103.22 64 chars, ret=-1
^C
--- 101.102.103.22 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss
======================================================================
The following lines are an extract from the source-code of the driver.
/* the real initialization of HW and driver */
uDDK_init_driver( ... ){
...
uDDK_P_ifp.if_name = pinfo->name;
uDDK_P_ifp.if_unit = 0;
uDDK_P_ifp.if_mtu = 1500;
uDDK_P_ifp.if_output = uDDK_P_write;
uDDK_P_ifp.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
if_attach( &uDDK_P_ifp );
printf( "%s: Driver initialized\n", pdriver_info->name );
return uDDK_INIT_DRIVER_OK;
}
struct isa_driver Datedriver = {uDDK_P_probe, uDDK_P_attach, "Date"};
uDDK_Init_Type
Date_init( uDDK_INIT_ARGS )
{
if( uDDK_init_driver( ... )
}
PSEUDO_SET( Date_init, Date );
#ifdef MODULE
MOD_MISC ( Date );
int init_module( uDDK_MODULE_ARGS )
{
if( uDDK_init_driver( ... )
}
...
#endif /* MODULE */
[-- Attachment #2 --]
<HTML>
Hello FreeBSD-Programmers,
<P>I have a problem, while developing a network-driver for FreeBSD (2.2.1).
<P>The driver, i have written, works fine when linked static with the
<BR>kernel, but something failes when using it as a kernel-module (LKM).
<BR>
<UL>
<LI>
Has anybody a suggestion, about the reason for that failure ??</LI>
</UL>
<UL>
<LI>
Where can i get more doc about the LKM's ?</LI>
</UL>
<UL>
<LI>
Has anybody written a <if_detach()> function, so i can unregisterand
unload my driver, which registered with the <if_attach()> function ?</LI>
</UL>
<P>regards,
<P> Thomas Berndes
<BR>
<BR>
<P>======================================================================
<P>The next few lines are describing the appearance of the failure:
<P> bash# modload .... -> OK
<P> bash# ifconfig Date0 inet 101.102.103.1 101.102.103.2 netmask
255.255.255.0
<BR> bash# route add -net 101.102.103.0 -netmask 255.255.255.0 -interface
Date0
<BR> add net 101.102.103.0: gateway Date0
<BR>
<BR> bash# ping 101.102.103.22
<BR> PING 101.102.103.22 (101.102.103.22): 56 data bytes
<BR> ping: sendto: No buffer space available
<BR> ping: wrote 101.102.103.22 64 chars, ret=-1
<BR> ping: sendto: No buffer space available
<BR> ping: wrote 101.102.103.22 64 chars, ret=-1
<BR> ^C
<BR> --- 101.102.103.22 ping statistics ---
<BR> 2 packets transmitted, 0 packets received, 100% packet loss
<BR>
<BR>
<P>======================================================================
<P>The following lines are an extract from the source-code of the driver.
<P>/* the real initialization of HW and driver */
<BR>uDDK_init_driver( ... ){
<BR> ...
<P> uDDK_P_ifp.if_name = pinfo->name;
<BR> uDDK_P_ifp.if_unit = 0;
<BR> uDDK_P_ifp.if_mtu = 1500;
<BR> uDDK_P_ifp.if_output = uDDK_P_write;
<BR> uDDK_P_ifp.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
<P> if_attach( &uDDK_P_ifp );
<P> printf( "%s: Driver initialized\n", pdriver_info->name );
<BR> return uDDK_INIT_DRIVER_OK;
<BR>}
<P>struct isa_driver Datedriver = {uDDK_P_probe, uDDK_P_attach, "Date"};
<P>uDDK_Init_Type
<BR>Date_init( uDDK_INIT_ARGS )
<BR>{
<BR> if( uDDK_init_driver( ... )
<BR>}
<P>PSEUDO_SET( Date_init, Date );
<BR>
<BR>
<P>#ifdef MODULE
<P>MOD_MISC ( Date );
<P>int init_module( uDDK_MODULE_ARGS )
<BR>{
<BR> if( uDDK_init_driver( ... )
<BR>}
<P>...
<P>#endif /* MODULE */
<BR>
<BR>
<BR> </HTML>
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3401AFC1.885739D2>
