-
Notifications
You must be signed in to change notification settings - Fork 0
/
vmxnet3.c
199 lines (185 loc) · 5.77 KB
/
vmxnet3.c
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/* Copyright (c) 2015 VMware Inc.*/
#include <stdio.h>
#include "internal.h"
int
vmxnet3_dump_regs(struct ethtool_drvinfo *info maybe_unused,
struct ethtool_regs *regs)
{
u32 *regs_buff = (u32 *)regs->data;
u32 version = regs->version;
int i = 0, j = 0, cnt;
if (version != 2)
return -1;
fprintf(stdout, "Control Registers\n");
fprintf(stdout, "=================\n");
fprintf(stdout,
" VRRS (Vmxnet3 Revision Report and Selection) 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" UVRS (UPT Version Report and Selection) 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" DSA (Driver Shared Address) 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" CMD (Command Register) 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" MAC (Media Access Control address) %02x:%02x:%02x:%02x:%02x:%02x\n",
regs_buff[j] & 0xff,
(regs_buff[j] >> 8) & 0xff,
(regs_buff[j] >> 16) & 0xff,
(regs_buff[j] >> 24) & 0xff,
regs_buff[j + 1] & 0xff,
(regs_buff[j + 1] >> 8) & 0xff);
j += 2;
fprintf(stdout,
" ICR (Interrupt Cause Register) 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" ECR (Event Cause Register) 0x%x\n",
regs_buff[j++]);
fprintf(stdout, "Datapath Registers\n");
fprintf(stdout, "==================\n");
/* Interrupt Mask Registers */
cnt = regs_buff[j++];
for (i = 0; i < cnt; i++) {
fprintf(stdout,
" IMR (Interrupt Mask Register) %d 0x%x\n",
i, regs_buff[j++]);
}
/* Transmit Queue Registers */
cnt = regs_buff[j++];
for (i = 0; i < cnt; i++) {
fprintf(stdout, " Transmit Queue %d\n", i);
fprintf(stdout, " ----------------\n");
fprintf(stdout,
" TXPROD (Transmit Ring Producer Register) 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" Transmit Ring\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2fill %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2comp %u\n",
regs_buff[j++]);
fprintf(stdout,
" gen %u\n",
regs_buff[j++]);
fprintf(stdout,
" Transmit Data Ring\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" Buffer Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" Transmit Completion Ring\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" size %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2proc %u\n",
regs_buff[j++]);
fprintf(stdout,
" gen %u\n",
regs_buff[j++]);
fprintf(stdout,
" stopped %u\n",
regs_buff[j++]);
}
/* Receive Queue Registers */
cnt = regs_buff[j++];
for (i = 0; i < cnt; i++) {
fprintf(stdout, " Receive Queue %d\n", i);
fprintf(stdout, " ----------------\n");
fprintf(stdout,
" RXPROD1 (Receive Ring Producer Register) 1 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" RXPROD2 (Receive Ring Producer Register) 2 0x%x\n",
regs_buff[j++]);
fprintf(stdout,
" Receive Ring 0\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2fill %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2comp %u\n",
regs_buff[j++]);
fprintf(stdout,
" gen %u\n",
regs_buff[j++]);
fprintf(stdout,
" Receive Ring 1\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2fill %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2comp %u\n",
regs_buff[j++]);
fprintf(stdout,
" gen %u\n",
regs_buff[j++]);
fprintf(stdout,
" Receive Data Ring\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" Buffer Size %u\n",
regs_buff[j++]);
fprintf(stdout,
" Receive Completion Ring\n");
fprintf(stdout,
" Base Address 0x%08x%08x\n",
regs_buff[j+1], regs_buff[j]);
j += 2;
fprintf(stdout,
" size %u\n",
regs_buff[j++]);
fprintf(stdout,
" next2proc %u\n",
regs_buff[j++]);
fprintf(stdout,
" gen %u\n",
regs_buff[j++]);
}
return 0;
}