Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3911 → Rev 3912

/branches/network/uspace/srv/net/netif/device.h
1,5 → 1,5
/*
* Copyright (c) 2008 Lukas Mejdrech
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
26,12 → 26,12
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup net
* @{
/** @addtogroup netif
* @{
*/
 
/**
* @file
/** @file
* Device identifier, state and usage statistics.
*/
 
#ifndef __NET_DEVICE_ID_TYPE_H__
42,51 → 42,119
#define DEVICE_MAP_DECLARE INT_MAP_DECLARE
#define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT
 
/** Device identifier type.
*/
typedef int device_id_t;
 
/** Device state type.
*/
typedef enum device_state device_state_t;
 
/** Type definition of the device usage statistics.
* @see device_stats
*/
typedef struct device_stats device_stats_t;
 
/** Type definition of the device usage statistics pointer.
* @see device_stats
*/
typedef device_stats_t * device_stats_ref;
 
/** Device state.
*/
enum device_state{
/** Device not present or not initialized.
*/
NETIF_NULL = 0,
/** Device present and stopped.
*/
NETIF_STOPPED,
/** Device present and active.
*/
NETIF_ACTIVE,
/** Device present but unable to transmit.
*/
NETIF_CARRIER_LOST
};
 
// based on linux_kernel/include/linux/netdevice.h
 
/** Device usage statistics.
* Based on linux_kernel/include/linux/netdevice.h.
*/
struct device_stats{
unsigned long rx_packets; /* total packets received */
unsigned long tx_packets; /* total packets transmitted */
unsigned long rx_bytes; /* total bytes received */
unsigned long tx_bytes; /* total bytes transmitted */
unsigned long rx_errors; /* bad packets received */
unsigned long tx_errors; /* packet transmit problems */
unsigned long rx_dropped; /* no space in linux buffers */
unsigned long tx_dropped; /* no space available in linux */
unsigned long multicast; /* multicast packets received */
/** Total packets received.
*/
unsigned long rx_packets;
/** Total packets transmitted.
*/
unsigned long tx_packets;
/** Total bytes received.
*/
unsigned long rx_bytes;
/** Total bytes transmitted.
*/
unsigned long tx_bytes;
/** Bad packets received counter.
*/
unsigned long rx_errors;
/** Packet transmition problems counter.
*/
unsigned long tx_errors;
/** No space in buffers counter.
*/
unsigned long rx_dropped;
/** No space available counter.
*/
unsigned long tx_dropped;
/** Total multicast packets received.
*/
unsigned long multicast;
/** The number of collisions due to congestion on the medium.
*/
unsigned long collisions;
 
/* detailed rx_errors: */
/** Received packet length error counter.
*/
unsigned long rx_length_errors;
unsigned long rx_over_errors; /* receiver ring buff overflow */
unsigned long rx_crc_errors; /* recved pkt with crc error */
unsigned long rx_frame_errors; /* recv'd frame alignment error */
unsigned long rx_fifo_errors; /* recv'r fifo overrun */
unsigned long rx_missed_errors; /* receiver missed packet */
/** Receiver buffer overflow counter.
*/
unsigned long rx_over_errors;
/** Received packet with crc error counter.
*/
unsigned long rx_crc_errors;
/** Received frame alignment error counter.
*/
unsigned long rx_frame_errors;
/** Receiver fifo overrun counter.
*/
unsigned long rx_fifo_errors;
/** Receiver missed packet counter.
*/
unsigned long rx_missed_errors;
 
/* detailed tx_errors */
/** Transmitter aborted counter.
*/
unsigned long tx_aborted_errors;
/** Transmitter carrier errors counter.
*/
unsigned long tx_carrier_errors;
/** Transmitter fifo overrun counter.
*/
unsigned long tx_fifo_errors;
/** Transmitter carrier errors counter.
*/
unsigned long tx_heartbeat_errors;
/** Transmitter window errors counter.
*/
unsigned long tx_window_errors;
 
/* for cslip etc */
/** Total compressed packets received.
*/
unsigned long rx_compressed;
/** Total compressed packet transmitted.
*/
unsigned long tx_compressed;
};