Network interface drivers
[Networking Stack]

Collaboration diagram for Network interface drivers:

Data Structures

struct  device_stats
 Device usage statistics. More...
struct  netif_device
 Network interface device specific data. More...
struct  netif_globals
 Network interface module skeleton global data. More...

Modules

 Loopback Service
 Generic DP8390 network interface family service

Files

file  device.h
 

Device identifier, state and usage statistics.


file  netif_interface.h
 

Network interface module interface.


file  netif.c
 

Network interface module skeleton implementation.


file  netif.h
 

Network interface module skeleton.


file  netif_messages.h
 

Network interface common module messages.


file  netif_module.h
 

Network interface module interface.


file  netif_nil_bundle.c
 

Wrapper for the bundled network interface and network interface layer module.


file  netif_remote.c
 

Network interface module interface implementation for standalone remote modules.


file  netif_standalone.c
 

Wrapper for the standalone network interface module.


Defines

#define DEVICE_MAP_DECLARE   INT_MAP_DECLARE
 Device identifier to generic type map declaration.
#define DEVICE_MAP_IMPLEMENT   INT_MAP_IMPLEMENT
 Device identifier to generic type map implementation.
#define DEVICE_INVALID_ID   (-1)
 Invalid device identifier.

Typedefs

typedef int device_id_t
 Device identifier type.
typedef enum device_state device_state_t
 Device state type.
typedef struct device_stats device_stats_t
 Type definition of the device usage statistics.
typedef device_stats_tdevice_stats_ref
 Type definition of the device usage statistics pointer.
typedef struct netif_globals netif_globals_t
 Network interface module skeleton global data.
typedef struct netif_device device_t
 Type definition of the device specific data.
typedef device_tdevice_ref
 Type definition of the device specific data pointer.

Enumerations

enum  device_state { NETIF_NULL = 0, NETIF_STOPPED, NETIF_ACTIVE, NETIF_CARRIER_LOST }
 

Device state.

More...
enum  netif_messages {
  NET_NETIF_PROBE = NET_NETIF_FIRST, NET_NETIF_SEND, NET_NETIF_START, NET_NETIF_STATS,
  NET_NETIF_STOP, NET_NETIF_GET_ADDR
}
 

Network interface common module messages.

More...

Functions

int find_device (device_id_t device_id, device_ref *device)
 Finds the device specific data.
void null_device_stats (device_stats_ref stats)
 Clears the usage statistics.
int netif_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Processes the netif module messages.
int netif_init_module (async_client_conn_t client_connection)
 Initializes the netif module.
int netif_run_module (void)
 Starts and maintains the netif module until terminated.
void netif_pq_release (packet_id_t packet_id)
 Releases the given packet.
packet_t netif_packet_get_1 (size_t content)
 Allocates new packet to handle the given content size.
 DEVICE_MAP_DECLARE (device_map, device_t)
 Device map.
int netif_initialize (void)
 Initializes the specific module.
int netif_probe_message (device_id_t device_id, int irq, uintptr_t io)
 Probes the existence of the device.
int netif_send_message (device_id_t device_id, packet_t packet, services_t sender)
 Sends the packet queue.
int netif_start_message (device_ref device)
 Starts the device.
int netif_stop_message (device_ref device)
 Stops the device.
int netif_get_addr_message (device_id_t device_id, measured_string_ref address)
 Returns the device local hardware address.
int netif_specific_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Processes the netif driver specific message.
int netif_get_device_stats (device_id_t device_id, device_stats_ref stats)
 Returns the device usage statistics.
int module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Distributes the messages between the module parts.
int module_start (async_client_conn_t client_connection)
 Starts the bundle network interface module.

Variables

netif_globals_t netif_globals
 Network interface module global data.
netif_globals_t netif_globals
 Network interface module global data.

Network interface module interface

This interface is used by other modules.



int netif_get_addr_req (int netif_phone, device_id_t device_id, measured_string_ref *address, char **data)
 Returns the device local hardware address.
