Date: Mon, 25 Aug 1997 18:20:50 +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: <3401B0E2.DE4EAB9E@cs.tu-berlin.de>
next in thread | raw e-mail | index | archive | help
<HTML> <P>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 unregister and unload my driver, which registered with the <if_attach()> function ?</LI> </UL> <P>regards, <P> Thomas Berndes <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>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> <P> Has anybody a suggestion, about the reason for that failure ?? <P> <P> Where can i get more doc about the LKM's ? <P> <P> Has anybody written a <if_detach()> function, so i can unregisterand unload my driver, which registered with the <BR> <if_attach()> function ? <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> </HTML>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3401B0E2.DE4EAB9E>