aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dev_ena/ena_aenq_defs.h
blob: 4530f5e7a4230f6b30f92d8d361a79cd65524ea3 (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
/* SPDX-License-Identifier: Apache-2.0
 * Copyright(c) 2023 Cisco Systems, Inc.
 */

#ifndef _ENA_AENQ_DEFS_H_
#define _ENA_AENQ_DEFS_H_

#include <vppinfra/clib.h>
#include <vppinfra/error_bootstrap.h>

#define foreach_aenq_group                                                    \
  _ (0, LINK_CHANGE)                                                          \
  _ (1, FATAL_ERROR)                                                          \
  _ (2, WARNING)                                                              \
  _ (3, NOTIFICATION)                                                         \
  _ (4, KEEP_ALIVE)                                                           \
  _ (5, REFRESH_CAPABILITIES)                                                 \
  _ (6, CONF_NOTIFICATIONS)

#define foreach_aenq_syndrome                                                 \
  _ (0, SUSPEND)                                                              \
  _ (1, RESUME)                                                               \
  _ (2, UPDATE_HINTS)

typedef enum
{
#define _(v, n) ENA_AENQ_GROUP_##n = (v),
  foreach_aenq_group
#undef _
} ena_aenq_group_t;

typedef enum
{
#define _(v, n) ENA_AENQ_SYNDROME_##n = (v),
  foreach_aenq_syndrome
#undef _
} ena_aenq_syndrome_t;

typedef struct
{
  ena_aenq_group_t group : 16;
  ena_aenq_syndrome_t syndrome : 16;

  union
  {
    struct
    {
      u8 phase : 1;
    };
    u8 flags;
  };
  u8 reserved1[3];

  union
  {
    u64 timestamp;
    struct
    {
      u32 timestamp_low;
      u32 timestamp_high;
    };
  };

  union
  {
    u32 data[12];

    struct
    {
      union
      {
	struct
	{
	  u32 link_status : 1;
	};
	u32 flags;
      };
    } link_change;

    struct
    {
      union
      {
	u64 rx_drops;
	struct
	{
	  u32 rx_drops_low;
	  u32 rx_drops_high;
	};
      };

      union
      {
	u64 tx_drops;
	struct
	{
	  u32 tx_drops_low;
	  u32 tx_drops_high;
	};
      };
    } keep_alive;
  };
} __clib_packed ena_aenq_entry_t;

STATIC_ASSERT_SIZEOF (ena_aenq_entry_t, 64);

#endif /* _ENA_AENQ_DEFS_H_ */