int netif_probe_req (int netif_phone, device_id_t device_id, int irq, int io)
 Probes the existence of the device.
int netif_send_msg (int netif_phone, device_id_t device_id, packet_t packet, services_t sender)
 Sends the packet queue.
int netif_start_req (int netif_phone, device_id_t device_id)
 Starts the device.
int netif_stop_req (int netif_phone, device_id_t device_id)
 Stops the device.
int netif_stats_req (int netif_phone, device_id_t device_id, device_stats_ref stats)
 Returns the device usage statistics.
int netif_bind_service (services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver)
 Creates bidirectional connection with the network interface module and registers the message receiver.

Message processing functions



int register_message (device_id_t device_id, int phone)
 Registers the device notification receiver, the network interface layer module.

Network interface specific message parameters definitions



#define NETIF_GET_IRQ(call)   (int) IPC_GET_ARG2(*call)
 Returns the interrupt number message parameter.
#define NETIF_GET_IO(call)   (int) IPC_GET_ARG3(*call)
 Returns the input/output address message parameter.

Define Documentation

#define DEVICE_INVALID_ID   (-1)
#define DEVICE_MAP_DECLARE   INT_MAP_DECLARE

Device identifier to generic type map declaration.

#define DEVICE_MAP_IMPLEMENT   INT_MAP_IMPLEMENT

Device identifier to generic type map implementation.

#define NETIF_GET_IO ( call   )     (int) IPC_GET_ARG3(*call)

Returns the input/output address message parameter.

Parameters:
[in] call The message call structure.
#define NETIF_GET_IRQ ( call   )     (int) IPC_GET_ARG2(*call)

Returns the interrupt number message parameter.

Parameters:
[in] call The message call structure.

Typedef Documentation

typedef int device_id_t

Device identifier type.

typedef device_t* device_ref

Type definition of the device specific data pointer.

See also:
netif_device

Device state type.

Type definition of the device usage statistics pointer.

See also:
device_stats
typedef struct device_stats device_stats_t

Type definition of the device usage statistics.

See also:
device_stats
typedef struct netif_device device_t

Type definition of the device specific data.

See also:
netif_device

Network interface module skeleton global data.


Enumeration Type Documentation

Device state.

Enumerator:
NETIF_NULL 

Device not present or not initialized.

NETIF_STOPPED 

Device present and stopped.

NETIF_ACTIVE 

Device present and active.

NETIF_CARRIER_LOST 

Device present but unable to transmit.

Network interface common module messages.

Enumerator:
NET_NETIF_PROBE 

Probe device message.

See also:
netif_probe_req()
NET_NETIF_SEND 

Send packet message.

See also:
netif_send_msg()
NET_NETIF_START 

Start device message.

See also:
netif_start_req()
NET_NETIF_STATS 

Get device usage statistics message.

See also:
netif_stats_req()
NET_NETIF_STOP 

Stop device message.

See also:
netif_stop_req()
NET_NETIF_GET_ADDR 

Get device address message.

See also:
netif_get_addr_req()

Function Documentation

DEVICE_MAP_DECLARE ( device_map  ,
device_t   
)

Device map.

Maps device identifiers to the network interface device specific data.

See also:
device.h
int find_device ( device_id_t  device_id,
device_ref device 
)

Finds the device specific data.

Parameters:
[in] device_id The device identifier.
[out] device The device specific data.
Returns:
EOK on success.
ENOENT if device is not found.
EPERM if the device is not initialized.

Referenced by irq_handler(), netif_get_addr_message(), netif_get_device_stats(), netif_send_message(), and register_message().

Here is the caller graph for this function:

int module_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Distributes the messages between the module parts.

Delegates the messages to the netif_message() function.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for each specific module message function.

References netif_message().

Here is the call graph for this function:

int module_start ( async_client_conn_t  client_connection  ) 

Starts the bundle network interface module.

Starts the network interface module.

