From owner-freebsd-questions Mon Aug 25 09:33:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA20955 for questions-outgoing; Mon, 25 Aug 1997 09:33:17 -0700 (PDT) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA20938 for ; Mon, 25 Aug 1997 09:33:00 -0700 (PDT) Received: from cs.tu-berlin.de (thobe@anonymous230.ppp.cs.tu-berlin.de [130.149.17.230]) by mail.cs.tu-berlin.de (8.8.6/8.8.6) with ESMTP id SAA14536 for ; Mon, 25 Aug 1997 18:22:39 +0200 (MET DST) Message-ID: <3401B0E2.DE4EAB9E@cs.tu-berlin.de> Date: Mon, 25 Aug 1997 18:20:50 +0200 From: Thomas Berndes Organization: Technical University Berlin, Germany X-Mailer: Mozilla 4.02b7 [en] (X11; I; Linux 2.0.30 i486) MIME-Version: 1.0 To: questions FreeBSD Org Subject: Problems developing a network-driver as an kernel-module Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk

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 unregister and 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
 
 

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 */