Skip site navigation (1)Skip section navigation (2)
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>&nbsp;
<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 &lt;if_detach()> function, so i can unregister and
unload my driver, which registered with the &lt;if_attach()> function ?</LI>
</UL>


<P>regards,

<P>&nbsp; Thomas Berndes

<P>======================================================================

<P>The next few lines are describing the appearance of the failure:

<P>&nbsp; bash# modload ....&nbsp; -> OK

<P>&nbsp; bash# ifconfig Date0 inet 101.102.103.1 101.102.103.2 netmask
255.255.255.0
<BR>&nbsp; bash# route add -net 101.102.103.0 -netmask 255.255.255.0 -interface
Date0
<BR>&nbsp; add net 101.102.103.0: gateway Date0
<BR>&nbsp;
<BR>&nbsp; bash# ping 101.102.103.22
<BR>&nbsp; PING 101.102.103.22 (101.102.103.22): 56 data bytes
<BR>&nbsp; ping: sendto: No buffer space available
<BR>&nbsp; ping: wrote 101.102.103.22 64 chars, ret=-1
<BR>&nbsp; ping: sendto: No buffer space available
<BR>&nbsp; ping: wrote 101.102.103.22 64 chars, ret=-1
<BR>&nbsp; ^C
<BR>&nbsp; --- 101.102.103.22 ping statistics ---
<BR>&nbsp; 2 packets transmitted, 0 packets received, 100% packet loss
<BR>&nbsp;
<BR>&nbsp;

<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>&nbsp;

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Has anybody a suggestion, about
the reason for that failure ??

<P>&nbsp;

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where can i get more doc about
the LKM's ?

<P>&nbsp;

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Has anybody written a &lt;if_detach()>
function, so i can unregisterand unload my driver, which registered with
the
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;if_attach()> function ?

<P>regards,

<P>&nbsp; Thomas Berndes
<BR>&nbsp;
<BR>&nbsp;

<P>======================================================================

<P>The next few lines are describing the appearance of the failure:

<P>&nbsp; bash# modload ....&nbsp; -> OK

<P>&nbsp; bash# ifconfig Date0 inet 101.102.103.1 101.102.103.2 netmask
255.255.255.0
<BR>&nbsp; bash# route add -net 101.102.103.0 -netmask 255.255.255.0 -interface
Date0
<BR>&nbsp; add net 101.102.103.0: gateway Date0
<BR>&nbsp;
<BR>&nbsp; bash# ping 101.102.103.22
<BR>&nbsp; PING 101.102.103.22 (101.102.103.22): 56 data bytes
<BR>&nbsp; ping: sendto: No buffer space available
<BR>&nbsp; ping: wrote 101.102.103.22 64 chars, ret=-1
<BR>&nbsp; ping: sendto: No buffer space available
<BR>&nbsp; ping: wrote 101.102.103.22 64 chars, ret=-1
<BR>&nbsp; ^C
<BR>&nbsp; --- 101.102.103.22 ping statistics ---
<BR>&nbsp; 2 packets transmitted, 0 packets received, 100% packet loss
<BR>&nbsp;
<BR>&nbsp;

<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>&nbsp; ...

<P>&nbsp; uDDK_P_ifp.if_name&nbsp;&nbsp; = pinfo->name;
<BR>&nbsp; uDDK_P_ifp.if_unit&nbsp;&nbsp; = 0;
<BR>&nbsp; uDDK_P_ifp.if_mtu&nbsp;&nbsp;&nbsp; = 1500;
<BR>&nbsp; uDDK_P_ifp.if_output = uDDK_P_write;
<BR>&nbsp; uDDK_P_ifp.if_flags&nbsp; = IFF_POINTOPOINT | IFF_MULTICAST;

<P>&nbsp; if_attach( &amp;uDDK_P_ifp );

<P>&nbsp; printf( "%s: Driver initialized\n", pdriver_info->name );
<BR>&nbsp; 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>&nbsp; if( uDDK_init_driver( ... )
<BR>}

<P>PSEUDO_SET( Date_init, Date );
<BR>&nbsp;
<BR>&nbsp;

<P>#ifdef MODULE

<P>MOD_MISC ( Date );

<P>int init_module( uDDK_MODULE_ARGS )
<BR>{
<BR>&nbsp; if( uDDK_init_driver( ... )
<BR>}

<P>...

<P>#endif&nbsp; /* MODULE */
<BR>&nbsp;</HTML>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3401B0E2.DE4EAB9E>