Initializes the client connection serving function, initializes both module parts, registers the module service and starts the async manager, processing IPC messages in an infinite loop.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on success.
Other error codes as defined for each specific module message function.

Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on success.
Other error codes as defined for each specific module message function.

References ERROR_DECLARE, ERROR_PROPAGATE, netif_init_module(), and netif_run_module().

Here is the call graph for this function:

int netif_bind_service ( services_t  service,
device_id_t  device_id,
services_t  me,
async_client_conn_t  receiver 
)

Creates bidirectional connection with the network interface module and registers the message receiver.

Parameters:
[in] service The network interface module service.
[in] device_id The device identifier.
[in] me The requesting module service.
[in] receiver The message receiver.
Returns:
The phone of the needed service.
EOK on success.
Other error codes as defined for the bind_service() function.

References bind_service().

Referenced by eth_device_message(), and nildummy_device_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int netif_get_addr_message ( device_id_t  device_id,
measured_string_ref  address 
)

Returns the device local hardware address.

Parameters:
[in] device_id The device identifier.
[out] address The device local hardware address.
Returns:
EOK on success.
EBADMEM if the address parameter is NULL.
ENOENT if there no such device.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.

References CONVERT_SIZE, DEFAULT_ADDR, DEFAULT_ADDR_LEN, ERROR_DECLARE, ERROR_PROPAGATE, find_device(), measured_string::length, netif_device::specific, and measured_string::value.

Here is the call graph for this function:

int netif_get_addr_req ( int  netif_phone,
device_id_t  device_id,
measured_string_ref address,
char **  data 
)

Returns the device local hardware address.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
[out] address The device local hardware address.
[out] data The address data.
Returns:
EOK on success.
EBADMEM if the address parameter is NULL.
ENOENT if there no such device.
Other error codes as defined for the netif_get_addr_message() function.

References generic_get_addr_req(), and NET_NETIF_GET_ADDR.

Referenced by eth_device_message(), and nildummy_device_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int netif_get_device_stats ( device_id_t  device_id,
device_stats_ref  stats 
)
int netif_init_module ( async_client_conn_t  client_connection  ) 

Initializes the netif module.

The function has to be defined in each module.

Parameters:
[in] client_connection The client connection functio to be registered.
Returns:
EOK on success.
Other error codes as defined for each specific module message function.

Referenced by module_start().

Here is the caller graph for this function:

int netif_initialize ( void   ) 

Initializes the specific module.

References irq_handler(), and REGISTER_ME.

Here is the call graph for this function:

int netif_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the netif module messages.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for each specific module message function.
See also:
netif_interface.h
IS_NET_NETIF_MESSAGE()

Referenced by module_message().

Here is the caller graph for this function:

packet_t netif_packet_get_1 ( size_t  content  ) 

Allocates new packet to handle the given content size.

Parameters:
[in] content The minimum content size.
Returns:
The allocated packet.
NULL if there is an error.

Referenced by dp_pkt2user().

Here is the caller graph for this function:

void netif_pq_release ( packet_id_t  packet_id  ) 

Releases the given packet.

Parameters:
[in] packet_id The packet identifier.

Referenced by dp_pkt2user(), dp_send(), netif_send_message(), and queue_packet().

Here is the caller graph for this function:

int netif_probe_message ( device_id_t  device_id,
int  irq,
uintptr_t  io 
)

Probes the existence of the device.

Parameters:
[in] device_id The device identifier.
[in] irq The device interrupt number.
[in] io The device input/output address.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.

References create(), dpeth::de_base_port, dpeth::de_irq, dpeth::de_mode, DEM_DISABLED, netif_device::device_id, netif_globals::device_map, do_probe(), DP8390_IO_SIZE, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, free, NETIF_STOPPED, netif_device::nil_phone, netif_device::specific, and netif_device::state.

Here is the call graph for this function:

int netif_probe_req ( int  netif_phone,
device_id_t  device_id,
int  irq,
int  io 
)

