summaryrefslogtreecommitdiff
path: root/cesar/mac/common/link_stats.h
blob: 83b4e2eaa20c4a67fc71430d57e062fa36ffe0b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef mac_common_link_stats_h
#define mac_common_link_stats_h
/* Cesar project {{{
 *
 * Copyright (C) 2009 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    mac/common/link_stats.h
 * \brief   MAC frame stream.
 * \ingroup mac_common
 */

#if defined (ECOS) && ECOS
#   include <cyg/kernel/kapi.h>
#endif


/** TX link stats. */
struct link_stats_tx_t
{
    /** Date of the begining of statistics collection. */
    u32 statistics_start_rtc_date;
    /** Number of MSDUs received from HLE. */
    u32 num_msdus;
    /** Number of octets of MSDUs payload received from HLE. */
    u32 octets;
    /** Number of segments that were generated. */
    u32 num_segs;
    /** Number of segments that were successfully delivered. */
    u32 num_segs_suc;
    /** Number of segments that were dropped. */
    u32 num_segs_dropped;
    /** Number of PBs handed over to the PHY for transmission. */
    u32 num_pbs;
    /** Number of MPDUs that were transmitted. */
    u32 num_mpdus;
    /** Number of burts that were transmitted. */
    u32 num_bursts;
    /** Number of MPDUs that were successfully acknoledged. */
    u32 num_sacks;
    /** Number of bad CRCs from transmitted pbs. */
    u32 num_bad_pbs_crc;
};
typedef struct link_stats_tx_t link_stats_tx_t;

/** RX link stats. */
struct link_stats_rx_t
{
    /** Date of the begining of statistics collection. */
    u32 statistics_start_rtc_date;
    /** Number of MSDUs successfully received. */
    u32 num_msdus;
    /** Number of octets of MSDUs payload successfully received. */
    u32 octets;
    /** Number of segments that were successfully received. */
    u32 num_segs_suc;
    /** Number of segments that were missed. */
    u32 num_segs_missed;
    /** Number of PBs handed over from the PHY to the MAC. */
    u32 num_pbs;
    /** Number of MPDUs that were received. */
    u32 num_mpdus;
    /** Number of burts that were received. */
    u32 num_bursts;
    /** Number of received MAC frame from which ICV failed. */
    u32 num_icv_fails;
    /** Number of bad CRCs from received pbs. */
    u32 num_bad_pbs_crc;
};
typedef struct link_stats_rx_t link_stats_rx_t;

/**
 * Reset TX link stats.
 * \param  stats  stats structure
 */
extern inline void
link_stats_tx_reset (link_stats_tx_t *stats)
{
#if defined (ECOS) && ECOS
    stats->statistics_start_rtc_date = cyg_current_time ();
#else
    stats->statistics_start_rtc_date = 0;
#endif
    stats->num_msdus = 0;
    stats->octets = 0;
    stats->num_segs = 0;
    stats->num_segs_suc = 0;
    stats->num_segs_dropped = 0;
    stats->num_pbs = 0;
    stats->num_mpdus = 0;
    stats->num_bursts = 0;
    stats->num_sacks = 0;
    stats->num_bad_pbs_crc = 0;
}

/**
 * Reset RX link stats.
 * \param  stats  stats structure
 */
extern inline void
link_stats_rx_reset (link_stats_rx_t *stats)
{
#if defined (ECOS) && ECOS
    stats->statistics_start_rtc_date = cyg_current_time ();
#else
    stats->statistics_start_rtc_date = 0;
#endif
    stats->num_msdus = 0;
    stats->octets = 0;
    stats->num_segs_suc = 0;
    stats->num_segs_missed = 0;
    stats->num_pbs = 0;
    stats->num_mpdus = 0;
    stats->num_bursts = 0;
    stats->num_icv_fails = 0;
    stats->num_bad_pbs_crc = 0;
}

#endif /* mac_common_link_stats_h */