FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
elog.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: Apache-2.0
2
* Copyright(c) 2021 Cisco Systems, Inc.
3
*/
4
5
#include <
vlib/vlib.h
>
6
#include <
vlib/unix/unix.h
>
7
#include <
vlib/pci/pci.h
>
8
#include <
vnet/ethernet/ethernet.h
>
9
10
#include <
avf/avf.h
>
11
12
static
uword
*
register_name_by_addr
= 0;
13
14
void
15
avf_elog_aq_enq_req
(
avf_device_t
*ad,
avf_aq_desc_t
*d)
16
{
17
if
(d->
opcode
== 0x801)
/* send_to_pf */
18
{
19
ELOG_TYPE_DECLARE
(el) = {
20
.format =
"avf[%d] aq_enq_req: send_to_pf flags 0x%x datalen %d "
21
"v_opcode %s (%d)"
,
22
.format_args =
"i4i2i2t2i2"
,
23
.n_enum_strings =
VIRTCHNL_N_OPS
,
24
.enum_strings = {
25
#define _(v, n) [v] = #n,
26
foreach_virtchnl_op
27
#undef _
28
},
29
};
30
31
struct
32
{
33
u32
dev_instance;
34
u16
flags
;
35
u16
datalen;
36
u16
v_opcode;
37
u16
v_opcode_val;
38
} * ed;
39
40
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
41
ed->dev_instance = ad->
dev_instance
;
42
ed->flags = d->
flags
;
43
ed->datalen = d->
datalen
;
44
ed->v_opcode = ed->v_opcode_val = d->
v_opcode
;
45
}
46
else
47
{
48
ELOG_TYPE_DECLARE
(el) = {
49
.format =
"avf[%d] aq_enq_req: opcode 0x%x flags 0x%x datalen %d"
,
50
.format_args =
"i4i2i2i2"
51
};
52
53
struct
54
{
55
u32
dev_instance;
56
u16
opcode;
57
u16
flags
;
58
u16
datalen;
59
} * ed;
60
61
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
62
ed->dev_instance = ad->
dev_instance
;
63
ed->opcode = d->
opcode
;
64
ed->flags = d->
flags
;
65
ed->datalen = d->
datalen
;
66
}
67
}
68
69
void
70
avf_elog_aq_enq_resp
(
avf_device_t
*ad,
avf_aq_desc_t
*d)
71
{
72
ELOG_TYPE_DECLARE
(el) = { .format =
73
"avf[%d] aq_enq_resp: flags 0x%x retval %d"
,
74
.format_args =
"i4i2i2"
};
75
76
struct
77
{
78
u32
dev_instance;
79
u16
flags
;
80
u16
retval;
81
} * ed;
82
83
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
84
ed->dev_instance = ad->
dev_instance
;
85
ed->flags = d->
flags
;
86
ed->retval = d->
retval
;
87
}
88
89
void
90
avf_elog_arq_desc
(
avf_device_t
*ad,
avf_aq_desc_t
*d)
91
{
92
if
(d->
opcode
== 0x802)
93
{
94
ELOG_TYPE_DECLARE
(el) = {
95
.format =
"avf[%d] arq_desc: msg_from_pf flags 0x%x retval %d "
96
"v_opcode %s (%d) v_retval %d"
,
97
.format_args =
"i4i2i2t2i2i2"
,
98
.n_enum_strings =
VIRTCHNL_N_OPS
,
99
.enum_strings = {
100
#define _(v, n) [v] = #n,
101
foreach_virtchnl_op
102
#undef _
103
},
104
};
105
106
struct
107
{
108
u32
dev_instance;
109
u16
flags
;
110
u16
retval;
111
u16
v_opcode;
112
u16
v_opcode_val;
113
u16
v_retval;
114
} * ed;
115
116
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
117
ed->dev_instance = ad->
dev_instance
;
118
ed->flags = d->
flags
;
119
ed->retval = d->
retval
;
120
ed->v_opcode = ed->v_opcode_val = d->
v_opcode
;
121
ed->v_retval = d->
v_retval
;
122
}
123
else
124
{
125
ELOG_TYPE_DECLARE
(
126
el) = { .format =
"avf[%d] arq_desc: flags 0x%x retval %d opcode 0x%x"
,
127
.format_args =
"i4i2i2i2"
};
128
129
struct
130
{
131
u32
dev_instance;
132
u16
flags
;
133
u16
retval;
134
u16
opcode;
135
} * ed;
136
137
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
138
ed->dev_instance = ad->
dev_instance
;
139
ed->flags = d->
flags
;
140
ed->retval = d->
retval
;
141
ed->opcode = d->
opcode
;
142
}
143
}
144
145
void
146
avf_elog_reg
(
avf_device_t
*ad,
u32
addr
,
u32
val,
int
is_read)
147
{
148
uword
*p;
149
ELOG_TYPE_DECLARE
(el) = {
150
.format =
"avf[%d] reg: %s %s [0x%04x] val 0x%08x"
,
151
.format_args =
"i4s4s4i4i4"
,
152
};
153
154
struct
155
{
156
u32
dev_instance;
157
char
rw[4];
158
char
reg_name[24];
159
u32
addr
;
160
u32
val;
161
} * ed;
162
163
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, el);
164
ed->dev_instance = ad->
dev_instance
;
165
ed->addr =
addr
;
166
ed->val = val;
167
ed->rw[0] = is_read ?
'r'
:
'w'
;
168
ed->rw[1] = 0;
169
170
p =
hash_get
(
register_name_by_addr
,
addr
);
171
strncpy (ed->reg_name, p ? (
char
*) p[0] :
"unknown"
, 24);
172
ed->reg_name[23] = 0;
173
}
174
175
void
176
avf_elog_init
(
void
)
177
{
178
if
(
register_name_by_addr
)
179
return
;
180
181
register_name_by_addr
=
hash_create
(0,
sizeof
(
uword
));
182
183
hash_set
(
register_name_by_addr
,
AVFINT_ICR0
,
"AVFINT_ICR0"
);
184
hash_set
(
register_name_by_addr
,
AVFINT_ICR0_ENA1
,
"INT_ICR0_ENA1"
);
185
hash_set
(
register_name_by_addr
,
AVFINT_DYN_CTL0
,
"INT_DYN_CTL0"
);
186
hash_set
(
register_name_by_addr
,
AVF_ARQBAH
,
"ARQBAH"
);
187
hash_set
(
register_name_by_addr
,
AVF_ATQH
,
"ATQH"
);
188
hash_set
(
register_name_by_addr
,
AVF_ATQLEN
,
"ATQLEN"
);
189
hash_set
(
register_name_by_addr
,
AVF_ARQBAL
,
"ARQBAL"
);
190
hash_set
(
register_name_by_addr
,
AVF_ARQT
,
"ARQT"
);
191
hash_set
(
register_name_by_addr
,
AVF_ARQH
,
"ARQH"
);
192
hash_set
(
register_name_by_addr
,
AVF_ATQBAH
,
"ATQBAH"
);
193
hash_set
(
register_name_by_addr
,
AVF_ATQBAL
,
"ATQBAL"
);
194
hash_set
(
register_name_by_addr
,
AVF_ARQLEN
,
"ARQLEN"
);
195
hash_set
(
register_name_by_addr
,
AVF_ATQT
,
"ATQT"
);
196
hash_set
(
register_name_by_addr
,
AVFGEN_RSTAT
,
"GEN_RSTAT"
);
197
198
for
(
int
i
= 0;
i
< 16;
i
++)
199
{
200
hash_set
(
register_name_by_addr
,
AVFINT_DYN_CTLN
(
i
),
201
format
(0,
"INT_DYN_CTLN(%u)%c"
,
i
, 0));
202
hash_set
(
register_name_by_addr
,
AVF_QTX_TAIL
(
i
),
203
format
(0,
"QTX_TAIL(%u)%c"
,
i
, 0));
204
hash_set
(
register_name_by_addr
,
AVF_QRX_TAIL
(
i
),
205
format
(0,
"QRX_TAIL(%u)%c"
,
i
, 0));
206
}
207
}
vlib.h
avf_aq_desc_t
Definition:
virtchnl.h:262
hash_set
#define hash_set(h, key, value)
Definition:
hash.h:255
foreach_virtchnl_op
#define foreach_virtchnl_op
Definition:
virtchnl.h:65
AVF_ATQLEN
#define AVF_ATQLEN
Definition:
virtchnl.h:41
avf_aq_desc_t::datalen
u16 datalen
Definition:
virtchnl.h:266
avf_elog_aq_enq_req
void avf_elog_aq_enq_req(avf_device_t *ad, avf_aq_desc_t *d)
Definition:
elog.c:15
AVF_ARQLEN
#define AVF_ARQLEN
Definition:
virtchnl.h:47
u16
unsigned short u16
Definition:
types.h:57
avf_elog_arq_desc
void avf_elog_arq_desc(avf_device_t *ad, avf_aq_desc_t *d)
Definition:
elog.c:90
AVFINT_DYN_CTLN
#define AVFINT_DYN_CTLN(x)
Definition:
virtchnl.h:35
addr
vhost_vring_addr_t addr
Definition:
vhost_user.h:130
avf_device_t
Definition:
avf.h:215
ethernet.h
AVF_ATQH
#define AVF_ATQH
Definition:
virtchnl.h:40
AVF_QTX_TAIL
#define AVF_QTX_TAIL(q)
Definition:
virtchnl.h:50
AVF_ATQT
#define AVF_ATQT
Definition:
virtchnl.h:48
avf_device_t::dev_instance
u32 dev_instance
Definition:
avf.h:221
ELOG_TYPE_DECLARE
#define ELOG_TYPE_DECLARE(f)
Definition:
elog.h:442
register_name_by_addr
static uword * register_name_by_addr
Definition:
elog.c:12
avf_elog_reg
void avf_elog_reg(avf_device_t *ad, u32 addr, u32 val, int is_read)
Definition:
elog.c:146
avf_aq_desc_t::flags
u16 flags
Definition:
virtchnl.h:264
AVFINT_ICR0
#define AVFINT_ICR0
Definition:
virtchnl.h:36
AVF_QRX_TAIL
#define AVF_QRX_TAIL(q)
Definition:
virtchnl.h:51
hash_get
#define hash_get(h, key)
Definition:
hash.h:249
vlib_global_main
vlib_global_main_t vlib_global_main
Definition:
main.c:1786
AVF_ATQBAL
#define AVF_ATQBAL
Definition:
virtchnl.h:46
uword
u64 uword
Definition:
types.h:112
AVF_ARQBAL
#define AVF_ARQBAL
Definition:
virtchnl.h:42
avf.h
vlib_global_main_t::elog_main
elog_main_t elog_main
Definition:
main.h:302
avf_aq_desc_t::retval
u16 retval
Definition:
virtchnl.h:267
avf_aq_desc_t::v_opcode
virtchnl_ops_t v_opcode
Definition:
virtchnl.h:271
avf_elog_aq_enq_resp
void avf_elog_aq_enq_resp(avf_device_t *ad, avf_aq_desc_t *d)
Definition:
elog.c:70
AVF_ATQBAH
#define AVF_ATQBAH
Definition:
virtchnl.h:45
avf_elog_init
void avf_elog_init(void)
Definition:
elog.c:176
format
description fragment has unexpected format
Definition:
map.api:433
u32
unsigned int u32
Definition:
types.h:88
AVF_ARQH
#define AVF_ARQH
Definition:
virtchnl.h:44
avf_aq_desc_t::v_retval
virtchnl_status_code_t v_retval
Definition:
virtchnl.h:276
pci.h
AVFINT_DYN_CTL0
#define AVFINT_DYN_CTL0
Definition:
virtchnl.h:38
AVF_ARQT
#define AVF_ARQT
Definition:
virtchnl.h:43
AVFINT_ICR0_ENA1
#define AVFINT_ICR0_ENA1
Definition:
virtchnl.h:37
unix.h
avf_aq_desc_t::opcode
u16 opcode
Definition:
virtchnl.h:265
i
int i
Definition:
flowhash_template.h:376
ELOG_DATA
#define ELOG_DATA(em, f)
Definition:
elog.h:484
hash_create
#define hash_create(elts, value_bytes)
Definition:
hash.h:695
VIRTCHNL_N_OPS
@ VIRTCHNL_N_OPS
Definition:
virtchnl.h:122
AVF_ARQBAH
#define AVF_ARQBAH
Definition:
virtchnl.h:39
AVFGEN_RSTAT
#define AVFGEN_RSTAT
Definition:
virtchnl.h:49
flags
vl_api_wireguard_peer_flags_t flags
Definition:
wireguard.api:105
src
plugins
avf
elog.c
Generated on Sat Jan 8 2022 10:35:08 for FD.io VPP by
1.8.17