Subversion Repositories HelenOS

Rev

Rev 3685 | Rev 4163 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3685 Rev 3846
Line 35... Line 35...
35
 */
35
 */
36
 
36
 
37
#ifndef __NET_NETIF_H__
37
#ifndef __NET_NETIF_H__
38
#define __NET_NETIF_H__
38
#define __NET_NETIF_H__
39
 
39
 
40
#include "netif_device_id_type.h"
40
#include "device.h"
41
 
41
 
42
#define ll_message( device, message, arg2, arg3, result1, result2, result3 )    \
42
#define nil_message( device, message, arg2, arg3, result1, result2, result3 )   \
43
    if(( device )->ll_registered >= 0 ) async_msg_3(( device )->ll_registered, ( message ), ( device )->device_id, arg2, arg3 )
43
    if(( device )->nil_phone >= 0 ) async_msg_3(( device )->nil_phone, ( message ), ( device )->device_id, arg2, arg3 )
44
 
44
 
45
typedef enum netif_state    netif_state_t;
-
 
46
 
-
 
47
typedef struct netif_device_stats   netif_device_stats_t;
-
 
48
typedef netif_device_stats_t *      netif_device_stats_ref;
-
 
49
typedef struct netif_device     netif_device_t;
45
typedef struct device       device_t;
50
typedef netif_device_t *        netif_device_ref;
46
typedef device_t *      device_ref;
51
typedef struct netif_globals        netif_globals_t;
47
typedef struct netif_globals    netif_globals_t;
52
 
48
 
53
DEVICE_MAP_DECLARE( netif_device_map, netif_device_t );
49
DEVICE_MAP_DECLARE( device_map, device_t );
54
 
-
 
55
enum    netif_state{
-
 
56
    NETIF_NULL = 0,
-
 
57
    NETIF_STOPPED,
-
 
58
    NETIF_ACTIVE,
-
 
59
    NETIF_CARRIER_LOST
-
 
60
};
-
 
61
 
-
 
62
// based on linux_kernel/include/linux/netdevice.h
-
 
63
 
-
 
64
struct  netif_device_stats{
-
 
65
    unsigned long   rx_packets;     /* total packets received   */
-
 
66
    unsigned long   tx_packets;     /* total packets transmitted    */
-
 
67
    unsigned long   rx_bytes;       /* total bytes received     */
-
 
68
    unsigned long   tx_bytes;       /* total bytes transmitted  */
-
 
69
    unsigned long   rx_errors;      /* bad packets received     */
-
 
70
    unsigned long   tx_errors;      /* packet transmit problems */
-
 
71
    unsigned long   rx_dropped;     /* no space in linux buffers    */
-
 
72
    unsigned long   tx_dropped;     /* no space available in linux  */
-
 
73
    unsigned long   multicast;      /* multicast packets received   */
-
 
74
    unsigned long   collisions;
-
 
75
 
-
 
76
    /* detailed rx_errors: */
-
 
77
    unsigned long   rx_length_errors;
-
 
78
    unsigned long   rx_over_errors;     /* receiver ring buff overflow  */
-
 
79
    unsigned long   rx_crc_errors;      /* recved pkt with crc error    */
-
 
80
    unsigned long   rx_frame_errors;    /* recv'd frame alignment error */
-
 
81
    unsigned long   rx_fifo_errors;     /* recv'r fifo overrun      */
-
 
82
    unsigned long   rx_missed_errors;   /* receiver missed packet   */
-
 
83
 
-
 
84
    /* detailed tx_errors */
-
 
85
    unsigned long   tx_aborted_errors;
-
 
86
    unsigned long   tx_carrier_errors;
-
 
87
    unsigned long   tx_fifo_errors;
-
 
88
    unsigned long   tx_heartbeat_errors;
-
 
89
    unsigned long   tx_window_errors;
-
 
90
 
-
 
91
    /* for cslip etc */
-
 
92
    unsigned long   rx_compressed;
-
 
93
    unsigned long   tx_compressed;
-
 
94
};
-
 
95
 
50
 
96
struct  netif_device{
51
struct  device{
97
    netif_device_id_t   device_id;
52
    device_id_t device_id;
98
    int         ll_registered;
53
    int     nil_phone;
99
    netif_device_stats_t    stats;
54
    device_stats_t  stats;
100
    netif_state_t       state;
55
    device_state_t  state;
101
    int         flags;
56
    int     flags;
102
    size_t          mtu;
57
    size_t      mtu;
103
    void *          specific;
58
    void *      specific;
104
};
59
};
105
 
60
 
106
struct  netif_globals{
61
struct  netif_globals{
107
    int         networking_phone;
62
    int     networking_phone;
108
    netif_device_map_t  netif_device_map;
63
    device_map_t    device_map;
109
};
64
};
110
 
65
 
111
int netif_device_find( netif_device_id_t device_id, netif_device_ref * device );
66
int find_device( device_id_t device_id, device_ref * device );
112
void netif_device_stats_null( netif_device_stats_ref stats );
67
void    null_device_stats( device_stats_ref stats );
113
 
68
 
114
#endif
69
#endif
115
 
70
 
116
/** @}
71
/** @}
117
 */
72
 */