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_t * | device_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_t * | device_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 DEVICE_INVALID_ID (-1) |
Invalid device identifier.
Referenced by tcp_process_client_messages(), tcp_refresh_socket_data(), udp_process_client_messages(), and udp_sendto_message().
#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.
[in] | call | The message call structure. |
#define NETIF_GET_IRQ | ( | call | ) | (int) IPC_GET_ARG2(*call) |
Returns the interrupt number message parameter.
[in] | call | The message call structure. |
typedef int device_id_t |
Device identifier type.
typedef device_t* device_ref |
Type definition of the device specific data pointer.
typedef enum device_state device_state_t |
Device state type.
typedef device_stats_t* device_stats_ref |
Type definition of the device usage statistics pointer.
typedef struct device_stats device_stats_t |
Type definition of the device usage statistics.
typedef struct netif_device device_t |
Type definition of the device specific data.
typedef struct netif_globals netif_globals_t |
Network interface module skeleton global data.
enum device_state |
enum netif_messages |
Network interface common module messages.
NET_NETIF_PROBE |
Probe device message.
|
NET_NETIF_SEND |
Send packet message.
|
NET_NETIF_START |
Start device message.
|
NET_NETIF_STATS |
Get device usage statistics message.
|
NET_NETIF_STOP |
Stop device message.
|
NET_NETIF_GET_ADDR |
Get device address message.
|
DEVICE_MAP_DECLARE | ( | device_map | , | |
device_t | ||||
) |
Device map.
Maps device identifiers to the network interface device specific data.
int find_device | ( | device_id_t | device_id, | |
device_ref * | device | |||
) |
Finds the device specific data.
[in] | device_id | The device identifier. |
[out] | device | The device specific data. |
Referenced by irq_handler(), netif_get_addr_message(), netif_get_device_stats(), netif_send_message(), and register_message().
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.
[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. |
References netif_message().
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.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
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.
[in] | client_connection | The client connection processing function. The module skeleton propagates its own one. |
References ERROR_DECLARE, ERROR_PROPAGATE, netif_init_module(), and netif_run_module().
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.
[in] | service | The network interface module service. |
[in] | device_id | The device identifier. |
[in] | me | The requesting module service. |
[in] | receiver | The message receiver. |
References bind_service().
Referenced by eth_device_message(), and nildummy_device_message().
int netif_get_addr_message | ( | device_id_t | device_id, | |
measured_string_ref | address | |||
) |
Returns the device local hardware address.
[in] | device_id | The device identifier. |
[out] | address | The device local hardware address. |
References CONVERT_SIZE, DEFAULT_ADDR, DEFAULT_ADDR_LEN, ERROR_DECLARE, ERROR_PROPAGATE, find_device(), measured_string::length, netif_device::specific, and measured_string::value.
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.
[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. |
References generic_get_addr_req(), and NET_NETIF_GET_ADDR.
Referenced by eth_device_message(), and nildummy_device_message().
int netif_get_device_stats | ( | device_id_t | device_id, | |
device_stats_ref | stats | |||
) |
Returns the device usage statistics.
[in] | device_id | The device identifier. |
[out] | stats | The device usage statistics. |
References device_stats::collisions, ERROR_DECLARE, ERROR_PROPAGATE, eth_stat::ets_carrSense, eth_stat::ets_CDheartbeat, eth_stat::ets_collision, eth_stat::ets_CRCerr, eth_stat::ets_frameAll, eth_stat::ets_missedP, eth_stat::ets_OWC, eth_stat::ets_packetR, eth_stat::ets_packetT, eth_stat::ets_recvErr, eth_stat::ets_sendErr, eth_stat::ets_transAb, find_device(), null_device_stats(), device_stats::receive_crc_errors, device_stats::receive_errors, device_stats::receive_frame_errors, device_stats::receive_missed_errors, device_stats::receive_packets, device_stats::send_aborted_errors, device_stats::send_carrier_errors, device_stats::send_errors, device_stats::send_heartbeat_errors, device_stats::send_packets, device_stats::send_window_errors, and netif_device::specific.
int netif_init_module | ( | async_client_conn_t | client_connection | ) |
Initializes the netif module.
The function has to be defined in each module.
[in] | client_connection | The client connection functio to be registered. |
Referenced by module_start().
int netif_initialize | ( | void | ) |
Initializes the specific module.
References irq_handler(), and REGISTER_ME.
int netif_message | ( | ipc_callid_t | callid, | |
ipc_call_t * | call, | |||
ipc_call_t * | answer, | |||
int * | answer_count | |||
) |
Processes the netif module messages.
[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. |
Referenced by module_message().
packet_t netif_packet_get_1 | ( | size_t | content | ) |
Allocates new packet to handle the given content size.
[in] | content | The minimum content size. |
Referenced by dp_pkt2user().
void netif_pq_release | ( | packet_id_t | packet_id | ) |
Releases the given packet.
[in] | packet_id | The packet identifier. |
Referenced by dp_pkt2user(), dp_send(), netif_send_message(), and queue_packet().
int netif_probe_message | ( | device_id_t | device_id, | |
int | irq, | |||
uintptr_t | io | |||
) |
Probes the existence of the device.
[in] | device_id | The device identifier. |
[in] | irq | The device interrupt number. |
[in] | io | The device input/output address. |
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.
int netif_probe_req | ( | int | netif_phone, | |
device_id_t | device_id, | |||
int | irq, | |||
int | io | |||
) |
Probes the existence of the device.
[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. |
References NET_NETIF_PROBE.
Referenced by start_device().
int netif_run_module | ( | void | ) |
Starts and maintains the netif module until terminated.
Referenced by module_start().
int netif_send_message | ( | device_id_t | device_id, | |
packet_t | packet, | |||
services_t | sender | |||
) |
Sends the packet queue.
[in] | device_id | The device identifier. |
[in] | packet | The packet queue. |
[in] | sender | The sending module service. |
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.
int netif_send_msg | ( | int | netif_phone, | |
device_id_t | device_id, | |||
packet_t | packet, | |||
services_t | sender | |||
) |
Sends the packet queue.
[in] | netif_phone | The network interface phone. |
[in] | device_id | The device identifier. |
[in] | packet | The packet queue. |
[in] | sender | The sending module service. |
References generic_send_msg(), NET_NETIF_SEND, and packet_get_id().
Referenced by eth_send_message(), and nildummy_send_message().
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.
[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. |
int netif_start_message | ( | device_ref | device | ) |
Starts the device.
[in] | device | The device structure. |
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.
int netif_start_req | ( | int | netif_phone, | |
device_id_t | device_id | |||
) |
Starts the device.
[in] | netif_phone | The network interface phone. |
[in] | device_id | The device identifier. |
References NET_NETIF_START.
Referenced by start_device().
int netif_stats_req | ( | int | netif_phone, | |
device_id_t | device_id, | |||
device_stats_ref | stats | |||
) |
Returns the device usage statistics.
[in] | netif_phone | The network interface phone. |
[in] | device_id | The device identifier. |
[out] | stats | The device usage statistics. |
References NET_NETIF_STATS.
int netif_stop_message | ( | device_ref | device | ) |
Stops the device.
[in] | device | The device structure. |
References change_state(), change_state_message(), dpeth::de_irq, netif_device::device_id, do_stop(), NETIF_STOPPED, netif_device::specific, and netif_device::state.
int netif_stop_req | ( | int | netif_phone, | |
device_id_t | device_id | |||
) |
Stops the device.
[in] | netif_phone | The network interface phone. |
[in] | device_id | The device identifier. |
References NET_NETIF_STOP.
void null_device_stats | ( | device_stats_ref | stats | ) |
Clears the usage statistics.
[in] | stats | The usage statistics. |
Referenced by create(), and netif_get_device_stats().
int register_message | ( | device_id_t | device_id, | |
int | phone | |||
) |
Registers the device notification receiver, the network interface layer module.
[in] | device_id | The device identifier. |
[in] | phone | The network interface layer module phone. |
References netif_device::device_id, ERROR_DECLARE, ERROR_PROPAGATE, find_device(), and netif_device::nil_phone.
Network interface module global data.
Network interface module global data.