Probes the existence of the device.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
[in] irq The device interrupt number.
[in] io The device input/output address.
Returns:
EOK on success.
Other errro codes as defined for the netif_probe_message().

References NET_NETIF_PROBE.

Referenced by start_device().

Here is the caller graph for this function:

int netif_run_module ( void   ) 

Starts and maintains the netif module until terminated.

Returns:
EOK after the module is terminated.

Referenced by module_start().

Here is the caller graph for this function:

int netif_send_message ( device_id_t  device_id,
packet_t  packet,
services_t  sender 
)

Sends the packet queue.

Parameters:
[in] device_id The device identifier.
[in] packet The packet queue.
[in] sender The sending module service.
Returns:
EOK on success.
EFORWARD if the device is not active (in the NETIF_ACTIVE state).
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.

References do_pwrite(), ERROR_DECLARE, ERROR_PROPAGATE, FALSE, find_device(), netif_globals::lock, NETIF_ACTIVE, netif_pq_release(), netif_device::nil_phone, nil_received_msg(), packet_get_data(), packet_get_data_length(), packet_get_id(), pq_detach(), pq_next(), netif_device::specific, and netif_device::state.

Here is the call graph for this function:

int netif_send_msg ( int  netif_phone,
device_id_t  device_id,
packet_t  packet,
services_t  sender 
)

Sends the packet queue.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
[in] packet The packet queue.
[in] sender The sending module service.
Returns:
EOK on success.
Other error codes as defined for the generic_send_msg() function.

References generic_send_msg(), NET_NETIF_SEND, and packet_get_id().

Referenced by eth_send_message(), and nildummy_send_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int netif_specific_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the netif driver specific message.

This function is called for uncommon messages received by the netif skeleton.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for the specific module message implementation.
int netif_start_message ( device_ref  device  ) 

Starts the device.

Parameters:
[in] device The device structure.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.

References change_state(), change_state_message(), dpeth::de_dp8390_port, dpeth::de_irq, netif_device::device_id, DL_BROAD_REQ, do_init(), dp8390_cmds, dp8390_code, DP_ISR, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, NETIF_ACTIVE, netif_device::specific, and netif_device::state.

Here is the call graph for this function:

int netif_start_req ( int  netif_phone,
device_id_t  device_id 
)

Starts the device.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the netif_start_message() function.

References NET_NETIF_START.

Referenced by start_device().

Here is the caller graph for this function:

int netif_stats_req ( int  netif_phone,
device_id_t  device_id,
device_stats_ref  stats 
)

Returns the device usage statistics.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
[out] stats The device usage statistics.
Returns:
EOK on success.

References NET_NETIF_STATS.

int netif_stop_message ( device_ref  device  ) 

Stops the device.

Parameters:
[in] device The device structure.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.

References change_state(), change_state_message(), dpeth::de_irq, netif_device::device_id, do_stop(), NETIF_STOPPED, netif_device::specific, and netif_device::state.

Here is the call graph for this function:

int netif_stop_req ( int  netif_phone,
device_id_t  device_id 
)

Stops the device.

Parameters:
[in] netif_phone The network interface phone.
[in] device_id The device identifier.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the netif_stop_message() function.

References NET_NETIF_STOP.

void null_device_stats ( device_stats_ref  stats  ) 

Clears the usage statistics.

Parameters:
[in] stats The usage statistics.

Referenced by create(), and netif_get_device_stats().

Here is the caller graph for this function:

int register_message ( device_id_t  device_id,
int  phone 
)

Registers the device notification receiver, the network interface layer module.

Parameters:
[in] device_id The device identifier.
[in] phone The network interface layer module phone.
Returns:
EOK on success.
ENOENT if there is no such device.
ELIMIT if there is another module registered.

References netif_device::device_id, ERROR_DECLARE, ERROR_PROPAGATE, find_device(), and netif_device::nil_phone.

Here is the call graph for this function:


Variable Documentation

Network interface module global data.

Network interface module global data.


Generated on Thu Mar 11 20:46:32 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1